mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
Merge 1fc90f7c18 into 252c71c0b2
This commit is contained in:
commit
1d09fea25e
2 changed files with 23 additions and 0 deletions
|
|
@ -65,6 +65,12 @@ class OpenAILikeAnthropicMessagesConfig(AnthropicMessagesConfig):
|
|||
def supports_cache_control_ttl(self) -> bool:
|
||||
return self._cache_control_ttl
|
||||
|
||||
@staticmethod
|
||||
def _translate_adaptive_effort_for_non_adaptive_model(
|
||||
model: str, optional_params: dict[str, Any], max_tokens: int | None, custom_llm_provider: str
|
||||
) -> None:
|
||||
"""Keep native Anthropic adaptive fields intact for opted-in deployments."""
|
||||
|
||||
def transform_anthropic_messages_request(
|
||||
self,
|
||||
model: str,
|
||||
|
|
|
|||
|
|
@ -94,6 +94,23 @@ def test_request_stays_in_anthropic_shape(config):
|
|||
assert openai_only_keys.isdisjoint(payload.keys())
|
||||
|
||||
|
||||
def test_request_preserves_adaptive_thinking_and_effort(config):
|
||||
payload = config.transform_anthropic_messages_request(
|
||||
model="my-model",
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
anthropic_messages_optional_request_params={
|
||||
"max_tokens": 256,
|
||||
"thinking": {"type": "adaptive"},
|
||||
"output_config": {"effort": "high"},
|
||||
},
|
||||
litellm_params=GenericLiteLLMParams(),
|
||||
headers={},
|
||||
)
|
||||
|
||||
assert payload["thinking"] == {"type": "adaptive"}
|
||||
assert payload["output_config"] == {"effort": "high"}
|
||||
|
||||
|
||||
def test_request_requires_max_tokens(config):
|
||||
with pytest.raises(AnthropicError, match="max_tokens is required"):
|
||||
config.transform_anthropic_messages_request(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue