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: mypy chat transformation

Sameer Kankuted145a36c90c8
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index 7c48474a663..82eccee596d 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -222,17 +222,14 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
"""
if not isinstance(schema, dict):
return schema
-
- # Fields that Anthropic doesn't support in output_format
+
unsupported_fields = {"maxItems", "minItems"}
-
- result = {}
+
+ result: Dict[str, Any] = {}
for key, value in schema.items():
- # Skip unsupported fields
if key in unsupported_fields:
continue
-
- # Recursively filter nested structures
+
if key == "properties" and isinstance(value, dict):
result[key] = {
k: AnthropicConfig.filter_anthropic_output_schema(v)
@@ -262,7 +259,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
]
else:
result[key] = value
-
+
return result
def get_json_schema_from_pydantic_object(