Safe Mem0 Search • AI Agent SDK

safe_mem0_search: Defensive wrapper for mem0.search() to handle MongoDB vector store compatibility.

safe_mem0_search

Function

</div>

This function is defined in the factories module.

Defensive wrapper for mem0.search() to handle MongoDB vector store compatibility.

Catches the specific TypeError about an unexpected ‘vectors’ kwarg and falls back gracefully by returning an empty result set. This addresses the upstream mem0 bug: https://github.com/mem0ai/mem0/issues/3185

Any other TypeError is re-raised unchanged.

Signature

python
def safe_mem0_search(mem0_client: Any) -> List[Dict[str, Any]]

Parameters

ParamField Any

No description available.

Returns

ResponseField List[Dict[str, Any]]

The result of the operation.

Uses

  • mem0_client.search
  • logger.warning

Used By

Source

View on GitHub

praisonaiagents/memory/adapters/factories.py at line 40