litellm/tests/unit/llms/azure
tavren27 a705537692
fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151)
* fix(openai): treat chat-latest and gpt-chat-latest as gpt-5 family models

OpenAI's chat-latest alias and Azure / Foundry gpt-chat-latest deployments reject max_tokens,
temperature other than 1, top_p, stop, the penalties, logit_bias and logprobs, which is the gpt-5
reasoning family's parameter shape. The shared name check only matched gpt-5 and gpt-6, so these
names forwarded max_tokens and the provider answered 400

The family check now also matches a last path segment equal to chat-latest or containing
gpt-chat-latest, and Azure's max_completion_tokens rename reuses the same helper. gpt-5-chat-latest
keeps its exclusion from issue 13781

Two side effects of moving these names onto the gpt-5 config are fixed too. The gpt-5 config read
tool_choice support off the bare name, which dropped it for azure_ai/gpt-chat-latest, so it now
reads the provider's map row. Azure gpt-5 deployments off the OpenAI catalog lost the user param,
which Azure accepts, so the Azure gpt-5 config adds it back next to tool_choice

The azure_ai/gpt-chat-latest map row gets reasoning_effort_levels ["medium"] like its azure and
openai twins, so /v1/messages lowers xhigh and max to medium instead of high, which Foundry rejects

* fix(openai): enforce a map row's reasoning_effort_levels on the gpt-5 effort checks

* fix(openai): import declared_reasoning_efforts_for_map_key from its litellm_core_utils home

* fix(openai): keep chat-latest tool_choice and user scoped and read effort levels off the catalog row

A router deployment's model_info.reasoning_effort_levels is copied onto the shared
map key, so reading levels from litellm.model_cost let one deployment gate its
siblings. The gate now reads catalog_with_runtime_registrations(), which leaves
router registrations out

chat-latest names keep tool_choice on every provider as they did before they
joined the gpt-5 config, and Azure adds user back only for chat-latest names, so
other off-catalog Azure gpt-5 deployments keep dropping it as on main

* fix(openai): gate custom chat-latest deployment names by the chat-latest row and keep main's tool_choice lookup

* fix(openai): keep chat-latest names on main's handling outside OpenAI, Azure and Foundry, and read base_model on azure_ai

* fix(openai): keep chat-latest names OpenAI doesn't serve on main's handling, and let a Foundry gpt-5 base_model set the param list

* fix(azure_ai,router): keep known Foundry names' params and drop effort levels a chat-latest row refuses

A gpt-5 base_model now stands in for a Foundry deployment name only when the
name is neither gpt-5 family nor a known azure_ai catalog model, with any
provider prefix stripped, so model-router, Phi-4 and gpt-5.6-terra keep main's
params. The complexity router's classifier and tier params drop a
reasoning_effort level a gpt-5 row lists its levels without, unless the
deployment's own model_info lists it

* fix(azure_ai): route custom Foundry names with a gpt-5 base_model to Responses for tools with reasoning

A custom-named Foundry deployment whose base_model is gpt-5.6 or later now
bridges function tools with an active reasoning effort to /v1/responses, the
same as the deployment named after that model, instead of 400ing on chat

* fix(anthropic): keep signed thinking for custom Foundry names that a gpt-5 base_model routes to Responses

* fix(azure_ai,cost): price nested base_model forms and refuse n and seed when a gpt-5 base_model bridges a custom Foundry name

A base_model written as azure_ai/openai/gpt-5.6-terra priced at $0 on every path. Chat only looked priced because Foundry's chat response names the served model, while Foundry's Responses API echoes the deployment name, so bridged and direct /v1/responses calls recorded $0. The cost lookup now drops a nested provider segment from a base_model that has no rates of its own, so it prices like azure_ai/gpt-5.6-terra, and a nested name with its own cost-map row keeps that row

A custom azure_ai name that its gpt-5 base_model sends to the Responses API now answers 400 for n above 1 or any seed, since Responses has neither field, unless drop_params is set. Names LiteLLM already knows and every other provider keep their current behavior

* fix(azure_ai): refuse n and seed only when the gpt-5 base_model sent the request to Responses

The explicit azure_ai/responses/ prefix and a pinned mode: responses already chose Responses before the
base_model was read, so those routes keep main's handling and no longer get a 400 that blames the base_model

* fix(azure_ai): let the /v1/messages adapter see a request-level base_model and name the proxy drop_params setting

A custom azure_ai deployment whose gpt-5 base_model sends it to the Responses API now keeps its reasoning summary on /v1/messages whether the base_model sits in model_info or litellm_params, with a non-empty litellm_params value winning as it does in completion(). The n and seed refusal names the proxy drop_params setting, and tests pin seed=0, n=1, a responses/ name and a gpt-5.6 deployment name keeping its own rules

* test(anthropic): use gpt-5-chat-latest as the chat model that takes no reasoning effort

chat-latest now takes the gpt-5 shape with a medium effort, so main's new
bare-effort test needs a model whose chat config still refuses reasoning_effort

* fix(openai): type OpenAIConfig's supported params as a list of strings

* fix(router): match openai/chat-latest and read litellm_params base_model first in the router's param check

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 04:02:51 -08:00
..
batches test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
chat fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151) 2026-11-24 04:02:51 -08:00
completion test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
decisions fix(decisions): accept OpenAI input_json content parts on /v1/decisions (#52805) 2026-11-20 13:33:36 -08:00
image_edit test(unit): add package markers to migrated unit test directories 2026-09-20 11:53:14 +00:00
image_generation refactor(images): remove dall-e-2 and dall-e-3 code paths (#48703) 2026-10-28 17:48:09 -07:00
live feat(realtime): serve Azure GPT-Live sessions on /v1/live/sessions (#53238) 2026-11-20 17:46:05 -08:00
passthrough fix(vllm): write spend log rows for /vllm passthrough calls to router models (#45733) 2026-10-14 12:40:48 -07:00
realtime feat(realtime): bill translation WebRTC calls by the time the call ran (#53548) 2026-11-22 00:25:53 -08:00
response fix(azure): send no api-version on Foundry project /openai/v1 Responses bases (#51767) 2026-11-14 05:24:12 -05:00
search fix(azure)!: answer 401 when Entra rejects the deployment's credential (#49863) 2026-11-04 20:44:55 +00:00
text_to_speech test: migrate SDK and proxy-booting legacy CircleCI tests to their tiers (#45758) 2026-10-11 00:17:21 -07:00
vector_stores fix(vector_stores): put azure vector store id before the api-version query on retrieve, update and delete (#48224) 2026-10-24 13:44:19 -07:00
videos test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
__init__.py test(unit): add package markers to migrated unit test directories 2026-09-20 11:53:14 +00:00
test_audio_transcriptions.py fix(transcription): log the clip duration as usage when the provider sends none (#53256) 2026-11-20 18:30:52 -08:00
test_azure.py test(azure): restore client session after extra headers test (#52815) 2026-11-19 08:27:46 +00:00
test_azure_common_utils.py fix(azure_ai)!: send chat on Foundry project and /openai/v1 bases to the v1 chat route (#51144) 2026-11-18 05:50:05 +00:00
test_azure_cost_calculation.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_azure_embedding.py test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
test_azure_exception_mapping.py fix(exceptions): map upstream 403 to PermissionDeniedError for OpenAI-style providers (#52179) 2026-11-17 03:14:09 +00:00
test_azure_fine_tuning_api.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_azure_ptu_capacity.py feat(proxy): split Azure PTU deployments across teams with per-team PTU ceilings and PTU-hour reporting (#43043) 2026-10-15 18:44:30 +00:00
test_azure_speech_audio_transcription.py refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00