-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix: Respect reasoning_effort config for GPT-5 models #2131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix: Respect reasoning_effort config for GPT-5 models #2131
Conversation
Previously, GPT-5 models had reasoning_effort hardcoded to 'minimal', which caused two issues: 1. 'minimal' is not supported by some models (e.g., gpt-5.1-codex) 2. User's config.reasoning_effort setting was completely ignored This fix: - Reads and respects user's reasoning_effort config value - Uses valid defaults: 'none' for non-thinking models, 'low' for thinking - Adds logging to show which value is being used Fixes qodo-ai#2120
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
- Store validation result in variable to avoid redundant checks - Add warning log when invalid reasoning_effort value is configured - Improve source tracking in info log - Makes code more maintainable and easier to debug
|
Code review suggestions addressed: ✅ Suggestion 1 (Refactor logic): Implemented in commit 956f366
❌ Suggestion 2 (getattr defensive coding): Not implementing
All relevant suggestions have been addressed. |
User description
Fixes #2120
Problem
GPT-5 models were hardcoded to use
reasoning_effort='minimal', ignoring the user'sconfig.reasoning_effortsetting.Solution
Modified
litellm_ai_handler.pyto:reasoning_effortfrom configuration instead of hardcodingTesting
Verified with GPT-5 model that:
reasoning_effort = "medium"is now respectedPR Type
Bug fix
Description
Respect user's
reasoning_effortconfig setting for GPT-5 modelsReplace hardcoded 'minimal'/'low' values with configurable defaults
Support reasoning effort values: 'none', 'low', 'medium', 'high'
Add logging to show which reasoning effort level is being used
Diagram Walkthrough
flowchart LR A["GPT-5 Model Request"] --> B{"Model Type?"} B -->|"Thinking Model"| C["Use config or default 'low'"] B -->|"Non-thinking Model"| D["Use config or default 'none'"] C --> E["Set reasoning_effort parameter"] D --> E E --> F["Log effort level used"]File Walkthrough
litellm_ai_handler.py
Make GPT-5 reasoning_effort configurable with smart defaultspr_agent/algo/ai_handlers/litellm_ai_handler.py
reasoning_effortfromconfiginstead of hardcoding valuesmodels