mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix(anthropic): drop output_config for Azure
Prevent the Anthropic pass-through adapter from forwarding output_config after it has already been translated to reasoning_effort for Azure calls. Add a regression test for azure/gpt-5.2-chat adaptive thinking so the translated reasoning parameter is preserved without leaking the unsupported output_config field. Made-with: Cursor
This commit is contained in:
parent
8e652d129d
commit
435b103b69
2 changed files with 25 additions and 1 deletions
|
|
@ -225,7 +225,7 @@ class LiteLLMMessagesToCompletionTransformationHandler:
|
|||
"include_usage": True,
|
||||
}
|
||||
|
||||
excluded_keys = {"anthropic_messages"}
|
||||
excluded_keys = {"anthropic_messages", "output_config"}
|
||||
extra_kwargs = extra_kwargs or {}
|
||||
for key, value in extra_kwargs.items():
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -261,6 +261,30 @@ class TestAdapterAdaptiveThinking:
|
|||
else:
|
||||
assert re == "high"
|
||||
|
||||
def test_messages_handler_does_not_forward_output_config_to_azure(self):
|
||||
"""Adaptive thinking should translate output_config for Azure without leaking it."""
|
||||
from litellm.llms.anthropic.experimental_pass_through.adapters.handler import (
|
||||
LiteLLMMessagesToCompletionTransformationHandler,
|
||||
)
|
||||
|
||||
completion_kwargs, _ = (
|
||||
LiteLLMMessagesToCompletionTransformationHandler._prepare_completion_kwargs(
|
||||
max_tokens=1024,
|
||||
messages=[{"role": "user", "content": "hello"}],
|
||||
model="azure/gpt-5.2-chat",
|
||||
thinking={"type": "adaptive"},
|
||||
extra_kwargs={
|
||||
"api_version": "2025-01-01-preview",
|
||||
"drop_params": True,
|
||||
"output_config": {"effort": "high"},
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
assert completion_kwargs["reasoning_effort"] == "high"
|
||||
assert completion_kwargs["api_version"] == "2025-01-01-preview"
|
||||
assert "output_config" not in completion_kwargs
|
||||
|
||||
def test_responses_adapter_adaptive_with_output_config(self):
|
||||
"""Responses adapter: adaptive thinking + output_config.effort."""
|
||||
from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue