fix(azure): keep the model group segment exact and casefold only deployment names in the relay guard
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled

This commit is contained in:
mateo-berri 2026-09-08 17:19:23 -07:00
parent 4fa34accb8
commit 5ea447e295
2 changed files with 4 additions and 5 deletions

View file

@ -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:

View file

@ -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(