mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
fix(bedrock): type GPT-5 reasoning field and update capability test
Type the GPT-5.x reasoning payload with a ReadOnly TypedDict so the dict literal satisfies the type-discipline budget, and drop the now-redundant thinking pop (the thinking mapping is already skipped for these models). Update the cross-region capability test to expect reasoning_effort offered and thinking/output_config withheld for GPT-5.x on Converse.
This commit is contained in:
parent
9cc276a96e
commit
418012aac5
3 changed files with 13 additions and 8 deletions
|
|
@ -426,8 +426,8 @@ class AmazonConverseConfig(BaseConfig):
|
|||
if "gpt-oss" in model:
|
||||
optional_params["reasoning_effort"] = reasoning_effort
|
||||
elif "openai.gpt-5" in model:
|
||||
optional_params.pop("thinking", None)
|
||||
optional_params["reasoning"] = {"effort": reasoning_effort}
|
||||
reasoning: Final[BedrockConverseGptReasoningEffortBlock] = {"effort": reasoning_effort}
|
||||
optional_params["reasoning"] = reasoning
|
||||
elif self._is_nova_2_model(model):
|
||||
reasoning_config: Final = self._transform_reasoning_effort_to_reasoning_config(reasoning_effort)
|
||||
optional_params.update(reasoning_config)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from collections.abc import Sequence
|
|||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, Any, Final, Literal
|
||||
|
||||
from typing_extensions import Required, TypedDict, override
|
||||
from typing_extensions import ReadOnly, Required, TypedDict, override
|
||||
|
||||
from .openai import ChatCompletionToolCallChunk
|
||||
|
||||
|
|
@ -97,6 +97,10 @@ class BedrockConverseReasoningContentBlockDelta(TypedDict, total=False):
|
|||
text: str
|
||||
|
||||
|
||||
class BedrockConverseGptReasoningEffortBlock(TypedDict):
|
||||
effort: ReadOnly[str]
|
||||
|
||||
|
||||
class GuardrailConverseTextBlock(TypedDict, total=False):
|
||||
text: str
|
||||
|
||||
|
|
|
|||
|
|
@ -293,15 +293,16 @@ def test_bedrock_gpt_5_6_advertises_only_converse_supported_features(
|
|||
|
||||
|
||||
@pytest.mark.parametrize("profile", GPT_5_6_PROFILES, ids=lambda p: p.model_id)
|
||||
def test_bedrock_gpt_5_6_offers_tools_but_not_reasoning(profile, local_model_cost_map):
|
||||
"""Converse rejects the Anthropic-shaped thinking block LiteLLM emits for
|
||||
reasoning_effort, so neither reasoning param may be offered yet, while the tool
|
||||
params these models do accept must be."""
|
||||
def test_bedrock_gpt_5_6_offers_tools_and_reasoning_effort_but_not_thinking(profile, local_model_cost_map):
|
||||
"""GPT-5.x on Converse maps reasoning_effort to reasoning.effort, so reasoning_effort
|
||||
is offered while the Anthropic-only thinking/output_config are not, alongside the tool
|
||||
params these models accept."""
|
||||
supported = AmazonConverseConfig().get_supported_openai_params(
|
||||
model=f"bedrock/{profile.model_id}"
|
||||
)
|
||||
|
||||
assert "tools" in supported
|
||||
assert "tool_choice" in supported
|
||||
assert "reasoning_effort" not in supported
|
||||
assert "reasoning_effort" in supported
|
||||
assert "thinking" not in supported
|
||||
assert "output_config" not in supported
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue