fixes for auto router

This commit is contained in:
Ishaan Jaff 2025-07-24 13:25:28 -07:00
parent d66c7fb8b0
commit e3e38bdcc8
2 changed files with 9 additions and 6 deletions

View file

@ -18,18 +18,23 @@ class AutoRouter(CustomLogger):
def __init__(
self,
router_config_path: str,
default_model: str
default_model: str,
embedding_model: str,
embedding_model_api_key: str,
):
from semantic_router import Route
from semantic_router.encoders import OpenAIEncoder
from semantic_router.encoders import LiteLLMEncoder
from semantic_router.routers import SemanticRouter
self.router_config_path = router_config_path
self.auto_sync_value = self.DEFAULT_AUTO_SYNC_VALUE
loaded_router: SemanticRouter = SemanticRouter.from_json(self.router_config_path)
self.routelayer: SemanticRouter = SemanticRouter(
routes=loaded_router.routes,
encoder=loaded_router.encoder,
auto_sync=self.auto_sync_value
encoder=LiteLLMEncoder(
name=embedding_model,
api_key=embedding_model_api_key,
),
auto_sync=self.auto_sync_value,
)
self.default_model = default_model
pass

View file

@ -1,6 +1,4 @@
{
"encoder_type": "openai",
"encoder_name": "text-embedding-3-large",
"routes": [
{
"name": "openai/gpt-4.1",