mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix(azure): keep the model group segment exact and casefold only deployment names in the relay guard
This commit is contained in:
parent
4fa34accb8
commit
5ea447e295
2 changed files with 4 additions and 5 deletions
|
|
@ -82,11 +82,10 @@ def foreign_azure_deployment(
|
|||
if match is None:
|
||||
return None
|
||||
deployment: Final = match.group(1)
|
||||
folded: Final = deployment.casefold()
|
||||
if folded == model_group.casefold():
|
||||
if deployment == model_group:
|
||||
return None
|
||||
served: Final = frozenset(name.casefold() for name in served_models())
|
||||
return None if folded in served else deployment
|
||||
return None if deployment.casefold() in served else deployment
|
||||
|
||||
|
||||
def without_api_version(api_base: str) -> str:
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ def test_azure_passthrough_is_streaming_request_reads_the_stream_flag(request_da
|
|||
("openai/deployments/gpt/chat/completions", None),
|
||||
("gpt/openai/deployments/gpt-5.4-mini/chat/completions", None),
|
||||
("gpt/openai/deployments/GPT-5.4-MINI/chat/completions", None),
|
||||
("gpt/openai/deployments/Gpt/chat/completions", None),
|
||||
("gpt/openai/deployments/Gpt/chat/completions", "Gpt"),
|
||||
("gpt/models/chat/completions", None),
|
||||
("gpt/openai/deployments/gpt-5.4/chat/completions", "gpt-5.4"),
|
||||
("gpt/openai/deployments/other-group/chat/completions", "other-group"),
|
||||
|
|
@ -473,7 +473,7 @@ def test_foreign_azure_deployment_skips_the_router_when_the_segment_is_the_group
|
|||
def served_models():
|
||||
raise AssertionError("the router must not be consulted for the group's own name")
|
||||
|
||||
assert foreign_azure_deployment("gpt/openai/deployments/Gpt/chat/completions", "gpt", served_models) is None
|
||||
assert foreign_azure_deployment("gpt/openai/deployments/gpt/chat/completions", "gpt", served_models) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue