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]

Add container field as provider specific field

Sameer Kankutee40ad5203eb3
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index 628121ab11c..72c95eef12b 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -1132,22 +1132,12 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
if content["type"] == "text":
text_content += content["text"]
## TOOL CALLING
- elif content["type"] == "tool_use":
+ elif content["type"] == "tool_use" or content["type"] == "server_tool_use":
tool_call = AnthropicConfig.convert_tool_use_to_openai_format(
anthropic_tool_content=content,
index=idx,
)
tool_calls.append(tool_call)
- ## SERVER TOOL USE (for tool search)
- elif content["type"] == "server_tool_use":
- # Server tool use blocks are for tool search - treat as tool calls
- # Note: using .get("input", {}) for server_tool_use as input may not be present
- content_with_input = {**content, "input": content.get("input", {})}
- tool_call = AnthropicConfig.convert_tool_use_to_openai_format(
- anthropic_tool_content=content_with_input,
- index=idx,
- )
- tool_calls.append(tool_call)
## TOOL SEARCH TOOL RESULT (skip - this is metadata about tool discovery)
elif content["type"] == "tool_search_tool_result":
# This block contains tool_references that were discovered
@@ -1343,6 +1333,8 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
"context_management"
)
+ container: Optional[Dict] = completion_response.get("container")
+
provider_specific_fields: Dict[str, Any] = {
"citations": citations,
"thinking_blocks": thinking_blocks,
@@ -1351,7 +1343,9 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
provider_specific_fields["context_management"] = context_management
if web_search_results is not None:
provider_specific_fields["web_search_results"] = web_search_results
-
+ if container is not None:
+ provider_specific_fields["container"] = container
+
_message = litellm.Message(
tool_calls=tool_calls,
content=text_content or None,