Mem0 1.0.0 (#3545)

This commit is contained in:
Parshva Daftari
2025-10-16 15:50:20 +05:30
committed by GitHub
parent 8f5151c344
commit 394203d1b5
77 changed files with 3445 additions and 990 deletions
@@ -1,17 +1,17 @@
---
title: Enhanced Metadata Filtering
description: 'Advanced filtering capabilities for precise memory retrieval in Mem0 1.0.0 Beta'
description: 'Advanced filtering capabilities for precise memory retrieval in Mem0 1.0.0 '
icon: "filter"
iconType: "solid"
---
<Info>
Enhanced metadata filtering is available in **Mem0 1.0.0 Beta** and later versions. This feature provides powerful filtering capabilities with logical operators and comparison functions.
Enhanced metadata filtering is available in **Mem0 1.0.0 ** and later versions. This feature provides powerful filtering capabilities with logical operators and comparison functions.
</Info>
## Overview
Mem0 1.0.0 Beta introduces enhanced metadata filtering that allows you to perform complex queries on your memory metadata. You can now use logical operators, comparison functions, and advanced filtering patterns to retrieve exactly the memories you need.
Mem0 1.0.0 introduces enhanced metadata filtering that allows you to perform complex queries on your memory metadata. You can now use logical operators, comparison functions, and advanced filtering patterns to retrieve exactly the memories you need.
## Basic Filtering
@@ -204,7 +204,7 @@ results = m.search(
user_id="project_manager",
filters={
"AND": [
{"project": {"in": ["alpha", "beta"]}},
{"project": {"in": ["alpha", ""]}},
{"priority": {"gte": 8}},
{"status": {"ne": "completed"}},
{
@@ -315,12 +315,12 @@ Different vector stores support different filtering capabilities:
### Chroma
-  Basic operators (eq, ne, gt, lt, gte, lte)
-  Simple logical operations
-   Limited nested operations
-  Limited nested operations
### Pinecone
-  Good support for comparison operators
-  In/nin operations
-   Limited text operations
-  Limited text operations
### Weaviate
-  Full operator support
@@ -360,7 +360,7 @@ results = m.search(
)
```
### After (v1.0.0 Beta)
### After (v1.0.0 )
```python
# Enhanced filtering with operators
results = m.search(
+1
View File
@@ -26,6 +26,7 @@ Mem0 open-source provides a powerful, flexible foundation for AI memory manageme
### Memory Management
- **Synchronous & Asynchronous Operations**: Choose between sync and async memory operations based on your application needs
- **Smart Memory Retrieval**: Intelligent search and retrieval with semantic understanding
- **Advanced Reranking**: Improve search relevance with Zero Entropy, LLM-based, or custom reranking models
- **Memory Persistence**: Long-term storage with automatic optimization and cleanup
### Advanced Organization
@@ -1,12 +1,12 @@
---
title: Reranker-Enhanced Search
description: 'Improve search relevance with reranking models in Mem0 1.0.0 Beta'
description: 'Improve search relevance with reranking models in Mem0 1.0.0 '
icon: "sort"
iconType: "solid"
---
<Info>
Reranker-enhanced search is available in **Mem0 1.0.0 Beta** and later versions. This feature significantly improves search relevance by using specialized reranking models to reorder search results.
Reranker-enhanced search is available in **Mem0 1.0.0 ** and later versions. This feature significantly improves search relevance by using specialized reranking models to reorder search results.
</Info>
## Overview
@@ -385,7 +385,7 @@ results = m.search(
results = m.search("query", user_id="alice")
```
### To v1.0.0 Beta (With Reranking)
### To v1.0.0 (With Reranking)
```python
# Add reranker configuration
+130
View File
@@ -0,0 +1,130 @@
---
title: Reranking
description: 'Improve memory search relevance with advanced reranking capabilities'
icon: "arrow-up-arrow-down"
iconType: "solid"
---
## Overview
Reranking is an advanced feature that improves the relevance of memory search results by re-ordering them based on more sophisticated relevance scoring. After initial vector similarity search, rerankers use specialized models to provide more accurate relevance scores.
<Note>
Reranking operates as a post-processing step after the initial vector search. It takes the top results from vector similarity search and re-scores them using more advanced models or custom logic.
</Note>
## How It Works
1. **Vector Search**: Initial semantic similarity search retrieves candidate memories
2. **Reranking**: Selected reranker re-scores candidates using advanced models
3. **Final Results**: Re-ordered results with both vector and rerank scores
## Quick Start
Enable reranking by adding a `rerank` section to your memory configuration:
```python Python
from mem0 import Memory
config = {
"vector_store": {
"provider": "chroma",
"config": {
"collection_name": "my_memories",
"path": "./chroma_db"
}
},
"llm": {
"provider": "openai",
"config": {
"model": "gpt-4o-mini"
}
},
"rerank": {
"provider": "zero_entropy",
"config": {
"model": "zerank-1",
"top_k": 5
}
}
}
memory = Memory.from_config(config)
# Add memories
messages = [
{"role": "user", "content": "I love Italian pasta, especially carbonara"},
{"role": "assistant", "content": "Carbonara is a classic Roman dish!"}
]
memory.add(messages, user_id="alice")
# Search with reranking - results automatically include rerank scores
results = memory.search("What Italian dishes does the user like?", user_id="alice")
for result in results['results']:
print(f"Memory: {result['memory']}")
print(f"Vector Score: {result['score']:.3f}")
print(f"Rerank Score: {result['rerank_score']:.3f}")
```
## Supported Providers
Mem0 supports multiple reranking providers:
- **[Zero Entropy](../../components/rerankers/models/zero_entropy)**: State-of-the-art neural reranking
- **[Cohere](../../components/rerankers/models/cohere)**: Enterprise-grade with multilingual support
- **[Sentence Transformer](../../components/rerankers/models/sentence_transformer)**: Local HuggingFace models
- **[LLM-based](../../components/rerankers/models/llm)**: Custom scoring using any LLM
## When to Use Reranking
Reranking is particularly effective for:
- **Improved Relevance**: When vector search alone doesn't provide sufficiently relevant results
- **Domain-Specific Queries**: Specialized terminology or context that benefits from advanced models
- **Customer Support**: Finding the most relevant help articles and documentation
- **Knowledge Management**: Better search results in internal knowledge bases
- **Personal AI Assistants**: More accurate memory recall for user queries
## Configuration Options
Each reranker has specific configuration options. See the [Rerankers Documentation](../../components/rerankers/overview) for detailed configuration parameters.
### Basic Configuration
```python Python
"rerank": {
"provider": "zero_entropy", # or "cohere", "sentence_transformer", "llm"
"config": {
"top_k": 5, # Limit results after reranking
"api_key": "your-key" # Provider-specific API key
}
}
```
### Controlling Reranking
You can enable or disable reranking per search:
```python Python
# Search with reranking (default when configured)
results = memory.search("query", user_id="alice", rerank=True)
# Search without reranking
results = memory.search("query", user_id="alice", rerank=False)
```
## Performance Considerations
- **Latency**: Reranking adds processing time but significantly improves relevance
- **Cost**: API-based rerankers (Zero Entropy, Cohere, LLM) have per-request costs
- **Local Options**: Sentence Transformer reranker runs locally with no API costs
- **Quality vs Speed**: Balance based on your application's requirements
## Next Steps
- Explore specific [reranker providers](../../components/rerankers/overview) and their capabilities
- Learn about [configuration options](../../components/rerankers/config) for fine-tuning
- Check out [Vector Stores](../../components/vectordbs/overview) for different storage backends
- See [Async Memory](./async-memory) for non-blocking reranking operations