feat: Add reasoning_effort parameter support for OpenAI reasoning models #3654
+338
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for the
reasoning_effortparameter for OpenAI's reasoning models (o1, o3, and gpt-5 series). This parameter allows users to control the trade-off between reasoning depth and response speed.What is
reasoning_effort?The
reasoning_effortparameter controls how much computational effort the model puts into reasoning before generating a response. It accepts three values:"low"- Faster responses with less reasoning"medium"- Balanced approach (default behavior)"high"- More thorough reasoning, slower responsesThis parameter is only applicable to OpenAI's reasoning models: o1, o1-preview, o1-mini, o3, o3-mini, gpt-5, gpt-5o, gpt-5o-mini, and gpt-5o-micro.
Changes Made
reasoning_effortparameter toBaseLlmConfigclass with type safety (Literal["low", "medium", "high"])OpenAIConfigAzureOpenAIConfigAnthropicConfigOllamaConfigDeepSeekConfigLMStudioConfigVllmConfigAWSBedrockConfig_validate_config()to ensure only valid values are accepted_get_supported_params()to only pass the parameter to reasoning modelsreasoning_effortis set for non-reasoning modelsdocs/components/llms/config.mdx- Updated parameter tabledocs/components/llms/models/openai.mdx- Added usage exampledocs/components/llms/models/azure_openai.mdx- Added usage exampleUsage Example
OpenAI
Azure OpenAI
Testing
To run the new tests:
Checklist
reasoning_effortparameter to all config classesRelated Issues
Fixes #3651