Skip to main content

search

Method
This is a method of the Memory class in the memory module.
Generic search method that delegates to appropriate specific search methods. Provides compatibility with mem0.Memory interface.

Signature

def search(query: str, user_id: Optional[str], agent_id: Optional[str], run_id: Optional[str], limit: int, rerank: bool) -> List[Dict[str, Any]]

Parameters

query
str
required
The search query string
user_id
Optional
Optional user ID for user-specific search
agent_id
Optional
Optional agent ID for agent-specific search
run_id
Optional
Optional run ID for run-specific search
limit
int
default:"5"
Maximum number of results to return
rerank
bool
default:"False"
Whether to use advanced reranking **kwargs: Additional search parameters

Returns

Returns
List[Dict[str, Any]]
List of search results