mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-01 01:18:34 +00:00
* fix(completion): accept a tool_choice that forces an OpenAI hosted tool
litellm.completion rejected tool_choice={"type": "web_search"} before any request, while /v1/responses took the same choice. The chat validator now forwards a hosted tool type unchanged and a provider gate turns it into a 400 off openai, azure and litellm_proxy, where the choice would otherwise be dropped or mangled.
Fixes #50566
* fix(utils): keep a non-string tool_choice type a 400, not a TypeError
A list or dict in tool_choice["type"] is unhashable, so the hosted tool lookup needs the string check first. The bridge test that used file_search as an untranslatable choice now uses a type that really is unknown.
* refactor(completion): forward any Responses API tool_choice type instead of keeping a hosted tool allowlist
Chat completions now accepts any tool_choice dict with a string type it has no shape for and sends it as is on openai, azure and litellm_proxy, where OpenAI validates the type itself (a typo is still a 400, from OpenAI). The provider gate keeps the 400 everywhere else. The HOSTED_TOOL_CHOICE_TYPES list is gone, so a new OpenAI hosted tool needs no change here.
* Revert "refactor(completion): forward any Responses API tool_choice type instead of keeping a hosted tool allowlist"
This reverts commit
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_anthropic_responses_bridge.py | ||
| test_client_tool_search.py | ||
| test_compaction_items.py | ||
| test_count_request.py | ||
| test_function_call_output_normalization.py | ||
| test_google_ai_studio_responses_bridge.py | ||
| test_google_ai_studio_responses_wire.py | ||
| test_handler.py | ||
| test_image_generation_output.py | ||
| test_litellm_completion_responses.py | ||
| test_reasoning_input_item_preservation.py | ||
| test_reasoning_items.py | ||
| test_session_handler.py | ||
| test_session_handler_with_cold_storage.py | ||
| test_streaming_iterator_transformation.py | ||
| test_tool_output_order_preserved_for_gemini.py | ||