Initialize the RoRF controller with the specified router, model A, model B, and threshold. Threshold determines the percentage of calls made to model A by the router.
(
self,
router: str,
model_a: str,
model_b: str,
threshold: float,
)
| 22 | |
| 23 | class Controller: |
| 24 | def __init__( |
| 25 | self, |
| 26 | router: str, |
| 27 | model_a: str, |
| 28 | model_b: str, |
| 29 | threshold: float, |
| 30 | ): |
| 31 | """ |
| 32 | Initialize the RoRF controller with the specified router, model A, model B, and threshold. |
| 33 | Threshold determines the percentage of calls made to model A by the router. |
| 34 | """ |
| 35 | self._validate_router_threshold(router, threshold) |
| 36 | self.embedding_provider = self._parse_model_name(router) |
| 37 | logger.info(f"Initializing RoRF controller for {router} with {self.embedding_provider} embeddings...") |
| 38 | self.router_model, self.embedding_model = self.load(router, self.embedding_provider) |
| 39 | self.model_a, self.model_b = model_a, model_b |
| 40 | self.threshold = threshold |
| 41 | |
| 42 | def _validate_router_threshold( |
| 43 | self, router: Optional[str], threshold: Optional[float] |
nothing calls this directly
no test coverage detected