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(transformation.py): allows passing native responses api tools like web_search_preview, and mcp via `.completion()` (#12627)
Krish Dholakia1ce3558f963a
diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.pyindex 2356b23b10e..43fb64b69ea 100644--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py@@ -454,17 +454,7 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):"""Convert chat completion tools to responses API tools format"""responses_tools = []for tool in tools:- if tool.get("type") == "function":- function = tool.get("function", {})- responses_tools.append(- {- "type": "function",- "name": function.get("name", ""),- "description": function.get("description", ""),- "parameters": function.get("parameters", {}),- "strict": function.get("strict", False),- }- )+ responses_tools.append(tool)return cast(List["ALL_RESPONSES_API_TOOL_PARAMS"], responses_tools)def _map_reasoning_effort(self, reasoning_effort: str) -> Optional[Reasoning]:@@ -647,7 +637,8 @@ class OpenAiResponsesToChatCompletionStreamIterator(BaseModelResponseIterator):return ModelResponseStream(choices=[StreamingChoices(- index=parsed_chunk.get("summary_index"), delta=Delta(reasoning_content=content_part)+ index=cast(int, parsed_chunk.get("summary_index")),+ delta=Delta(reasoning_content=content_part),)])diff --git a/tests/llm_translation/test_openai.py b/tests/llm_translation/test_openai.pyindex 8e6ab53df71..e8c5adacc1a 100644--- a/tests/llm_translation/test_openai.py+++ b/tests/llm_translation/test_openai.py@@ -543,3 +543,20 @@ async def test_openai_codex(sync_mode):print("response: ", response)assert response.choices[0].message.content is not None+++def test_openai_deepresearch_model_bridge():+ """+ Test that the deepresearch model bridge works correctly+ """+ litellm._turn_on_debug()+ response = litellm.completion(+ model="o3-deep-research-2025-06-26",+ messages=[{"role": "user", "content": "What is the capital of France?"}],+ tools=[+ {"type": "web_search_preview"},+ {"type": "code_interpreter", "container": {"type": "auto"}},+ ],+ )++ print("response: ", response)