fix: add missing limit, threshold, infer, memory_type, and prompt params to REST API#4496
Merged
kartik-mem0 merged 1 commit intomainfrom Mar 23, 2026
Merged
Conversation
…ams to REST API models The Pydantic request models in server/main.py silently dropped parameters that the underlying Memory class supports, due to Pydantic v2's default extra='ignore' behavior. This adds the missing fields so they are correctly forwarded to Memory.search() and Memory.add(). Fixes #3976 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kartik-mem0
approved these changes
Mar 23, 2026
This was referenced Mar 23, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
…ams to REST API (mem0ai#4496) Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Description
The self-hosted REST API server (
server/main.py) silently drops several parameters that the underlyingMemoryclass supports. The Pydantic request models don't declare these fields, so they are silently ignored by Pydantic v2's default behavior (extra='ignore').This PR adds the missing fields to the Pydantic models:
SearchRequest: addedlimit(int) andthreshold(float)MemoryCreate: addedinfer(bool),memory_type(str), andprompt(str)All fields are
OptionalwithNonedefaults andFielddescriptions for OpenAPI docs. No handler changes needed — the existingmodel_dump()+**paramspattern automatically forwards these toMemory.search()andMemory.add().limitin searchthresholdin searchinferin addfalsememory_typein addpromptin addFixes #3976
Type of change
How Has This Been Tested?
39 new tests in
tests/test_server_params.pycovering:Memorymethod with the correct valueMemoryuse its own defaultsinfer=Falseandthreshold=0.0are not incorrectly filtered out by thev is not Nonechecknullfor optional fields correctly omits themfilters,metadata,user_id, etc.) continue to workMemory.add()/Memory.search()parameter namesAll 113 server tests pass (74 auth + 39 params):
Checklist:
Maintainer Checklist