Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions litellm/llms/bedrock/chat/converse_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,18 @@ def _handle_reasoning_effort_parameter(self, model: str, reasoning_effort: str,
Handle the reasoning_effort parameter based on the model type.

- GPT-OSS models: passed through unchanged via additionalModelRequestFields.
- OpenAI GPT-5.x models: mapped to ``reasoning.effort`` via additionalModelRequestFields.
- Nova 2 models: transformed to reasoningConfig.
- Anthropic models: mapped to ``thinking`` (and ``output_config.effort`` on
adaptive Claude 4.6 / 4.7).
"""
if "gpt-oss" in model:
optional_params["reasoning_effort"] = reasoning_effort
elif "openai.gpt-5" in model:
Comment thread
6matt marked this conversation as resolved.
Resolved
# Converse rejects Anthropic's `thinking` for OpenAI GPT-5.x; effort goes
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
# under additionalModelRequestFields as {"reasoning": {"effort": ...}}.
optional_params.pop("thinking", None)
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
optional_params["reasoning"] = {"effort": reasoning_effort}
elif self._is_nova_2_model(model):
reasoning_config: Final = self._transform_reasoning_effort_to_reasoning_config(reasoning_effort)
optional_params.update(reasoning_config)
Expand Down
6 changes: 6 additions & 0 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -49473,6 +49473,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-sol": {
Expand All @@ -49498,6 +49499,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"us.openai.gpt-5.6-terra": {
Expand All @@ -49523,6 +49525,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-terra": {
Expand All @@ -49548,6 +49551,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"us.openai.gpt-5.6-luna": {
Expand All @@ -49573,6 +49577,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-luna": {
Expand All @@ -49598,6 +49603,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"bedrock_mantle/openai.gpt-5.5": {
Expand Down
6 changes: 6 additions & 0 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -49473,6 +49473,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-sol": {
Expand All @@ -49498,6 +49499,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"us.openai.gpt-5.6-terra": {
Expand All @@ -49523,6 +49525,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-terra": {
Expand All @@ -49548,6 +49551,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"us.openai.gpt-5.6-luna": {
Expand All @@ -49573,6 +49577,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"global.openai.gpt-5.6-luna": {
Expand All @@ -49598,6 +49603,7 @@
],
"supports_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_vision": true
},
"bedrock_mantle/openai.gpt-5.5": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,37 @@ def test_reasoning_with_forced_tool_choice_switches_to_auto():
assert optional_params["tool_choice"] == {"auto": {}}


@pytest.mark.parametrize(
"model",
[
"us.openai.gpt-5.6-sol",
"global.openai.gpt-5.6-terra",
"bedrock/converse/us.openai.gpt-5.6-luna",
],
)
def test_reasoning_effort_maps_to_reasoning_effort_for_openai_gpt5_converse(model, local_model_cost_map):
"""OpenAI GPT-5.x on Bedrock Converse routes reasoning_effort to
``additionalModelRequestFields.reasoning.effort`` rather than Anthropic ``thinking``."""
config = AmazonConverseConfig()

assert "reasoning_effort" in config.get_supported_openai_params(model=model)

optional_params = config.map_openai_params(
non_default_params={"reasoning_effort": "high"},
optional_params={},
model=model,
drop_params=False,
)

assert optional_params["reasoning"] == {"effort": "high"}
assert "thinking" not in optional_params
assert "reasoning_effort" not in optional_params

_, additional_request_params, _, _ = config._prepare_request_params(optional_params, model)
assert additional_request_params["reasoning"] == {"effort": "high"}
assert "thinking" not in additional_request_params


@pytest.mark.parametrize(
"model",
[
Expand Down
Loading