Added improved docs index and overview pages and quickstart (#3603)

This commit is contained in:
Parth Sharma
2025-10-22 10:30:45 -07:00
committed by GitHub
parent ec1a60bf8d
commit f7d7c53001
65 changed files with 2182 additions and 2299 deletions
+147
View File
@@ -0,0 +1,147 @@
---
title: FAQs
icon: "question"
iconType: "solid"
---
<AccordionGroup>
<Accordion title="How does Mem0 work?">
Mem0 utilizes a sophisticated hybrid database system to efficiently manage and retrieve memories for AI agents and assistants. Each memory is linked to a unique identifier, such as a user ID or agent ID, enabling Mem0 to organize and access memories tailored to specific individuals or contexts.
When a message is added to Mem0 via the `add` method, the system extracts pertinent facts and preferences, distributing them across various data stores: a vector database and a graph database. This hybrid strategy ensures that diverse types of information are stored optimally, facilitating swift and effective searches.
When an AI agent or LLM needs to access memories, it employs the `search` method. Mem0 conducts a comprehensive search across these data stores, retrieving relevant information from each.
The retrieved memories can be seamlessly integrated into the system prompt as required, enhancing the personalization and relevance of responses.
</Accordion>
<Accordion title="What are the key features of Mem0?">
- **User, Session, and AI Agent Memory**: Retains information across sessions and interactions for users and AI agents, ensuring continuity and context.
- **Adaptive Personalization**: Continuously updates memories based on user interactions and feedback.
- **Developer-Friendly API**: Offers a straightforward API for seamless integration into various applications.
- **Platform Consistency**: Ensures consistent behavior and data across different platforms and devices.
- **Managed Service**: Provides a hosted solution for easy deployment and maintenance.
- **Cost Savings**: Saves costs by adding relevant memories instead of complete transcripts to context window
</Accordion>
<Accordion title="How is Mem0 different from traditional RAG?">
Mem0's memory implementation for Large Language Models (LLMs) offers several advantages over Retrieval-Augmented Generation (RAG):
- **Entity Relationships**: Mem0 can understand and relate entities across different interactions, unlike RAG which retrieves information from static documents. This leads to a deeper understanding of context and relationships.
- **Contextual Continuity**: Mem0 retains information across sessions, maintaining continuity in conversations and interactions, which is essential for long-term engagement applications like virtual companions or personalized learning assistants.
- **Adaptive Learning**: Mem0 improves its personalization based on user interactions and feedback, making the memory more accurate and tailored to individual users over time.
- **Dynamic Updates**: Mem0 can dynamically update its memory with new information and interactions, unlike RAG which relies on static data. This allows for real-time adjustments and improvements, enhancing the user experience.
These advanced memory capabilities make Mem0 a powerful tool for developers aiming to create personalized and context-aware AI applications.
</Accordion>
<Accordion title="What are the common use-cases of Mem0?">
- **Personalized Learning Assistants**: Long-term memory allows learning assistants to remember user preferences, strengths and weaknesses, and progress, providing a more tailored and effective learning experience.
- **Customer Support AI Agents**: By retaining information from previous interactions, customer support bots can offer more accurate and context-aware assistance, improving customer satisfaction and reducing resolution times.
- **Healthcare Assistants**: Long-term memory enables healthcare assistants to keep track of patient history, medication schedules, and treatment plans, ensuring personalized and consistent care.
- **Virtual Companions**: Virtual companions can use long-term memory to build deeper relationships with users by remembering personal details, preferences, and past conversations, making interactions more delightful.
- **Productivity Tools**: Long-term memory helps productivity tools remember user habits, frequently used documents, and task history, streamlining workflows and enhancing efficiency.
- **Gaming AI**: In gaming, AI with long-term memory can create more immersive experiences by remembering player choices, strategies, and progress, adapting the game environment accordingly.
</Accordion>
<Accordion title="Why aren't my memories being created?">
Mem0 uses a sophisticated classification system to determine which parts of text should be extracted as memories. Not all text content will generate memories, as the system is designed to identify specific types of memorable information.
There are several scenarios where mem0 may return an empty list of memories:
- When users input definitional questions (e.g., "What is backpropagation?")
- For general concept explanations that don't contain personal or experiential information
- Technical definitions and theoretical explanations
- General knowledge statements without personal context
- Abstract or theoretical content
Example Scenarios
```
Input: "What is machine learning?"
No memories extracted - Content is definitional and does not meet memory classification criteria.
Input: "Yesterday I learned about machine learning in class"
Memory extracted - Contains personal experience and temporal context.
```
Best Practices
To ensure successful memory extraction:
- Include temporal markers (when events occurred)
- Add personal context or experiences
- Frame information in terms of real-world applications or experiences
- Include specific examples or cases rather than general definitions
</Accordion>
<Accordion title="How do I configure Mem0 for AWS Lambda?">
When deploying Mem0 on AWS Lambda, you'll need to modify the storage directory configuration due to Lambda's file system restrictions. By default, Lambda only allows writing to the `/tmp` directory.
To configure Mem0 for AWS Lambda, set the `MEM0_DIR` environment variable to point to a writable directory in `/tmp`:
```bash
MEM0_DIR=/tmp/.mem0
```
If you're not using environment variables, you'll need to modify the storage path in your code:
```python
# Change from
home_dir = os.path.expanduser("~")
mem0_dir = os.environ.get("MEM0_DIR") or os.path.join(home_dir, ".mem0")
# To
mem0_dir = os.environ.get("MEM0_DIR", "/tmp/.mem0")
```
Note that the `/tmp` directory in Lambda has a size limit of 512MB and its contents are not persistent between function invocations.
</Accordion>
<Accordion title="How can I use metadata with Mem0?">
Metadata is the recommended approach for incorporating additional information with Mem0. You can store any type of structured data as metadata during the `add` method, such as location, timestamp, weather conditions, user state, or application context. This enriches your memories with valuable contextual information that can be used for more precise retrieval and filtering.
During retrieval, you have two main approaches for using metadata:
1. **Pre-filtering**: Include metadata parameters in your initial search query to narrow down the memory pool
2. **Post-processing**: Retrieve a broader set of memories based on query, then apply metadata filters to refine the results
Examples of useful metadata you might store:
- **Contextual information**: Location, time, device type, application state
- **User attributes**: Preferences, skill levels, demographic information
- **Interaction details**: Conversation topics, sentiment, urgency levels
- **Custom tags**: Any domain-specific categorization relevant to your application
This flexibility allows you to create highly contextually aware AI applications that can adapt to specific user needs and situations. Metadata provides an additional dimension for memory retrieval, enabling more precise and relevant responses.
</Accordion>
<Accordion title="How do I disable telemetry in Mem0?">
To disable telemetry in Mem0, you can set the `MEM0_TELEMETRY` environment variable to `False`:
```bash
MEM0_TELEMETRY=False
```
You can also disable telemetry programmatically in your code:
```python
import os
os.environ["MEM0_TELEMETRY"] = "False"
```
Setting this environment variable will prevent Mem0 from collecting and sending any usage data, ensuring complete privacy for your application.
</Accordion>
</AccordionGroup>
@@ -1,7 +1,5 @@
---
title: Advanced Retrieval
icon: "magnifying-glass"
iconType: "solid"
description: "Advanced memory search with keyword expansion, intelligent reranking, and precision filtering"
---
-2
View File
@@ -1,8 +1,6 @@
---
title: Async Client
description: 'Asynchronous client for Mem0'
icon: "bolt"
iconType: "solid"
---
The `AsyncMemoryClient` is an asynchronous client for interacting with the Mem0 API. It provides similar functionality to the synchronous `MemoryClient` but allows for non-blocking operations, which can be beneficial in applications that require high concurrency.
@@ -1,8 +1,6 @@
---
title: Async Mode Default Change
description: 'Important update to Memory Addition API behavior'
icon: "clock-rotate-left"
iconType: "solid"
---
<Note type="warning">
@@ -1,7 +1,5 @@
---
title: Contextual Memory Creation
icon: "square-plus"
iconType: "solid"
description: "Add messages with automatic context management - no manual history tracking required"
---
@@ -1,7 +1,5 @@
---
title: Criteria Retrieval
icon: "magnifying-glass-plus"
iconType: "solid"
---
Mem0's Criteria Retrieval feature allows you to retrieve memories based on your defined criteria. It goes beyond generic semantic relevance and ranks memories based on what matters to your application: emotional tone, intent, behavioral signals, or other custom traits.
@@ -1,8 +1,6 @@
---
title: Custom Categories
description: 'Enhance your product experience by adding custom categories tailored to your needs'
icon: "tags"
iconType: "solid"
---
## How to Set Custom Categories
@@ -1,8 +1,6 @@
---
title: Custom Instructions
description: 'Control how Mem0 extracts and stores memories using natural language guidelines'
icon: "pencil"
iconType: "solid"
---
## What are Custom Instructions?
-2
View File
@@ -1,8 +1,6 @@
---
title: Direct Import
description: 'Bypass the memory deduction phase and directly store pre-defined memories for efficient retrieval'
icon: "arrow-right"
iconType: "solid"
---
## How to Use Direct Import
@@ -1,8 +1,6 @@
---
title: Expiration Date
description: 'Set time-bound memories in Mem0 with automatic expiration dates to manage temporal information effectively.'
icon: "clock"
iconType: "solid"
---
## Benefits of Memory Expiration
@@ -1,7 +1,5 @@
---
title: Feedback Mechanism
icon: "thumbs-up"
iconType: "solid"
---
Mem0's Feedback Mechanism allows you to provide feedback on the memories generated by your application. This feedback is used to improve the accuracy of the memories and search results.
-2
View File
@@ -1,7 +1,5 @@
---
title: Graph Memory
icon: "circle-nodes"
iconType: "solid"
description: "Enable graph-based memory retrieval for more contextually relevant results"
---
-2
View File
@@ -1,8 +1,6 @@
---
title: Group Chat
description: 'Enable multi-participant conversations with automatic memory attribution to individual speakers'
icon: "users"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
-2
View File
@@ -1,8 +1,6 @@
---
title: Memory Export
description: 'Export memories in a structured format using customizable Pydantic schemas'
icon: "file-export"
iconType: "solid"
---
## Overview
@@ -1,8 +1,6 @@
---
title: Multimodal Support
description: Integrate images and documents into your interactions with Mem0
icon: "image"
iconType: "solid"
---
Mem0 extends its capabilities beyond text by supporting multimodal data, including images and documents. With this feature, users can seamlessly integrate visual and document content into their interactions, allowing Mem0 to extract relevant information from various media types and enrich the memory system.
@@ -1,7 +1,5 @@
---
title: Overview
icon: "info"
iconType: "solid"
---
Learn about the key features and capabilities that make Mem0 a powerful platform for memory management and retrieval.
-2
View File
@@ -1,8 +1,6 @@
---
title: Memory Timestamps
description: 'Add timestamps to your memories to maintain chronological accuracy and historical context'
icon: "clock"
iconType: "solid"
---
## Overview
@@ -1,7 +1,5 @@
---
title: Memory Filters v2
icon: "filter"
iconType: "solid"
description: This guide covers the filtering system for retrieving and searching memories. You can filter by user sessions, agents, applications, content categories, and time ranges.
---
-2
View File
@@ -1,8 +1,6 @@
---
title: Webhooks
description: 'Configure and manage webhooks to receive real-time notifications about memory events'
icon: "webhook"
iconType: "solid"
---
## Overview
+117 -20
View File
@@ -1,32 +1,129 @@
---
title: Overview
description: 'Empower your AI applications with long-term memory and personalization'
icon: "eye"
iconType: "solid"
title: "Overview"
description: "Managed memory layer for AI agents - production-ready in minutes"
icon: "cloud"
---
<Tip>
**Mem0 v1.0.0 is now available** — Introducing rerankers, async by default, Azure support, and more. [View changelog →](/changelog)
</Tip>
## Welcome to Mem0 Platform
The Mem0 Platform is a managed service and the easiest way to add our powerful memory layer to your applications.
**Mem0 Platform is a fully managed memory layer for AI agents.** Add persistent, personalized memory to your AI applications in minutes - no infrastructure setup required.
## What is Mem0?
Mem0 is a memory layer that enables your AI applications to remember user preferences, conversation history, and contextual information across sessions. Instead of treating every interaction as isolated, Mem0 allows your AI to build on previous conversations and adapt to individual users over time.
## What Problem Does It Solve?
Without Mem0, every AI conversation starts from scratch:
- User preferences disappear between sessions
- Previous context is lost and must be re-explained
- Personalization becomes impossible
- AI can't learn or adapt to individual users
With Mem0, your AI remembers:
- Context persists across sessions with sub-50ms latency
- Preferences are automatically recalled
- Responses adapt to each user's history
- No infrastructure setup or vector DB management required
## Where Can I Use Mem0?
Mem0 powers memory for diverse AI applications. Explore real-world implementations:
- **[Customer Support Agents](/examples/customer-support-agent)** - Remember customer history and preferences
- **[AI Tutors](/examples/personal-ai-tutor)** - Track learning progress and adapt lessons
- **[Travel Assistants](/examples/personal-travel-assistant)** - Recall travel preferences and past trips
- **[Content Writing](/examples/memory-guided-content-writing)** - Maintain consistent voice and context
[View all cookbooks →](/examples)
---
## Explore Platform Capabilities
<CardGroup cols={2}>
<Card
title="Platform Quickstart"
icon="rocket"
href="/platform/quickstart"
>
Get your first memory stored in 5 minutes. Step-by-step guide with code examples.
</Card>
<Card
title="Platform vs Open Source"
icon="scale"
href="/platform/platform-vs-oss"
>
Compare managed and self-hosted options. See which fits your needs best.
</Card>
<Card
title="Memory Types"
icon="brain"
href="/core-concepts/memory-types"
>
Understand user memories, agent memories, and session-specific context.
</Card>
<Card
title="Platform Features"
icon="sparkles"
href="/platform/features/platform-overview"
>
Explore graph memory, multimodal support, webhooks, and advanced retrieval.
</Card>
<Card
title="Framework Integrations"
icon="plug"
href="/integrations"
>
Use Mem0 with LangChain, CrewAI, LlamaIndex, and 15+ other frameworks.
</Card>
<Card
title="Dashboard"
icon="chart-line"
href="https://app.mem0.ai"
>
Monitor memory operations, track usage, and manage your AI agents.
</Card>
</CardGroup>
---
## Why Choose Mem0 Platform?
Mem0 Platform offers a powerful, user-centric solution for AI memory management with a few key features:
| Feature | What You Get |
|---------|--------------|
| **Fast Setup** | Add 4 lines of code and you're production-ready. No vector DB setup, no LLM configuration, no DevOps. |
| **Production Scale** | Automatic scaling, high availability, and fully managed infrastructure. Focus on your app, not operations. |
| **Advanced Features** | Graph memory, webhooks, multimodal support, and custom categories - exclusive to Platform. |
| **Enterprise Ready** | SOC 2 Type II certified, GDPR compliant, with dedicated support for production workloads. |
1. **Simplified Development**: Integrate comprehensive memory capabilities with just 4 lines of code. Our API-first approach allows you to focus on building great features while we handle the complexities of memory management.
2. **Scalable Solution**: Whether you're working on a prototype or a production-ready system, Mem0 is designed to grow with your application. Our platform effortlessly scales to meet your evolving needs.
3. **Enhanced Performance**: Experience lightning-fast response times with sub-50ms latency, ensuring smooth and responsive user interactions in your AI applications.
4. **Insightful Dashboard**: Gain valuable insights and maintain full control over your AI's memory through our intuitive dashboard. Easily manage memories and access key user insights.
## Getting Started
Check out our [Platform Guide](/platform/quickstart) to start using Mem0 platform quickly.
---
## Next Steps
- Sign up to the [Mem0 Platform](https://mem0.dev/pd)
- Join our [Discord](https://mem0.dev/Did) with other developers and get support.
<CardGroup cols={2}>
<Card
title="Start Building"
icon="rocket"
href="/platform/quickstart"
>
Follow the quickstart guide to create your first memory in 5 minutes
</Card>
<Card
title="Compare Options"
icon="code-compare"
href="/platform/platform-vs-oss"
>
See the full comparison between Platform and Open Source
</Card>
</CardGroup>
+165
View File
@@ -0,0 +1,165 @@
---
title: "Platform vs Open Source"
description: "Choose the right Mem0 solution for your needs"
icon: "code-compare"
---
## Which Mem0 is right for you?
Mem0 offers two powerful ways to add memory to your AI applications. Choose based on your priorities:
<CardGroup cols={2}>
<Card
title="Mem0 Platform"
icon="cloud"
href="/platform/quickstart"
>
**Managed, hassle-free**
Get started in 5 minutes with our hosted solution. Perfect for fast iteration and production apps.
</Card>
<Card
title="Open Source"
icon="code-branch"
href="/open-source/python-quickstart"
>
**Self-hosted, full control**
Deploy on your infrastructure. Choose your vector DB, LLM, and configure everything.
</Card>
</CardGroup>
---
## Feature Comparison
<AccordionGroup>
<Accordion title="Setup & Getting Started" icon="rocket">
| Feature | Platform | Open Source |
|---------|----------|-------------|
| **Time to first memory** | 5 minutes | 15-30 minutes |
| **Infrastructure needed** | None | Vector DB + Python/Node env |
| **API key setup** | One environment variable | Configure LLM + embedder + vector DB |
| **Maintenance** | Fully managed by Mem0 | Self-managed |
</Accordion>
<Accordion title="Core Memory Features" icon="brain">
| Feature | Platform | Open Source |
|---------|----------|-------------|
| **User & agent memories** | ✅ | ✅ |
| **Smart deduplication** | ✅ | ✅ |
| **Semantic search** | ✅ | ✅ |
| **Memory updates** | ✅ | ✅ |
| **Multi-language SDKs** | Python, JavaScript | Python, JavaScript |
</Accordion>
<Accordion title="Advanced Capabilities" icon="sparkles">
| Feature | Platform | Open Source |
|---------|----------|-------------|
| **Graph Memory** | ✅ (Managed) | ✅ (Self-configured) |
| **Multimodal support** | ✅ | ✅ |
| **Custom categories** | ✅ | Limited |
| **Advanced retrieval** | ✅ | ✅ |
| **Memory filters v2** | ✅ | ⚠️ (via metadata) |
| **Webhooks** | ✅ | ❌ |
| **Memory export** | ✅ | ❌ |
</Accordion>
<Accordion title="Infrastructure & Scaling" icon="server">
| Feature | Platform | Open Source |
|---------|----------|-------------|
| **Hosting** | Managed by Mem0 | Self-hosted |
| **Auto-scaling** | ✅ | Manual |
| **High availability** | ✅ Built-in | DIY setup |
| **Vector DB choice** | Managed | Qdrant, Chroma, Pinecone, Milvus, +20 more |
| **LLM choice** | Managed (optimized) | OpenAI, Anthropic, Ollama, Together, +10 more |
| **Data residency** | US (expandable) | Your choice |
</Accordion>
<Accordion title="Pricing & Cost" icon="dollar-sign">
| Aspect | Platform | Open Source |
|--------|----------|-------------|
| **License** | Usage-based pricing | Apache 2.0 (free) |
| **Infrastructure costs** | Included in pricing | You pay for VectorDB + LLM + hosting |
| **Support** | Included | Community + GitHub |
| **Best for** | Fast iteration, production apps | Cost-sensitive, custom requirements |
</Accordion>
<Accordion title="Development & Integration" icon="code">
| Feature | Platform | Open Source |
|---------|----------|-------------|
| **REST API** | ✅ | ✅ (via feature flag) |
| **Python SDK** | ✅ | ✅ |
| **JavaScript SDK** | ✅ | ✅ |
| **Framework integrations** | LangChain, CrewAI, LlamaIndex, +15 | Same |
| **Dashboard** | ✅ Web-based | ❌ |
| **Analytics** | ✅ Built-in | DIY |
</Accordion>
</AccordionGroup>
---
## Decision Guide
### Choose **Platform** if you want:
<CardGroup cols={2}>
<Card icon="bolt" title="Fast Time to Market">
Get your AI app with memory live in hours, not weeks. No infrastructure setup needed.
</Card>
<Card icon="shield" title="Production-Ready">
Auto-scaling, high availability, and managed infrastructure out of the box.
</Card>
<Card icon="chart-line" title="Built-in Analytics">
Track memory usage, query patterns, and user engagement through our dashboard.
</Card>
<Card icon="webhook" title="Advanced Features">
Access to webhooks, memory export, custom categories, and priority support.
</Card>
</CardGroup>
### Choose **Open Source** if you need:
<CardGroup cols={2}>
<Card icon="lock" title="Full Data Control">
Host everything on your infrastructure. Complete data residency and privacy control.
</Card>
<Card icon="wrench" title="Custom Configuration">
Choose your own vector DB, LLM provider, embedder, and deployment strategy.
</Card>
<Card icon="code" title="Extensibility">
Modify the codebase, add custom features, and contribute back to the community.
</Card>
<Card icon="dollar-sign" title="Cost Optimization">
Use local LLMs (Ollama), self-hosted vector DBs, and optimize for your specific use case.
</Card>
</CardGroup>
---
## Still not sure?
<CardGroup cols={2}>
<Card
title="Try Platform Free"
icon="rocket"
href="https://app.mem0.ai"
>
Sign up and test the Platform with our free tier. No credit card required.
</Card>
<Card
title="Explore Open Source"
icon="github"
href="https://github.com/mem0ai/mem0"
>
Clone the repo and run locally to see how it works. Star us while you're there!
</Card>
</CardGroup>
+92 -163
View File
@@ -1,14 +1,22 @@
---
title: Quickstart
description: 'Get started with Mem0 Platform in minutes'
description: "Get started with Mem0 Platform in minutes"
icon: "bolt"
iconType: "solid"
---
Get up and running with Mem0 Platform quickly. This guide covers the essential steps to start storing and retrieving memories.
Get started with Mem0 Platform's hosted API in under 5 minutes. This guide shows you how to authenticate and store your first memory.
## 1. Installation
## Prerequisites
- Mem0 Platform account ([Sign up here](https://app.mem0.ai))
- API key ([Get one from dashboard](https://app.mem0.ai/settings/api-keys))
- Python 3.10+, Node.js 14+, or cURL
## Installation
<Steps>
<Step title="Install SDK">
<CodeGroup>
```bash pip
pip install mem0ai
@@ -17,205 +25,126 @@ pip install mem0ai
```bash npm
npm install mem0ai
```
</CodeGroup>
</Step>
## 2. API Key Setup
1. Sign in to [Mem0 Platform](https://mem0.dev/pd-api)
2. Copy your API Key from the dashboard
![Get API Key from Mem0 Platform](/images/platform/api-key.png)
## 3. Initialize Client
<Step title="Set your API key">
<CodeGroup>
```python Python
import os
from mem0 import MemoryClient
os.environ["MEM0_API_KEY"] = "your-api-key"
client = MemoryClient()
```
client = MemoryClient(api_key="your-api-key")
````
```javascript JavaScript
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key' });
````
```bash cURL
export MEM0_API_KEY="your-api-key"
```
</CodeGroup>
</Step>
## 4. Basic Operations
### Add Memories
Store user preferences and context:
<Step title="Add a memory">
<CodeGroup>
```python Python
messages = [
{"role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Hello Alex! I'll remember your dietary preferences."}
{"role": "user", "content": "I'm a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Got it! I'll remember your dietary preferences."}
]
result = client.add(messages, user_id="alex")
print(result)
```
client.add(messages, user_id="user123")
````
```javascript JavaScript
const messages = [
{"role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Hello Alex! I'll remember your dietary preferences."}
{"role": "user", "content": "I'm a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Got it! I'll remember your dietary preferences."}
];
await client.add(messages, { user_id: "user123" });
````
client.add(messages, { user_id: "alex" })
.then(result => console.log(result))
.catch(error => console.error(error));
```bash cURL
curl -X POST https://api.mem0.ai/v1/memories/add \
-H "Authorization: Bearer $MEM0_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Im a vegetarian and allergic to nuts."},
{"role": "assistant", "content": "Got it! Ill remember your dietary preferences."}
],
"user_id": "user123"
}'
```
</CodeGroup>
</Step>
### Search Memories
Retrieve relevant memories based on queries:
<Step title="Search memories">
<CodeGroup>
```python Python
query = "What should I cook for dinner?"
results = client.search(query, user_id="alex")
results = client.search("What are my dietary restrictions?", filters={"user_id": "user123"})
print(results)
```
````
```javascript JavaScript
const query = "What should I cook for dinner?";
client.search(query, { user_id: "alex" })
.then(results => console.log(results))
.catch(error => console.error(error));
const results = await client.search("What are my dietary restrictions?", { filters: { user_id: "user123" } });
console.log(results);
````
```bash cURL
curl -X POST https://api.mem0.ai/v1/memories/search \
-H "Authorization: Bearer $MEM0_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What are my dietary restrictions?",
"filters": {"user_id": "user123"}
}'
```
</CodeGroup>
### Get All Memories
**Output:**
Fetch all memories for a user:
<CodeGroup>
```python Python
memories = client.get_all(user_id="alex")
print(memories)
```json
{
"results": [
{
"id": "14e1b28a-2014-40ad-ac42-69c9ef42193d",
"memory": "Allergic to nuts",
"user_id": "user123",
"categories": ["health"],
"created_at": "2025-10-22T04:40:22.864647-07:00",
"score": 0.30
}
]
}
```
```javascript JavaScript
client.getAll({ user_id: "alex" })
.then(memories => console.log(memories))
.catch(error => console.error(error));
```
</CodeGroup>
</Step>
</Steps>
## 5. Memory Types
## What's Next?
### User Memories
Long-term memories that persist across sessions:
<CardGroup cols={3}>
<Card title="Memory Operations" icon="database" href="/core-concepts/memory-operations/add">
Learn how to search, update, and delete memories with complete CRUD operations
</Card>
<CodeGroup>
```python Python
client.add(messages, user_id="alex", metadata={"category": "preferences"})
```
<Card title="Platform Features" icon="star" href="/platform/features/platform-overview">
Explore advanced features like metadata filtering, graph memory, and webhooks
</Card>
```javascript JavaScript
client.add(messages, { user_id: "alex", metadata: { category: "preferences" } });
```
</CodeGroup>
<Card title="API Reference" icon="code" href="/api-reference/memory/add-memories">
See complete API documentation and integration examples
</Card>
</CardGroup>
### Session Memories
Short-term memories for specific conversations:
## Additional Resources
<CodeGroup>
```python Python
client.add(messages, user_id="alex", run_id="session-123")
```
```javascript JavaScript
client.add(messages, { user_id: "alex", run_id: "session-123" });
```
</CodeGroup>
### Agent Memories
Memories for AI assistants and agents:
<CodeGroup>
```python Python
client.add(messages, agent_id="support-bot")
```
```javascript JavaScript
client.add(messages, { agent_id: "support-bot" });
```
</CodeGroup>
## 6. Advanced Features
### Async Processing
Process memories in the background for faster responses:
<CodeGroup>
```python Python
client.add(messages, user_id="alex", async_mode=True)
```
```javascript JavaScript
client.add(messages, { user_id: "alex", async_mode: true });
```
</CodeGroup>
### Search with Filters
Filter results by categories and metadata:
<CodeGroup>
```python Python
results = client.search(
"food preferences",
user_id="alex",
categories=["preferences"],
metadata={"category": "food"}
)
```
```javascript JavaScript
client.search("food preferences", {
user_id: "alex",
categories: ["preferences"],
metadata: { category: "food" }
});
```
</CodeGroup>
## TypeScript Example
<CodeGroup>
```typescript TypeScript
import MemoryClient, { Message, MemoryOptions } from 'mem0ai';
const client = new MemoryClient('your-api-key');
const messages: Message[] = [
{ role: "user", content: "I love Italian food" },
{ role: "assistant", content: "Noted! I'll remember your preference for Italian cuisine." }
];
const options: MemoryOptions = {
user_id: "alex",
metadata: { category: "food_preferences" }
};
client.add(messages, options)
.then(result => console.log(result))
.catch(error => console.error(error));
```
</CodeGroup>
## Next Steps
Now that you're up and running, explore more advanced features:
- **[Advanced Memory Operations](/core-concepts/memory-operations)** - Learn about filtering, updating, and managing memories
- **[Platform Features](/platform/features/platform-overview)** - Discover advanced platform capabilities
- **[API Reference](/api-reference)** - Complete API documentation
<Snippet file="get-help.mdx" />
- **[Platform vs OSS](/platform/platform-vs-oss)** - Understand the differences between Platform and Open Source
- **[Troubleshooting](/platform/faqs)** - Common issues and solutions
- **[Integration Examples](/examples/mem0-demo)** - See Mem0 in action