The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(responses_bridge): forward verbosity as text.verbosity
kerrye8f246bb6b36
diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.pyindex 5a6debc4af5..a76032854b7 100644--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py@@ -502,7 +502,11 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):elif key == "response_format":text_format = self._transform_response_format_to_text_format(value)if text_format:- responses_api_request["text"] = text_format+ existing_text = cast("dict[str, object]", responses_api_request["text"] if "text" in responses_api_request else {})+ responses_api_request["text"] = cast("ResponseText", {**existing_text, **text_format})+ elif key == "verbosity":+ existing_text = cast("dict[str, object]", responses_api_request["text"] if "text" in responses_api_request else {})+ responses_api_request["text"] = cast("ResponseText", {**existing_text, "verbosity": value})elif key == "tool_choice":responses_api_request["tool_choice"] = self._normalize_tool_choice_for_responses_api(value)elif key == "stream_options":diff --git a/tests/test_litellm/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py b/tests/test_litellm/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.pyindex e4ada0a9b31..c326ad4a0f7 100644--- a/tests/test_litellm/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py+++ b/tests/test_litellm/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py@@ -4287,3 +4287,36 @@ def test_system_string_after_a_developer_message_stays_in_input_in_client_order(assert instructions is Noneassert [item["role"] for item in input_items] == ["developer", "system", "user"]assert input_items[1] == _system_input_item("Be brief.")+++def test_map_optional_params_verbosity_merges_into_text():+ """Chat verbosity must land on Responses text.verbosity alongside text.format regardless of key order."""+ from litellm.completion_extras.litellm_responses_transformation.transformation import (+ LiteLLMResponsesTransformationHandler,+ )+ from litellm.types.llms.openai import ResponsesAPIOptionalRequestParams++ handler: Final = LiteLLMResponsesTransformationHandler()++ responses_api_request = ResponsesAPIOptionalRequestParams()+ handler._map_optional_params_to_responses_api_request(+ {"verbosity": "low", "response_format": {"type": "json_object"}},+ responses_api_request,+ )+ assert responses_api_request["text"]["verbosity"] == "low"+ assert responses_api_request["text"]["format"]["type"] == "json_object"++ reversed_request = ResponsesAPIOptionalRequestParams()+ handler._map_optional_params_to_responses_api_request(+ {"response_format": {"type": "json_object"}, "verbosity": "low"},+ reversed_request,+ )+ assert reversed_request["text"]["verbosity"] == "low"+ assert reversed_request["text"]["format"]["type"] == "json_object"++ verbosity_only_request = ResponsesAPIOptionalRequestParams()+ handler._map_optional_params_to_responses_api_request(+ {"verbosity": "low"},+ verbosity_only_request,+ )+ assert verbosity_only_request["text"] == {"verbosity": "low"}