updated model configuration in routing.#20
Merged
Conversation
…odel lists in .env and updated .env.example as well.
mxtoai/routed_litellm_model.py
Outdated
|
|
||
| # The model_id for LiteLLMRouterModel is the default model group the router will target. | ||
| # Our _get_target_model() will override this per call via the 'model' param in generate(). | ||
| default_model_group = os.getenv("LITELLM_DEFAULT_MODEL_GROUP", "gpt-4") |
Collaborator
There was a problem hiding this comment.
let's not assume a model group, this will fail later somewhere, for new self-hosted users right?
.env.example
Outdated
Comment on lines
+2
to
+6
| LITELLM_MODEL_1_JSON='{"model_name": "gpt-4", "litellm_params": {"model": "azure/gpt-4", "base_url": "https://your-endpoint.openai.azure.com", "api_key": "your-key", "api_version": "2023-05-15", "weight": 5}}' | ||
| LITELLM_MODEL_2_JSON='{"model_name": "gpt-4", "litellm_params": {"model": "azure/gpt-4-1106-preview", "base_url": "https://your-endpoint-2.openai.azure.com", "api_key": "your-key-2", "api_version": "2023-05-15", "weight": 3}}' | ||
| LITELLM_MODEL_3_JSON='{"model_name": "gpt-4-reasoning", "litellm_params": {"model": "azure/gpt-4o-mini", "api_base": "https://your-endpoint-3.openai.azure.com", "api_key": "your-key-3", "api_version": "2023-05-15", "weight": 1}}' | ||
|
|
||
| LITELLM_ROUTER_CONFIG_JSON='{"routing_strategy": "simple-shuffle", "fallbacks": [{"gpt-4": ["gpt-4-reasoning"]}], "default_litellm_params": {"drop_params": true}}' |
Collaborator
There was a problem hiding this comment.
hmm, I'd rather define these in a toml or json file (prefereably toml). And make the code read from that file. Also add the same file to .gitignore so that it's not checked in. And add an env variable called LITELLM_CONFIG_PATH in case I want to override the default path to the file.
Collaborator
|
LGTM |
gautamp8
approved these changes
May 21, 2025
mxtoai/routed_litellm_model.py
Outdated
Comment on lines
+88
to
+92
| model_config = { | ||
| "model_name": entry.get("model_name"), | ||
| "litellm_params": entry.get("litellm_params", {}), | ||
| "weight": entry.get("weight", 1) | ||
| } |
Collaborator
There was a problem hiding this comment.
let's make this a pydantic schema so that validation happens on it's own
mxtoai/routed_litellm_model.py
Outdated
Comment on lines
+153
to
+156
| return { | ||
| "routing_strategy": "simple-shuffle", | ||
| "fallbacks": [{"gpt-4": ["gpt-4-reasoning"]}], | ||
| "default_litellm_params": {"drop_params": True}, |
Collaborator
There was a problem hiding this comment.
let's also make this a pydantic schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
updated model configuration in routing. added the option to include model lists in .env and updated .env.example as well.
Included a fallback function with our default set of models. The need for this is debatable.