feat: add reasoning_effort parameter support for reasoning models#4461
Merged
kartik-mem0 merged 1 commit intomem0ai:mainfrom Mar 27, 2026
Merged
Conversation
Add `reasoning_effort` parameter ("low", "medium", "high") to
BaseLlmConfig, OpenAIConfig, and AzureOpenAIConfig. When set and
using a reasoning model (o1, o3, gpt-5 series), the parameter is
passed through to the API call via `_get_supported_params`.
This fixes the TypeError raised when passing `reasoning_effort`
in the llm.config section (e.g., via Memory.from_config).
Fixes mem0ai#3651
kartik-mem0
approved these changes
Mar 27, 2026
This was referenced Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
reasoning_effortparameter ("low","medium","high") toBaseLlmConfig,OpenAIConfig, andAzureOpenAIConfigreasoning_effortthrough to the API for reasoning models (o1, o3, gpt-5 series) via_get_supported_paramsinLLMBasereasoning_effortwhen convertingBaseLlmConfigto provider-specific configs inOpenAILLMandAzureOpenAILLMFixes #3651
Changes
mem0/configs/llms/base.pyreasoning_effortparam toBaseLlmConfig.__init__mem0/configs/llms/openai.pyreasoning_effortparam toOpenAIConfig.__init__, pass to supermem0/configs/llms/azure.pyreasoning_effortparam toAzureOpenAIConfig.__init__, pass to supermem0/llms/base.pyreasoning_effortin_get_supported_paramsfor reasoning modelsmem0/llms/openai.pyreasoning_effortinBaseLlmConfig->OpenAIConfigconversionmem0/llms/azure_openai.pyreasoning_effortinBaseLlmConfig->AzureOpenAIConfigconversiontests/llms/test_openai.pytests/llms/test_azure_openai.pyTest plan
reasoning_effortis sent to API when configured on reasoning modelsreasoning_effortis NOT sent when not configured (None)reasoning_effortis NOT sent for non-reasoning modelsAzureOpenAIConfigno longer raisesTypeErrorwithreasoning_effortkwarg