Files
litellm/tests
Xingyao Wang 4860cdbfd5 Fix: Azure GPT-5 incorrectly routed to O-series config (temperature parameter unsupported) (#16246)
* Fix Azure GPT-5 incorrectly routing to O-series config

GPT-5 models support reasoning but are NOT O-series models and DO support
temperature parameter. The previous routing logic in get_provider_responses_api_config()
was incorrectly sending Azure GPT-5 requests to AzureOpenAIOSeriesResponsesAPIConfig
which removes temperature from supported params.

This fix explicitly excludes GPT-5 models from O-series routing, ensuring they
use the standard AzureOpenAIResponsesAPIConfig which properly supports temperature.

Fixes: Azure GPT-5 throwing UnsupportedParamsError for temperature parameter
Tested: Added comprehensive unit tests for GPT-5 and O-series routing

* Apply suggestion from @xingyaoww

* Apply suggestion from @xingyaoww

* Improve Azure routing logic to use broader 'gpt' check for temperature support

Based on feedback from @krrishdholakia, updated the routing logic to check
for 'gpt' in model name instead of specifically 'gpt-5'. This approach is:

- More future-proof: covers all GPT models (gpt-3.5, gpt-4, gpt-5, future models)
- Simpler: single check for all GPT variants
- More maintainable: won't need updates for each new GPT model

Changes:
- litellm/utils.py: Changed from is_gpt5 to is_gpt_model check
- tests: Added comprehensive test for all GPT model variants (gpt-3.5 through gpt-5)

All tests pass:
- GPT models (gpt-3.5-turbo, gpt-4, gpt-4o, gpt-5) -> AzureOpenAIResponsesAPIConfig (supports temperature)
- O-series models (o1, o3) -> AzureOpenAIOSeriesResponsesAPIConfig (no temperature)

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-07 10:24:27 -08:00
..
2025-11-06 17:07:53 -08:00
2025-11-06 16:26:14 -08:00
2025-11-01 09:21:17 -07:00
2025-10-04 10:57:02 -07:00
2025-11-06 16:17:14 -08:00
2025-10-31 20:32:03 -07:00
2025-09-27 10:59:25 -07:00

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.