mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix(azure): strip GPT-5 routing marker from Responses deployments (#51438)
Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com>
This commit is contained in:
parent
d723545320
commit
5e0f911499
2 changed files with 30 additions and 1 deletions
|
|
@ -145,7 +145,12 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig):
|
|||
return BaseAzureLLM.base_validate_azure_environment(headers=headers, litellm_params=litellm_params)
|
||||
|
||||
def get_stripped_model_name(self, model: str) -> str:
|
||||
return model.replace("responses/", "").replace("o_series/", "").replace("azure_ai/", "")
|
||||
return (
|
||||
model.replace("responses/", "")
|
||||
.replace("o_series/", "")
|
||||
.replace("azure_ai/", "")
|
||||
.replace(AzureOpenAIGPT5Config.GPT5_SERIES_ROUTE, "")
|
||||
)
|
||||
|
||||
def _validate_input_param(
|
||||
self, input: str | ResponseInputParam, *, drop_params: bool = False
|
||||
|
|
|
|||
|
|
@ -1308,6 +1308,30 @@ def test_responses_api_version_routes_a_dated_chat_deployment_to_its_own_respons
|
|||
assert "api_version" not in request_body
|
||||
|
||||
|
||||
@pytest.mark.respx(assert_all_called=True)
|
||||
@pytest.mark.parametrize(
|
||||
"model",
|
||||
["azure/gpt5_series/my-deployment", "azure/responses/gpt5_series/my-deployment", "azure/my-deployment"],
|
||||
)
|
||||
def test_responses_sends_the_bare_deployment_name_without_the_gpt5_series_marker(
|
||||
respx_mock: respx.MockRouter, model: str
|
||||
) -> None:
|
||||
route: Final = respx_mock.post(
|
||||
"https://example-resource.openai.azure.com/openai/responses", params={"api-version": "2025-04-01-preview"}
|
||||
).mock(return_value=httpx.Response(200, json=_COMPLETED_RESPONSE))
|
||||
|
||||
litellm.responses(
|
||||
model=model,
|
||||
input="hi",
|
||||
api_base="https://example-resource.openai.azure.com",
|
||||
api_key="azure-test-key",
|
||||
api_version="2025-04-01-preview",
|
||||
)
|
||||
|
||||
assert route.call_count == 1
|
||||
assert TypeAdapter(dict[str, JsonValue]).validate_json(route.calls[0].request.content)["model"] == "my-deployment"
|
||||
|
||||
|
||||
@pytest.mark.respx(assert_all_called=True)
|
||||
def test_responses_api_version_reaches_the_url_when_chat_completion_bridges_to_responses(
|
||||
respx_mock: respx.MockRouter,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue