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(litellm): pass a flat Responses-style function tool through the chat bridge unchanged
mateo-berric1ba76154e1e
diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.pyindex 1b976f5a48b..4024ce5360e 100644--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py@@ -1115,7 +1115,7 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):responses_tools: Final[list[ALL_RESPONSES_API_TOOL_PARAMS]] = []for tool in tools:# convert function tool from chat completion to responses API format- if tool.get("type") == "function":+ if tool.get("type") == "function" and isinstance(tool.get("function"), dict):function_tool = cast(ChatCompletionToolParamFunctionChunk, tool.get("function"))responses_tools.append(FunctionToolParam(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 c326ad4a0f7..7e03a8886fb 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@@ -830,6 +830,24 @@ def test_convert_tools_to_responses_format():assert result[0]["name"] == "test"+def test_convert_tools_to_responses_format_passes_flat_function_tool_through():+ from litellm.completion_extras.litellm_responses_transformation.transformation import (+ LiteLLMResponsesTransformationHandler,+ )++ handler = LiteLLMResponsesTransformationHandler()+ flat_tool = {+ "type": "function",+ "name": "shell",+ "description": "Run a shell command",+ "parameters": {"type": "object", "properties": {"cmd": {"type": "string"}}, "required": ["cmd"]},+ }++ converted = handler._convert_tools_to_responses_format([flat_tool])++ assert converted == [flat_tool]++def test_extract_extra_body_params_reasoning_effort_override():"""Test that reasoning_effort from extra_body overrides top-level reasoning_effort"""from litellm.completion_extras.litellm_responses_transformation.transformation import (