Skip to content

Conversation

@Chesars
Copy link
Contributor

@Chesars Chesars commented Dec 3, 2025

Summary

Previously, only reasoning.effort was extracted from ModelSettings.reasoning, causing reasoning.summary to be discarded. This prevented users from receiving reasoning summaries when using GPT models through LiteLLM.

The fix builds a dict with both effort and summary fields ({"effort": "medium", "summary": "auto"}) which LiteLLM supports since ~v1.78.

Changes:

  • When only reasoning.effort is set → pass as string "medium" (compatible with all providers)
  • When reasoning.summary is also set → pass as dict {"effort": "medium", "summary": "auto"} (OpenAI only)

Before:

reasoning_effort = model_settings.reasoning.effort  # loses summary

After:

reasoning_effort = {"effort": "medium", "summary": "auto"}  # preserves both

Test plan

  • Updated existing test test_reasoning_effort_prefers_model_settings to expect dict format
  • Added new test test_reasoning_summary_is_preserved to verify both fields are passed
  • Backward compatible with Anthropic and other providers
  • All 25 model tests pass

Issue

Fixes BerriAI/litellm#17428

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Chesars and others added 2 commits December 3, 2025 16:17
Previously, only `reasoning.effort` was extracted from ModelSettings,
causing `reasoning.summary` to be silently discarded. This prevented
users from receiving reasoning summaries when using GPT models through
LiteLLM.

Now we build a dict with both `effort` and `summary` fields:
`{"effort": "medium", "summary": "auto"}` which LiteLLM supports
since ~v1.78.

Fixes: BerriAI/litellm#17428
@danialkhan02
Copy link

danialkhan02 commented Dec 3, 2025

This was a good catch, this fixes GPT 5.1. But it breaks Anthropic, since they only expect a string. You will likely need to make this an edge case only for the openai provider.

@Chesars Chesars marked this pull request as draft December 3, 2025 22:27
@Chesars Chesars marked this pull request as ready for review December 3, 2025 22:30
Only pass reasoning_effort as dict when summary is explicitly set.
When only effort is provided, pass it as a string for backward
compatibility with all providers (including Anthropic).

- Dict format: {"effort": "medium", "summary": "auto"} - OpenAI only
- String format: "medium" - all providers
@Chesars
Copy link
Contributor Author

Chesars commented Dec 3, 2025

This was a good catch, this fixes GPT 5.1. But it breaks Anthropic, since they only expect a string. You will likely need to make this an edge case only for the openai provider.

Good catch! Fixed - now we only use dict format when summary (OpenAI only) is explicitly set. If only effort is provided, we pass it as a string for backward compatibility with all providers.

@seratch seratch added this to the 0.6.x milestone Dec 4, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@seratch seratch merged commit d258d8d into openai:main Dec 4, 2025
9 checks passed
@Chesars
Copy link
Contributor Author

Chesars commented Dec 4, 2025

Thank you!

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Reasoning summaries not returned when using GPT models through LiteLLM (Agents SDK compatibility issue)

3 participants