mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
fix(proxy): preserve model ids during wildcard expansion
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
2ed624550d
commit
624f4281aa
2 changed files with 3 additions and 1 deletions
|
|
@ -325,7 +325,7 @@ def get_known_models_from_wildcard(wildcard_model: str, litellm_params: LiteLLM_
|
|||
# Only strip the leading segment when it is a known provider, so ids whose first
|
||||
# segment is an org rather than a provider (e.g. "meta-llama/Llama-3-8B") keep it.
|
||||
leading, sep, model_suffix = model.partition("/")
|
||||
if sep and leading in known_providers:
|
||||
if sep and leading in known_providers and (provider in litellm.models_by_provider or leading == provider):
|
||||
model = f"{wildcard_provider_prefix}/{model_suffix}"
|
||||
else:
|
||||
model = f"{wildcard_provider_prefix}/{model}"
|
||||
|
|
|
|||
|
|
@ -442,6 +442,7 @@ def test_get_known_models_from_wildcard_hosted_vllm_uses_provider_endpoint():
|
|||
"data": [
|
||||
{"id": "meta-llama/Llama-3.1-8B-Instruct"},
|
||||
{"id": "qwen2.5"},
|
||||
{"id": "openai/foo"},
|
||||
]
|
||||
}
|
||||
original_check_provider_endpoint = litellm.check_provider_endpoint
|
||||
|
|
@ -460,6 +461,7 @@ def test_get_known_models_from_wildcard_hosted_vllm_uses_provider_endpoint():
|
|||
assert result == [
|
||||
"hosted_vllm/meta-llama/Llama-3.1-8B-Instruct",
|
||||
"hosted_vllm/qwen2.5",
|
||||
"hosted_vllm/openai/foo",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue