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(anthropic-responses): preserve nested strict setting
eugene-yao-zocdoc690656e2b380
diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.pyindex 01917cd9a59..5ed8f26afca 100644--- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py+++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py@@ -520,7 +520,7 @@ class LiteLLMAnthropicToResponsesAPIAdapter:"type": "json_schema","name": "structured_output","schema": schema,- "strict": bool(output_format.get("strict")),+ "strict": output_format.get("strict", False),}}diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.pyindex a7efff6aa33..4057706f297 100644--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py@@ -142,6 +142,14 @@ class TestOutputConfigStructuredOutput:assert fmt["strict"] is Falseassert fmt["name"] == "structured_output"+ def test_output_config_format_explicit_strict_true_is_preserved(self):+ """Nested output_config.format with explicit strict=True is preserved."""+ req = _make_request(+ output_config={"format": {"type": "json_schema", "schema": self._SCHEMA, "strict": True}}+ )+ kwargs = _ADAPTER.translate_request(req)+ assert kwargs["text"]["format"]["strict"] is True+def test_output_config_without_format_does_not_set_text(self):"""output_config with only non-format keys doesn't produce text.format."""req = _make_request(output_config={"effort": "high"})