Skip to content

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]

Fix structured response of tool call

Sameer Kankute3d49388d8e2f
diff --git a/litellm/integrations/websearch_interception/transformation.py b/litellm/integrations/websearch_interception/transformation.py
index 0884d408c84..3201d99d69a 100644
--- a/litellm/integrations/websearch_interception/transformation.py
+++ b/litellm/integrations/websearch_interception/transformation.py
@@ -3,7 +3,7 @@ WebSearch Tool Transformation
Transforms between Anthropic/OpenAI tool_use format and LiteLLM search format.
"""
-
+import json
from typing import Any, Dict, List, Tuple
from litellm._logging import verbose_logger
@@ -301,7 +301,7 @@ class WebSearchTransformation:
"type": "function",
"function": {
"name": tc["name"],
- "arguments": str(tc["input"]),
+ "arguments": json.dumps(tc["input"]) if isinstance(tc["input"], dict) else str(tc["input"]),
},
}
for tc in tool_calls
diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.py
index c6f502d3a25..da87852dff5 100644
--- a/litellm/llms/openai/openai.py
+++ b/litellm/llms/openai/openai.py
@@ -926,7 +926,6 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM):
logging_obj=logging_obj,
)
stringified_response = response.model_dump()
- print(f"🔥stringified_response: {stringified_response}")
logging_obj.post_call(
input=data["messages"],
api_key=api_key,