v2.0.16
Mem0 Python SDK (v2.0.16)
Added 1
- Add `reference_date`, `latest_only`, and `keyword_search` to `SearchMemoryOptions`, and `latest_only` to `GetAllMemoryOptions` in the Python client
Fixed 11
- Stop `add()` metadata from setting a memory's identity scope by stripping `user_id`, `agent_id`, `run_id`, and `actor_id` from caller-supplied metadata before building the creation template
- Validate Upstash filter keys and values in `search()`, `keyword_search()`, and `list()` to reject unsafe keys and unescaped string values
- `FastEmbedEmbedding.embed()` now converts its result with `.tolist()` before returning to provide a plain `List[float]` instead of a numpy array
- `HuggingFaceEmbedding` now passes `api_key` to the OpenAI-compatible client when `huggingface_base_url` is set
- Replace Ollama's interactive `pip install` prompt on import with a plain `ImportError`
- `remove_code_blocks()` now returns an empty string for `None` input instead of raising `AttributeError`
- `parse_vision_messages()` now chains the original exception when an image download fails to preserve the root cause in the traceback
- `process_telemetry_filters(None)` now returns `([], {})` instead of `{}` to match the two-value tuple every caller unpacks
- `LlmFactory.create()` no longer mutates the caller's config dict in place and instead builds a new dict for the merge
- The Cohere, HuggingFace, SentenceTransformer, and Zero Entropy rerankers' failure-fallback path no longer mutates the caller's document dicts in place when stamping `rerank_score`
- Remove `logging.basicConfig()` calls from the MongoDB and Vertex AI Vector Search providers so selecting either provider no longer reconfigures the host application's root logger
New Features:
- Client: Add
reference_date,latest_only, andkeyword_searchtoSearchMemoryOptions, andlatest_onlytoGetAllMemoryOptions, keeping the Python client's typed options in sync with the Platform API and the CLIs (#6696)
Bug Fixes:
- Core: Stop
add()metadata from setting a memory's identity scope._build_filters_and_metadata()now stripsuser_id,agent_id,run_id, andactor_idfrom caller-suppliedmetadatabefore building the creation template, so metadata can no longer place a memory into a scope that was never passed through the entity params (#6656) - Vector Stores: Validate Upstash filter keys and values in
search(),keyword_search(), andlist(). Filter keys must match a safe identifier pattern, values must bestr/int/float/bool, and string values containing a double quote or backslash are now rejected instead of being interpolated unescaped into the generated query string (#5981) - Embeddings:
FastEmbedEmbedding.embed()now converts its result with.tolist()before returning, so callers get a plainList[float]instead of a numpy array (#6770) - Embeddings:
HuggingFaceEmbeddingnow passesapi_keyto the OpenAI-compatible client whenhuggingface_base_urlis set. The configured key was previously dropped, so the client fell back toOPENAI_API_KEYfrom the environment or raisedOpenAIErrorat construction when that was unset (#6770) - Embeddings: Replace Ollama's interactive
pip installprompt on import with a plainImportError. Importingmem0.embeddings.ollamawithout theollamapackage previously blocked on stdin and then calledsys.exit(1), killing the host process instead of raising (#6770) - Core:
remove_code_blocks()now returns an empty string forNoneinput instead of raisingAttributeError(#6770) - Core:
parse_vision_messages()now chains the original exception (raise ... from e) when an image download fails, so the root cause is preserved in the traceback (#6770) - Core:
process_telemetry_filters(None)now returns([], {}), matching the two-value tuple every caller unpacks, instead of{}(#6770) - Core:
LlmFactory.create()no longer mutates the caller's config dict in place via.update(kwargs); the merge now builds a new dict (#6770) - Rerankers: The Cohere, HuggingFace, SentenceTransformer, and Zero Entropy rerankers' failure-fallback path no longer mutates the caller's document dicts in place when stamping
rerank_score; it now falls back on copies (#6770) - Vector Stores: Remove
logging.basicConfig()calls from the MongoDB and Vertex AI Vector Search providers, so selecting either provider no longer reconfigures the host application's root logger as a side effect (#6770)