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: add explicit "summary" not in result guards to opt-out test paths

Krrish Dholakiacb4027531b1c
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py
index 24080ca1203..33628e1d19d 100644
--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py
+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py
@@ -190,6 +190,7 @@ def test_openai_model_with_thinking_converts_to_reasoning():
f"reasoning should be {expected_reasoning} for budget_tokens=1024, "
f"got {call_kwargs.get('reasoning')}"
)
+ assert "summary" not in call_kwargs["reasoning"]
# Verify thinking is NOT passed directly to the Responses API
assert (
@@ -230,6 +231,7 @@ class TestThinkingParameterTransformation:
# reasoning_auto_summary is False by default, so no summary key
assert result == {"reasoning_effort": "minimal"}
assert "thinking" not in result
+ assert "summary" not in str(result["reasoning_effort"])
def test_translate_thinking_for_model_summary_when_enabled(self):
"""When reasoning_auto_summary is True, summary='detailed' is injected."""
@@ -479,7 +481,7 @@ class TestThinkingSummaryPreservation:
)
)
assert result == {"effort": "medium"}
- assert "summary" not in result
+ assert result is not None and "summary" not in result
finally:
litellm.reasoning_auto_summary = original
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.py
index 6224652d9d5..02b817cd334 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
@@ -614,7 +614,9 @@ class TestTranslateThinkingToReasoning:
result = _ADAPTER.translate_thinking_to_reasoning(
{"type": "enabled", "budget_tokens": 10000}
)
+ # Default (reasoning_auto_summary=False): only effort, no summary
assert result == {"effort": "high"}
+ assert result is not None and "summary" not in result
def test_budget_above_threshold_high_effort(self):
result = _ADAPTER.translate_thinking_to_reasoning(
@@ -622,24 +624,28 @@ class TestTranslateThinkingToReasoning:
)
assert result is not None
assert result["effort"] == "high"
+ assert "summary" not in result
def test_budget_medium_effort(self):
result = _ADAPTER.translate_thinking_to_reasoning(
{"type": "enabled", "budget_tokens": 7500}
)
assert result == {"effort": "medium"}
+ assert result is not None and "summary" not in result
def test_budget_low_effort(self):
result = _ADAPTER.translate_thinking_to_reasoning(
{"type": "enabled", "budget_tokens": 3000}
)
assert result == {"effort": "low"}
+ assert result is not None and "summary" not in result
def test_budget_minimal_effort(self):
result = _ADAPTER.translate_thinking_to_reasoning(
{"type": "enabled", "budget_tokens": 500}
)
assert result == {"effort": "minimal"}
+ assert result is not None and "summary" not in result
def test_budget_at_exact_thresholds(self):
result_medium = _ADAPTER.translate_thinking_to_reasoning(
@@ -647,11 +653,13 @@ class TestTranslateThinkingToReasoning:
)
assert result_medium is not None
assert result_medium["effort"] == "medium"
+ assert "summary" not in result_medium
result_low = _ADAPTER.translate_thinking_to_reasoning(
{"type": "enabled", "budget_tokens": 2000}
)
assert result_low is not None
assert result_low["effort"] == "low"
+ assert "summary" not in result_low
def test_disabled_type_returns_none(self):
result = _ADAPTER.translate_thinking_to_reasoning({"type": "disabled"})
@@ -665,6 +673,7 @@ class TestTranslateThinkingToReasoning:
"""Missing budget_tokens defaults to 0, which is < 2000 -> minimal."""
result = _ADAPTER.translate_thinking_to_reasoning({"type": "enabled"})
assert result == {"effort": "minimal"}
+ assert result is not None and "summary" not in result
def test_summary_added_when_auto_summary_enabled(self):
"""When reasoning_auto_summary is True, summary='detailed' is included."""
@@ -774,6 +783,7 @@ class TestTranslateRequestBroaderCoverage:
kwargs = _ADAPTER.translate_request(req)
# reasoning_auto_summary is False by default, so no summary key
assert kwargs["reasoning"] == {"effort": "high"}
+ assert "summary" not in kwargs["reasoning"]
def test_disabled_thinking_not_included_in_kwargs(self):
req = _make_request(thinking={"type": "disabled"})