From f7d7c53001545ee69bac97b2be5e9e5363d88d75 Mon Sep 17 00:00:00 2001 From: Parth Sharma <109902593+parthshr370@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:00:45 +0530 Subject: [PATCH] Added improved docs index and overview pages and quickstart (#3603) --- docs/api-reference.mdx | 236 +-- docs/api-reference/memory/get-memories.mdx | 92 +- docs/api-reference/organizations-projects.mdx | 197 +++ docs/changelog.mdx | 35 + docs/components/embedders/config.mdx | 2 - docs/components/embedders/overview.mdx | 2 - docs/components/llms/config.mdx | 2 - docs/components/llms/overview.mdx | 2 - docs/components/rerankers/config.mdx | 84 +- docs/components/rerankers/custom-prompts.mdx | 21 +- docs/components/rerankers/models/cohere.mdx | 22 +- .../rerankers/models/huggingface.mdx | 2 - docs/components/rerankers/models/llm.mdx | 2 - .../rerankers/models/llm_reranker.mdx | 2 - .../rerankers/models/sentence_transformer.mdx | 2 - .../rerankers/models/zero_entropy.mdx | 2 - docs/components/rerankers/optimization.mdx | 2 - docs/components/rerankers/overview.mdx | 2 - docs/components/vectordbs/config.mdx | 2 - docs/components/vectordbs/overview.mdx | 3 - .../memory-operations/update.mdx | 2 +- docs/docs.json | 1431 +++++++++-------- docs/introduction.mdx | 155 +- docs/logo/mem0 logo.svg | 19 + docs/logo/openmemory-icon.svg | 19 + docs/open-source/configuration.mdx | 336 ++++ docs/open-source/features/async-memory.mdx | 2 - .../custom-fact-extraction-prompt.mdx | 2 - .../features/custom-update-memory-prompt.mdx | 5 +- .../features/metadata-filtering.mdx | 4 +- .../features/multimodal-support.mdx | 2 - .../features/openai_compatibility.mdx | 3 +- docs/open-source/features/overview.mdx | 2 - docs/open-source/features/reranker-search.mdx | 4 +- docs/open-source/features/reranking.mdx | 4 +- docs/open-source/features/rest-api.mdx | 3 +- docs/open-source/graph_memory/features.mdx | 2 +- docs/open-source/graph_memory/overview.mdx | 2 +- docs/open-source/overview.mdx | 92 +- docs/open-source/python-quickstart.mdx | 567 +------ docs/{ => platform}/faqs.mdx | 0 docs/platform/features/advanced-retrieval.mdx | 2 - docs/platform/features/async-client.mdx | 2 - .../features/async-mode-default-change.mdx | 2 - docs/platform/features/contextual-add.mdx | 2 - docs/platform/features/criteria-retrieval.mdx | 2 - docs/platform/features/custom-categories.mdx | 2 - .../platform/features/custom-instructions.mdx | 2 - docs/platform/features/direct-import.mdx | 2 - docs/platform/features/expiration-date.mdx | 2 - docs/platform/features/feedback-mechanism.mdx | 2 - docs/platform/features/graph-memory.mdx | 2 - docs/platform/features/group-chat.mdx | 2 - docs/platform/features/memory-export.mdx | 2 - docs/platform/features/multimodal-support.mdx | 2 - docs/platform/features/platform-overview.mdx | 2 - docs/platform/features/timestamp.mdx | 2 - docs/platform/features/v2-memory-filters.mdx | 2 - docs/platform/features/webhooks.mdx | 2 - docs/platform/overview.mdx | 137 +- docs/platform/platform-vs-oss.mdx | 165 ++ docs/platform/quickstart.mdx | 255 ++- docs/quickstart.mdx | 418 ----- docs/v0x/examples/mem0-openai-voice-demo.mdx | 97 +- docs/v0x/integrations/aws-bedrock.mdx | 3 +- 65 files changed, 2182 insertions(+), 2299 deletions(-) create mode 100644 docs/api-reference/organizations-projects.mdx create mode 100644 docs/logo/mem0 logo.svg create mode 100644 docs/logo/openmemory-icon.svg create mode 100644 docs/open-source/configuration.mdx rename docs/{ => platform}/faqs.mdx (100%) create mode 100644 docs/platform/platform-vs-oss.mdx delete mode 100644 docs/quickstart.mdx diff --git a/docs/api-reference.mdx b/docs/api-reference.mdx index 557edcd5b..9673a8034 100644 --- a/docs/api-reference.mdx +++ b/docs/api-reference.mdx @@ -1,44 +1,79 @@ --- -title: Overview -icon: "info" +title: "Overview" +icon: "terminal" iconType: "solid" +description: "REST APIs for memory management, search, and entity operations" --- -Mem0 provides a powerful set of APIs that allow you to integrate advanced memory management capabilities into your applications. Our APIs are designed to be intuitive, efficient, and scalable, enabling you to create, retrieve, update, and delete memories across various entities such as users, agents, apps, and runs. +## Mem0 REST API + +Mem0 provides a comprehensive REST API for integrating advanced memory capabilities into your applications. Create, search, update, and manage memories across users, agents, and custom entities with simple HTTP requests. + + +**Quick start:** Get your API key from the [Mem0 Dashboard](https://app.mem0.ai/dashboard/api-keys) and make your first memory operation in minutes. + + +--- ## Quick Start Guide Get started with Mem0 API in three simple steps: 1. **[Add Memories](/api-reference/memory/add-memories)** - Store information and context from user conversations -2. **[Search Memories](/api-reference/memory/search-memories)** - Retrieve relevant memories based on queries -3. **[Get Memories](/api-reference/memory/get-memories)** - Fetch all memories for a specific entity +2. **[Search Memories](/api-reference/memory/v2-search-memories)** - Retrieve relevant memories using semantic search +3. **[Get Memories](/api-reference/memory/v2-get-memories)** - Fetch all memories for a specific entity -### Common Operations +--- + +## Core Operations Store new memories from conversations and interactions + - Find relevant memories using semantic search + Find relevant memories using semantic search with filters + - Modify existing memory content + Modify existing memory content and metadata + - Remove specific memories or batch delete + Remove specific memories or batch delete operations -## API Structure +--- -Our API is organized into several main categories: +## API Categories -1. **[Memory APIs](#memory-apis)**: Core operations for managing individual memories and collections -2. **[Entities APIs](#entities-apis)**: Manage different entity types (users, agents, etc.) and their associated memories -3. **[Organizations APIs](#organizations-apis)**: Manage organizations and their members (optional) -4. **[Project APIs](#project-apis)**: Manage projects within organizations (optional) +Explore the full API organized by functionality: + + + + Core and advanced operations: CRUD, search, batch updates, history, and exports + + + + Manage users, agents, and their associated memory data + + + + Multi-tenant support, access control, and team collaboration + + + + Real-time notifications for memory events and updates + + + + +**Building multi-tenant apps?** Learn about [Organizations & Projects](/api-reference/organizations-projects) for team isolation and access control. + + +--- ## Authentication @@ -50,165 +85,20 @@ Authorization: Token Get your API key from the [Mem0 Dashboard](https://app.mem0.ai/dashboard/api-keys). -## Organizations and projects (optional) + +**Keep your API key secure.** Never expose it in client-side code or public repositories. Use environment variables and server-side requests only. + -Organizations and projects provide the following capabilities: +--- -- **Multi-org/project Support**: Specify organization and project when initializing the Mem0 client to attribute API usage appropriately. -- **Member Management**: Control access to data through organization and project membership. -- **Access Control**: Only members can access memories and data within their organization/project scope. -- **Team Isolation**: Maintain data separation between different teams and projects for secure collaboration. +## Next Steps -Example with the mem0 Python package: + + + Start storing memories via the REST API + - - - -```python -from mem0 import MemoryClient -client = MemoryClient(org_id='YOUR_ORG_ID', project_id='YOUR_PROJECT_ID') -``` - - - - - -```javascript -import { MemoryClient } from "mem0ai"; -const client = new MemoryClient({organizationId: "YOUR_ORG_ID", projectId: "YOUR_PROJECT_ID"}); -``` - - - - -### Project Management Methods - -The Mem0 client provides comprehensive project management capabilities through the `client.project` interface: - -#### Get Project Details - -Retrieve information about the current project: - -```python -# Get all project details -project_info = client.project.get() - -# Get specific fields only -project_info = client.project.get(fields=["name", "description", "custom_categories"]) -``` - -#### Create a New Project - -Create a new project within your organization: - -```python -# Create a project with name and description -new_project = client.project.create( - name="My New Project", - description="A project for managing customer support memories" -) -``` - -#### Update Project Settings - -Modify project configuration including custom instructions, categories, and graph settings: - -```python -# Update project with custom categories -client.project.update( - custom_categories=[ - {"customer_preferences": "Customer likes, dislikes, and preferences"}, - {"support_history": "Previous support interactions and resolutions"} - ] -) - -# Update project with custom instructions -client.project.update( - custom_instructions="..." -) - -# Enable graph memory for the project -client.project.update(enable_graph=True) - -# Update multiple settings at once -client.project.update( - custom_instructions="...", - custom_categories=[ - {"personal_info": "User personal information and preferences"}, - {"work_context": "Professional context and work-related information"} - ], - enable_graph=True -) -``` - -#### Delete Project - - -This action will remove all memories, messages, and other related data in the project. This operation is irreversible. - - -Remove a project and all its associated data: - -```python -# Delete the current project (irreversible) -result = client.project.delete() -``` - -#### Member Management - -Manage project members and their access levels: - -```python -# Get all project members -members = client.project.get_members() - -# Add a new member as a reader -client.project.add_member( - email="colleague@company.com", - role="READER" # or "OWNER" -) - -# Update a member's role -client.project.update_member( - email="colleague@company.com", - role="OWNER" -) - -# Remove a member from the project -client.project.remove_member(email="colleague@company.com") -``` - -#### Member Roles - -- **READER**: Can view and search memories, but cannot modify project settings or manage members. -- **OWNER**: Full access including project modification, member management, and all reader permissions. - -#### Async Support - -All project methods are also available in async mode: - -```python -from mem0 import AsyncMemoryClient - -async def manage_project(): - client = AsyncMemoryClient(org_id='YOUR_ORG_ID', project_id='YOUR_PROJECT_ID') - - # All methods support async/await - project_info = await client.project.get() - await client.project.update(enable_graph=True) - members = await client.project.get_members() - -# To call the async function properly -import asyncio -asyncio.run(manage_project()) -``` - -## Getting Started - -To begin using the Mem0 API, you'll need to: - -1. Sign up for a [Mem0 account](https://app.mem0.ai) and obtain your API key. -2. Familiarize yourself with the API endpoints and their functionalities. -3. Make your first API call to add or retrieve a memory. - -Explore the detailed documentation for each API endpoint to learn more about request/response formats, parameters, and example usage. + + Learn advanced search and filtering techniques + + diff --git a/docs/api-reference/memory/get-memories.mdx b/docs/api-reference/memory/get-memories.mdx index 30953dcc3..f2003e3bd 100644 --- a/docs/api-reference/memory/get-memories.mdx +++ b/docs/api-reference/memory/get-memories.mdx @@ -1,9 +1,10 @@ --- -title: 'Get Memories' +title: "Get Memories" openapi: post /v2/memories/ --- The v2 get memories API is powerful and flexible, allowing for more precise memory listing without the need for a search query. It supports complex logical operations (AND, OR, NOT) and comparison operators for advanced filtering capabilities. The comparison operators include: + - `in`: Matches any of the values specified - `gte`: Greater than or equal to - `lte`: Less than or equal to @@ -29,43 +30,70 @@ memories = m.get_all( ) ``` -```json Output -[ +```python Output { - "id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7", - "memory":"Name: Alex. Vegetarian. Allergic to nuts.", - "user_id":"alex", - "hash":"62bc074f56d1f909f1b4c2b639f56f6a", - "metadata":null, - "created_at":"2024-07-25T23:57:00.108347-07:00", - "updated_at":"2024-07-25T23:57:00.108367-07:00" + "results": [ + { + "id": "f4cbdb08-7062-4f3e-8eb2-9f5c80dfe64c", + "memory": "Alex is planning a trip to San Francisco from July 1st to July 10th", + "created_at": "2024-07-01T12:00:00Z", + "updated_at": "2024-07-01T12:00:00Z" + }, + { + "id": "a2b8c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p", + "memory": "Alex prefers vegetarian restaurants", + "created_at": "2024-07-05T15:30:00Z", + "updated_at": "2024-07-05T15:30:00Z" + } + ], + "total": 2 } -] ``` - - -```python Wildcard Example -# Using wildcard to get all memories for a specific user across all run_ids -memories = m.get_all( - filters={ - "AND": [ - { - "user_id": "alex" - }, - { - "run_id": "*" - } - ] - } -) -``` ## Graph Memory -To retrieve memories with graph-based relationships, pass the `enable_graph=True` parameter. This includes relationship data in the response for more contextual results. +To retrieve graph memory relationships between entities, pass `output_format="v1.1"` in your request. This will return memories with entity and relationship information from the knowledge graph. - -Learn more in the [Graph Memory documentation](/platform/features/graph-memory). - + +```python Code +memories = m.get_all( + filters={ + "user_id": "alex" + }, + output_format="v1.1" +) +``` + +```python Output +{ + "results": [ + { + "id": "f4cbdb08-7062-4f3e-8eb2-9f5c80dfe64c", + "memory": "Alex is planning a trip to San Francisco", + "entities": [ + { + "id": "entity-1", + "name": "Alex", + "type": "person" + }, + { + "id": "entity-2", + "name": "San Francisco", + "type": "location" + } + ], + "relations": [ + { + "source": "entity-1", + "target": "entity-2", + "relationship": "traveling_to" + } + ] + } + ] +} +``` + + diff --git a/docs/api-reference/organizations-projects.mdx b/docs/api-reference/organizations-projects.mdx new file mode 100644 index 000000000..2d54de68e --- /dev/null +++ b/docs/api-reference/organizations-projects.mdx @@ -0,0 +1,197 @@ +--- +title: Organizations & Projects +icon: "building" +description: "Manage multi-tenant applications with organization and project APIs" +--- + +## Overview + +Organizations and projects provide multi-tenant support, access control, and team collaboration capabilities for Mem0 Platform. Use these APIs to build applications that support multiple teams, customers, or isolated environments. + + +Organizations and projects are **optional** features. You can use Mem0 without them for single-user or simple multi-user applications. + + +## Key Capabilities + +- **Multi-org/project Support**: Specify organization and project when initializing the Mem0 client to attribute API usage appropriately +- **Member Management**: Control access to data through organization and project membership +- **Access Control**: Only members can access memories and data within their organization/project scope +- **Team Isolation**: Maintain data separation between different teams and projects for secure collaboration + +--- + +## Using Organizations & Projects + +### Initialize with Org/Project Context + +Example with the mem0 Python package: + + + + +```python +from mem0 import MemoryClient +client = MemoryClient(org_id='YOUR_ORG_ID', project_id='YOUR_PROJECT_ID') +``` + + + + + +```javascript +import { MemoryClient } from "mem0ai"; +const client = new MemoryClient({ + organizationId: "YOUR_ORG_ID", + projectId: "YOUR_PROJECT_ID" +}); +``` + + + + +--- + +## Project Management + +The Mem0 client provides comprehensive project management through the `client.project` interface: + +### Get Project Details + +Retrieve information about the current project: + +```python +# Get all project details +project_info = client.project.get() + +# Get specific fields only +project_info = client.project.get(fields=["name", "description", "custom_categories"]) +``` + +### Create a New Project + +Create a new project within your organization: + +```python +# Create a project with name and description +new_project = client.project.create( + name="My New Project", + description="A project for managing customer support memories" +) +``` + +### Update Project Settings + +Modify project configuration including custom instructions, categories, and graph settings: + +```python +# Update project with custom categories +client.project.update( + custom_categories=[ + {"customer_preferences": "Customer likes, dislikes, and preferences"}, + {"support_history": "Previous support interactions and resolutions"} + ] +) + +# Update project with custom instructions +client.project.update( + custom_instructions="..." +) + +# Enable graph memory for the project +client.project.update(enable_graph=True) + +# Update multiple settings at once +client.project.update( + custom_instructions="...", + custom_categories=[ + {"personal_info": "User personal information and preferences"}, + {"work_context": "Professional context and work-related information"} + ], + enable_graph=True +) +``` + +### Delete Project + + +This action will remove all memories, messages, and other related data in the project. **This operation is irreversible.** + + +Remove a project and all its associated data: + +```python +# Delete the current project (irreversible) +result = client.project.delete() +``` + +--- + +## Member Management + +Manage project members and their access levels: + +```python +# Get all project members +members = client.project.get_members() + +# Add a new member as a reader +client.project.add_member( + email="colleague@company.com", + role="READER" # or "OWNER" +) + +# Update a member's role +client.project.update_member( + email="colleague@company.com", + role="OWNER" +) + +# Remove a member from the project +client.project.remove_member(email="colleague@company.com") +``` + +### Member Roles + +| Role | Permissions | +|------|-------------| +| **READER** | Can view and search memories, but cannot modify project settings or manage members | +| **OWNER** | Full access including project modification, member management, and all reader permissions | + +--- + +## Async Support + +All project methods are available in async mode: + +```python +from mem0 import AsyncMemoryClient + +async def manage_project(): + client = AsyncMemoryClient(org_id='YOUR_ORG_ID', project_id='YOUR_PROJECT_ID') + + # All methods support async/await + project_info = await client.project.get() + await client.project.update(enable_graph=True) + members = await client.project.get_members() + +# To call the async function properly +import asyncio +asyncio.run(manage_project()) +``` + +--- + +## API Reference + +For complete API specifications and additional endpoints, see: + + + + Create, get, and manage organizations + + + + Full project CRUD and member management endpoints + + diff --git a/docs/changelog.mdx b/docs/changelog.mdx index 303309edd..2e251db31 100644 --- a/docs/changelog.mdx +++ b/docs/changelog.mdx @@ -7,6 +7,41 @@ mode: "wide" + + +**New Features & Updates:** +- **Vector Stores:** + - Added Azure MySQL support + - Added Azure AI Search Vector Store support +- **LLMs:** + - Added Tool Call support for LangchainLLM + - Enabled custom model and parameters for Hugging Face with huggingface_base_url + - Updated default LLM configuration +- **Rerankers:** + - Added reranker support: Cohere, ZeroEntropy, Hugging Face, Sentence Transformers, and LLMs +- **Core:** + - Added metadata filtering for OSS + - Added Assistant memory retrieval + - Enabled async mode as default + +**Improvements:** +- **Prompts:** + - Improved prompt for better memory retrieval +- **Dependencies:** + - Updated dependency compatibility with OpenAI 2.x +- **Validation:** + - Validated embedding_dims for Kuzu integration + +**Bug Fixes:** +- **Vector Stores:** + - Fixed Databricks Vector Store integration + - Fixed Milvus DB bug and added test coverage + - Fixed Weaviate search method +- **LLMs:** + - Fixed bug with thinking LLM in vLLM + + + **New Features & Updates:** diff --git a/docs/components/embedders/config.mdx b/docs/components/embedders/config.mdx index dc805e8a0..aa8b19b7f 100644 --- a/docs/components/embedders/config.mdx +++ b/docs/components/embedders/config.mdx @@ -1,7 +1,5 @@ --- title: Configurations -icon: "gear" -iconType: "solid" --- diff --git a/docs/components/embedders/overview.mdx b/docs/components/embedders/overview.mdx index 9d030b93a..ac91c02a6 100644 --- a/docs/components/embedders/overview.mdx +++ b/docs/components/embedders/overview.mdx @@ -1,7 +1,5 @@ --- title: Overview -icon: "info" -iconType: "solid" --- Mem0 offers support for various embedding models, allowing users to choose the one that best suits their needs. diff --git a/docs/components/llms/config.mdx b/docs/components/llms/config.mdx index 08332cb11..8d443912c 100644 --- a/docs/components/llms/config.mdx +++ b/docs/components/llms/config.mdx @@ -1,7 +1,5 @@ --- title: Configurations -icon: "gear" -iconType: "solid" --- ## How to define configurations? diff --git a/docs/components/llms/overview.mdx b/docs/components/llms/overview.mdx index 68ae2e4bd..7d6caf519 100644 --- a/docs/components/llms/overview.mdx +++ b/docs/components/llms/overview.mdx @@ -1,7 +1,5 @@ --- title: Overview -icon: "info" -iconType: "solid" --- Mem0 includes built-in support for various popular large language models. Memory can utilize the LLM provided by the user, ensuring efficient use for specific needs. diff --git a/docs/components/rerankers/config.mdx b/docs/components/rerankers/config.mdx index 86e55aa72..c69fb077b 100644 --- a/docs/components/rerankers/config.mdx +++ b/docs/components/rerankers/config.mdx @@ -1,73 +1,71 @@ --- title: Config -description: 'Configuration options for rerankers in Mem0' -icon: "gear" -iconType: "solid" +description: "Configuration options for rerankers in Mem0" --- ## Common Configuration Parameters All rerankers share these common configuration parameters: -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `provider` | Reranker provider name | `str` | Required | -| `top_k` | Maximum number of results to return after reranking | `int` | `None` | -| `api_key` | API key for the reranker service | `str` | `None` | +| Parameter | Description | Type | Default | +| ---------- | --------------------------------------------------- | ----- | -------- | +| `provider` | Reranker provider name | `str` | Required | +| `top_k` | Maximum number of results to return after reranking | `int` | `None` | +| `api_key` | API key for the reranker service | `str` | `None` | ## Provider-Specific Configuration ### Zero Entropy -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | Model to use: `zerank-1` or `zerank-1-small` | `str` | `"zerank-1"` | -| `api_key` | Zero Entropy API key | `str` | `None` | +| Parameter | Description | Type | Default | +| --------- | -------------------------------------------- | ----- | ------------ | +| `model` | Model to use: `zerank-1` or `zerank-1-small` | `str` | `"zerank-1"` | +| `api_key` | Zero Entropy API key | `str` | `None` | ### Cohere -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | Cohere rerank model | `str` | `"rerank-english-v3.0"` | -| `api_key` | Cohere API key | `str` | `None` | -| `return_documents` | Whether to return document texts in response | `bool` | `False` | -| `max_chunks_per_doc` | Maximum chunks per document | `int` | `None` | +| Parameter | Description | Type | Default | +| -------------------- | -------------------------------------------- | ------ | ----------------------- | +| `model` | Cohere rerank model | `str` | `"rerank-english-v3.0"` | +| `api_key` | Cohere API key | `str` | `None` | +| `return_documents` | Whether to return document texts in response | `bool` | `False` | +| `max_chunks_per_doc` | Maximum chunks per document | `int` | `None` | ### Sentence Transformer -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | HuggingFace cross-encoder model name | `str` | `"cross-encoder/ms-marco-MiniLM-L-6-v2"` | -| `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | -| `batch_size` | Batch size for processing | `int` | `32` | -| `show_progress_bar` | Show progress during processing | `bool` | `False` | +| Parameter | Description | Type | Default | +| ------------------- | -------------------------------------------- | ------ | ---------------------------------------- | +| `model` | HuggingFace cross-encoder model name | `str` | `"cross-encoder/ms-marco-MiniLM-L-6-v2"` | +| `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | +| `batch_size` | Batch size for processing | `int` | `32` | +| `show_progress_bar` | Show progress during processing | `bool` | `False` | ### Hugging Face -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | HuggingFace reranker model name | `str` | `"BAAI/bge-reranker-large"` | -| `api_key` | HuggingFace API token | `str` | `None` | -| `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | +| Parameter | Description | Type | Default | +| --------- | -------------------------------------------- | ----- | --------------------------- | +| `model` | HuggingFace reranker model name | `str` | `"BAAI/bge-reranker-large"` | +| `api_key` | HuggingFace API token | `str` | `None` | +| `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | ### LLM-based -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | LLM model to use for scoring | `str` | `"gpt-4o-mini"` | -| `provider` | LLM provider (`openai`, `anthropic`, etc.) | `str` | `"openai"` | -| `api_key` | API key for LLM provider | `str` | `None` | -| `temperature` | Temperature for LLM generation | `float` | `0.0` | -| `max_tokens` | Maximum tokens for LLM response | `int` | `100` | -| `scoring_prompt` | Custom prompt template for scoring | `str` | Default scoring prompt | +| Parameter | Description | Type | Default | +| ---------------- | ------------------------------------------ | ------- | ---------------------- | +| `model` | LLM model to use for scoring | `str` | `"gpt-4o-mini"` | +| `provider` | LLM provider (`openai`, `anthropic`, etc.) | `str` | `"openai"` | +| `api_key` | API key for LLM provider | `str` | `None` | +| `temperature` | Temperature for LLM generation | `float` | `0.0` | +| `max_tokens` | Maximum tokens for LLM response | `int` | `100` | +| `scoring_prompt` | Custom prompt template for scoring | `str` | Default scoring prompt | ### LLM Reranker -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `llm.provider` | LLM provider for reranking | `str` | Required | -| `llm.config` | LLM configuration object | `dict` | Required | -| `top_n` | Number of results to return | `int` | `None` | +| Parameter | Description | Type | Default | +| -------------- | --------------------------- | ------ | -------- | +| `llm.provider` | LLM provider for reranking | `str` | Required | +| `llm.config` | LLM configuration object | `dict` | Required | +| `top_n` | Number of results to return | `int` | `None` | ## Environment Variables @@ -93,7 +91,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini" + "model": "gpt-4.1-nano-2025-04-14" } }, "rerank": { diff --git a/docs/components/rerankers/custom-prompts.mdx b/docs/components/rerankers/custom-prompts.mdx index 4b28ba862..c7eff07c0 100644 --- a/docs/components/rerankers/custom-prompts.mdx +++ b/docs/components/rerankers/custom-prompts.mdx @@ -1,7 +1,5 @@ --- title: Custom Prompts -icon: "pencil" -iconType: "solid" --- When using LLM rerankers, you can customize the prompts used for ranking to better suit your specific use case and domain. @@ -54,7 +52,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4", + "model": "gpt-4.1-nano-2025-04-14", "api_key": "your-openai-key" } }, @@ -71,16 +69,17 @@ memory = Memory.from_config(config) Your custom prompt can use the following variables: -| Variable | Description | -|----------|-------------| -| `{query}` | The search query | -| `{memories}` | The list of memory entries to rank | -| `{user_id}` | The user ID (if available) | +| Variable | Description | +| ---------------- | ------------------------------------- | +| `{query}` | The search query | +| `{memories}` | The list of memory entries to rank | +| `{user_id}` | The user ID (if available) | | `{user_context}` | Additional user context (if provided) | ## Domain-Specific Examples ### Customer Support + ```python customer_support_prompt = """ You are ranking customer support conversation memories. @@ -100,6 +99,7 @@ Rank each memory 1-10 based on support relevance. ``` ### Educational Content + ```python educational_prompt = """ Rank these learning memories for a student query. @@ -119,6 +119,7 @@ Score each memory for educational value (1-10). ``` ### Personal Assistant + ```python personal_assistant_prompt = """ Rank personal memories for relevance to the user's query. @@ -140,6 +141,7 @@ Provide relevance scores (1-10) with brief explanations. ## Advanced Prompt Techniques ### Multi-Criteria Ranking + ```python multi_criteria_prompt = """ Evaluate memories using multiple criteria: @@ -165,6 +167,7 @@ Format: JSON with detailed scoring ``` ### Contextual Ranking + ```python contextual_prompt = """ Consider the following context when ranking memories: @@ -214,4 +217,4 @@ for i, prompt in enumerate(prompts): - **Too Long**: Keep prompts under token limits for your chosen LLM - **Too Vague**: Be specific about ranking criteria - **Inconsistent Format**: Ensure JSON output format is clearly specified -- **Missing Context**: Include relevant variables for your use case \ No newline at end of file +- **Missing Context**: Include relevant variables for your use case diff --git a/docs/components/rerankers/models/cohere.mdx b/docs/components/rerankers/models/cohere.mdx index 106ac0a1c..d26b1c6dc 100644 --- a/docs/components/rerankers/models/cohere.mdx +++ b/docs/components/rerankers/models/cohere.mdx @@ -1,8 +1,6 @@ --- title: Cohere -description: 'Reranking with Cohere' -icon: "building" -iconType: "solid" +description: "Reranking with Cohere" --- Cohere provides enterprise-grade reranking models with excellent multilingual support and production-ready performance. @@ -37,7 +35,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini" + "model": "gpt-4.1-nano-2025-04-14" } }, "reranker": { @@ -124,13 +122,13 @@ config = { ## Configuration Parameters -| Parameter | Description | Type | Default | -|-----------|-------------|------|---------| -| `model` | Cohere rerank model to use | `str` | `"rerank-english-v3.0"` | -| `api_key` | Cohere API key | `str` | `None` | -| `top_k` | Maximum documents to return | `int` | `None` | -| `return_documents` | Whether to return document texts | `bool` | `False` | -| `max_chunks_per_doc` | Maximum chunks per document | `int` | `None` | +| Parameter | Description | Type | Default | +| -------------------- | -------------------------------- | ------ | ----------------------- | +| `model` | Cohere rerank model to use | `str` | `"rerank-english-v3.0"` | +| `api_key` | Cohere API key | `str` | `None` | +| `top_k` | Maximum documents to return | `int` | `None` | +| `return_documents` | Whether to return document texts | `bool` | `False` | +| `max_chunks_per_doc` | Maximum chunks per document | `int` | `None` | ## Features @@ -144,4 +142,4 @@ config = { 1. **Model Selection**: Use `rerank-english-v3.0` for English, `rerank-multilingual-v3.0` for other languages 2. **Batch Processing**: Process multiple queries efficiently 3. **Error Handling**: Implement retry logic for production systems -4. **Monitoring**: Track reranking performance and costs \ No newline at end of file +4. **Monitoring**: Track reranking performance and costs diff --git a/docs/components/rerankers/models/huggingface.mdx b/docs/components/rerankers/models/huggingface.mdx index 70f32108c..e32424d24 100644 --- a/docs/components/rerankers/models/huggingface.mdx +++ b/docs/components/rerankers/models/huggingface.mdx @@ -1,8 +1,6 @@ --- title: Hugging Face Reranker description: 'Access thousands of reranking models from Hugging Face Hub' -icon: "face-smile" -iconType: "solid" --- ## Overview diff --git a/docs/components/rerankers/models/llm.mdx b/docs/components/rerankers/models/llm.mdx index b402f95cd..c1e019215 100644 --- a/docs/components/rerankers/models/llm.mdx +++ b/docs/components/rerankers/models/llm.mdx @@ -1,8 +1,6 @@ --- title: LLM as Reranker description: 'Flexible reranking using LLMs' -icon: "robot" -iconType: "solid" --- LLM-based reranker provides maximum flexibility by using any Large Language Model to score document relevance. This approach allows for custom prompts and domain-specific scoring logic. diff --git a/docs/components/rerankers/models/llm_reranker.mdx b/docs/components/rerankers/models/llm_reranker.mdx index 4724290c2..5fa1582ce 100644 --- a/docs/components/rerankers/models/llm_reranker.mdx +++ b/docs/components/rerankers/models/llm_reranker.mdx @@ -1,8 +1,6 @@ --- title: LLM Reranker description: 'Use any language model as a reranker with custom prompts' -icon: "robot" -iconType: "solid" --- ## Overview diff --git a/docs/components/rerankers/models/sentence_transformer.mdx b/docs/components/rerankers/models/sentence_transformer.mdx index 65af92239..305fc89fe 100644 --- a/docs/components/rerankers/models/sentence_transformer.mdx +++ b/docs/components/rerankers/models/sentence_transformer.mdx @@ -1,8 +1,6 @@ --- title: Sentence Transformer description: 'Local reranking with HuggingFace cross-encoder models' -icon: "server" -iconType: "solid" --- Sentence Transformer reranker provides local reranking using HuggingFace cross-encoder models, perfect for privacy-focused deployments where you want to keep data on-premises. diff --git a/docs/components/rerankers/models/zero_entropy.mdx b/docs/components/rerankers/models/zero_entropy.mdx index f08fccee1..862c50328 100644 --- a/docs/components/rerankers/models/zero_entropy.mdx +++ b/docs/components/rerankers/models/zero_entropy.mdx @@ -1,8 +1,6 @@ --- title: Zero Entropy description: 'Neural reranking with Zero Entropy' -icon: "sparkles" -iconType: "solid" --- [Zero Entropy](https://www.zeroentropy.dev) provides neural reranking models that significantly improve search relevance with fast performance. diff --git a/docs/components/rerankers/optimization.mdx b/docs/components/rerankers/optimization.mdx index c08bb9383..72c39f7fa 100644 --- a/docs/components/rerankers/optimization.mdx +++ b/docs/components/rerankers/optimization.mdx @@ -1,7 +1,5 @@ --- title: Performance Optimization -icon: "bolt" -iconType: "solid" --- Optimizing reranker performance is crucial for maintaining fast search response times while improving result quality. This guide covers best practices for different reranker types. diff --git a/docs/components/rerankers/overview.mdx b/docs/components/rerankers/overview.mdx index e78a01e3c..d75202629 100644 --- a/docs/components/rerankers/overview.mdx +++ b/docs/components/rerankers/overview.mdx @@ -1,7 +1,5 @@ --- title: Overview -icon: "arrow-up-arrow-down" -iconType: "solid" --- Mem0 includes built-in support for various reranking providers to improve the relevance of memory search results. Rerankers post-process initial vector search results by re-scoring and re-ordering them using more sophisticated relevance models. diff --git a/docs/components/vectordbs/config.mdx b/docs/components/vectordbs/config.mdx index 89d995d21..94280dac7 100644 --- a/docs/components/vectordbs/config.mdx +++ b/docs/components/vectordbs/config.mdx @@ -1,7 +1,5 @@ --- title: Configurations -icon: "gear" -iconType: "solid" --- ## How to define configurations? diff --git a/docs/components/vectordbs/overview.mdx b/docs/components/vectordbs/overview.mdx index 15494e612..f26b85702 100644 --- a/docs/components/vectordbs/overview.mdx +++ b/docs/components/vectordbs/overview.mdx @@ -1,7 +1,5 @@ --- title: Overview -icon: "info" -iconType: "solid" --- Mem0 includes built-in support for various popular databases. Memory can utilize the database provided by the user, ensuring efficient use for specific needs. @@ -51,4 +49,3 @@ If you are using a customized model with different dimensions other than 1536 (f `ValueError: shapes (0,1536) and (768,) not aligned: 1536 (dim 1) != 768 (dim 0)` You can add `"embedding_model_dims": 768,` to the config of the vector_store to resolve this issue. - diff --git a/docs/core-concepts/memory-operations/update.mdx b/docs/core-concepts/memory-operations/update.mdx index 1e3e982d1..f93603b1a 100644 --- a/docs/core-concepts/memory-operations/update.mdx +++ b/docs/core-concepts/memory-operations/update.mdx @@ -1,7 +1,7 @@ --- title: Update Memory description: Modify an existing memory by updating its content or metadata. -icon: "pencil" +icon: "pen-to-square" iconType: "solid" --- diff --git a/docs/docs.json b/docs/docs.json index 0a13fa0be..a394e3dd5 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -1,669 +1,766 @@ { - "$schema": "https://mintlify.com/docs.json", - "name": "Mem0", - "description": "Mem0 is a self-improving memory layer for LLM applications, enabling personalized AI experiences that save costs and delight users.", - "theme": "aspen", - "colors": { - "primary": "#2553eb", - "light": "#6084fa", - "dark": "#2553eb" - }, - "favicon": "/logo/favicon.png", - "navigation": { - "versions": [ - { - "version": "v1.0.0", - "anchors": [ - { - "anchor": "Documentation", - "icon": "book-open", - "tabs": [ - { - "tab": "Documentation", - "groups": [ - { - "group": "Getting Started", - "icon": "rocket", - "pages": [ - "introduction", - "quickstart", - "faqs" - ] - }, - { - "group": "Core Concepts", - "icon": "brain", - "pages": [ - "core-concepts/memory-types", - { - "group": "Memory Operations", - "icon": "gear", - "pages": [ - "core-concepts/memory-operations/add", - "core-concepts/memory-operations/search", - "core-concepts/memory-operations/update", - "core-concepts/memory-operations/delete" - ] - } - ] - }, - { - "group": "Platform", - "icon": "globe", - "pages": [ - "platform/overview", - "platform/quickstart", - "platform/advanced-memory-operations", - { - "group": "Features", - "icon": "star", - "pages": [ - "platform/features/platform-overview", - "platform/features/v2-memory-filters", - "platform/features/contextual-add", - "platform/features/async-client", - "platform/features/async-mode-default-change", - "platform/features/graph-memory", - "platform/features/graph-threshold", - "platform/features/advanced-retrieval", - "platform/features/criteria-retrieval", - "platform/features/multimodal-support", - "platform/features/custom-categories", - "platform/features/custom-instructions", - "platform/features/direct-import", - "platform/features/memory-export", - "platform/features/timestamp", - "platform/features/expiration-date", - "platform/features/webhooks", - "platform/features/feedback-mechanism", - "platform/features/group-chat" - ] - } - ] - }, - { - "group": "Open Source", - "icon": "code-branch", - "pages": [ - "open-source/overview", - "open-source/python-quickstart", - "open-source/node-quickstart", - { - "group": "Features", - "icon": "star", - "pages": [ - "open-source/features/overview", - "open-source/features/async-memory", - "open-source/features/openai_compatibility", - "open-source/features/custom-fact-extraction-prompt", - "open-source/features/custom-update-memory-prompt", - "open-source/features/multimodal-support", - "open-source/features/rest-api", - "open-source/features/metadata-filtering", - "open-source/features/reranker-search" - ] - }, - { - "group": "Graph Memory", - "icon": "spider-web", - "pages": [ - "open-source/graph_memory/overview", - "open-source/graph_memory/features" - ] - }, - { - "group": "LLMs", - "icon": "brain", - "pages": [ - "components/llms/overview", - "components/llms/config", - { - "group": "Supported LLMs", - "icon": "list", - "pages": [ - "components/llms/models/openai", - "components/llms/models/anthropic", - "components/llms/models/azure_openai", - "components/llms/models/ollama", - "components/llms/models/together", - "components/llms/models/groq", - "components/llms/models/litellm", - "components/llms/models/mistral_AI", - "components/llms/models/google_AI", - "components/llms/models/aws_bedrock", - "components/llms/models/deepseek", - "components/llms/models/xAI", - "components/llms/models/sarvam", - "components/llms/models/lmstudio", - "components/llms/models/langchain", - "components/llms/models/vllm" - ] - } - ] - }, - { - "group": "Vector Databases", - "icon": "database", - "pages": [ - "components/vectordbs/overview", - "components/vectordbs/config", - { - "group": "Supported Vector Databases", - "icon": "server", - "pages": [ - "components/vectordbs/dbs/qdrant", - "components/vectordbs/dbs/chroma", - "components/vectordbs/dbs/cassandra", - "components/vectordbs/dbs/pgvector", - "components/vectordbs/dbs/milvus", - "components/vectordbs/dbs/pinecone", - "components/vectordbs/dbs/mongodb", - "components/vectordbs/dbs/azure", - "components/vectordbs/dbs/azure_mysql", - "components/vectordbs/dbs/redis", - "components/vectordbs/dbs/valkey", - "components/vectordbs/dbs/elasticsearch", - "components/vectordbs/dbs/opensearch", - "components/vectordbs/dbs/supabase", - "components/vectordbs/dbs/upstash-vector", - "components/vectordbs/dbs/vectorize", - "components/vectordbs/dbs/vertex_ai", - "components/vectordbs/dbs/weaviate", - "components/vectordbs/dbs/faiss", - "components/vectordbs/dbs/langchain", - "components/vectordbs/dbs/baidu", - "components/vectordbs/dbs/s3_vectors", - "components/vectordbs/dbs/databricks", - "components/vectordbs/dbs/neptune_analytics" - ] - } - ] - }, - { - "group": "Embedding Models", - "icon": "layer-group", - "pages": [ - "components/embedders/overview", - "components/embedders/config", - { - "group": "Supported Embedding Models", - "icon": "list", - "pages": [ - "components/embedders/models/openai", - "components/embedders/models/azure_openai", - "components/embedders/models/ollama", - "components/embedders/models/huggingface", - "components/embedders/models/vertexai", - "components/embedders/models/google_AI", - "components/embedders/models/lmstudio", - "components/embedders/models/together", - "components/embedders/models/langchain", - "components/embedders/models/aws_bedrock" - ] - } - ] - }, - { - "group": "Rerankers (New in v1.0)", - "icon": "sort", - "pages": [ - "components/rerankers/overview", - "components/rerankers/config", - { - "group": "Supported Rerankers", - "icon": "list", - "pages": [ - "components/rerankers/models/cohere", - "components/rerankers/models/sentence_transformer", - "components/rerankers/models/huggingface", - "components/rerankers/models/llm_reranker" - ] - } - ] - } - ] - }, - { - "group": "Migration Guide", - "icon": "arrow-right", - "pages": [ - "migration/v0-to-v1", - "migration/breaking-changes", - "migration/api-changes" - ] - }, - { - "group": "OpenMemory", - "icon": "square-terminal", - "pages": [ - "openmemory/overview", - "openmemory/quickstart", - "openmemory/integrations" - ] - }, - { - "group": "Contribution", - "icon": "handshake", - "pages": [ - "contributing/development", - "contributing/documentation" - ] - } - ] - }, - { - "tab": "Examples", - "groups": [ - { - "group": "\ud83d\udca1 Examples", - "icon": "lightbulb", - "pages": [ - "examples", - "examples/mem0-demo", - "examples/ai_companion_js", - "examples/mem0-with-ollama", - "examples/personal-ai-tutor", - "examples/customer-support-agent", - "examples/personal-travel-assistant", - "examples/chrome-extension", - "examples/youtube-assistant", - "examples/memory-guided-content-writing", - "examples/multimodal-demo", - "examples/email_processing", - "examples/personalized-deep-research", - "examples/collaborative-task-agent", - "examples/llama-index-mem0", - "examples/llamaindex-multiagent-learning-system", - "examples/personalized-search-tavily-mem0", - "examples/mem0-agentic-tool", - "examples/openai-inbuilt-tools", - "examples/mem0-openai-voice-demo", - "examples/mem0-google-adk-healthcare-assistant", - "examples/mem0-mastra", - "examples/eliza_os", - "examples/aws_example", - "examples/aws_neptune_analytics_hybrid_store" - ] - } - ] - }, - { - "tab": "Integrations", - "groups": [ - { - "group": "Integrations", - "icon": "plug", - "pages": [ - "integrations", - "integrations/langchain", - "integrations/langgraph", - "integrations/llama-index", - "integrations/agno", - "integrations/autogen", - "integrations/crewai", - "integrations/openai-agents-sdk", - "integrations/google-ai-adk", - "integrations/mastra", - "integrations/vercel-ai-sdk", - "integrations/livekit", - "integrations/pipecat", - "integrations/elevenlabs", - "integrations/aws-bedrock", - "integrations/flowise", - "integrations/langchain-tools", - "integrations/agentops", - "integrations/keywords", - "integrations/dify", - "integrations/raycast" - ] - } - ] - }, - { - "tab": "API Reference", - "icon": "square-terminal", - "groups": [ - { - "group": "API Reference", - "icon": "terminal", - "pages": [ - "api-reference", - { - "group": "Memory APIs", - "icon": "microchip", - "pages": [ - "api-reference/memory/add-memories", - "api-reference/memory/search-memories", - "api-reference/memory/get-memories", - "api-reference/memory/history-memory", - "api-reference/memory/get-memory", - "api-reference/memory/update-memory", - "api-reference/memory/batch-update", - "api-reference/memory/delete-memory", - "api-reference/memory/batch-delete", - "api-reference/memory/delete-memories", - "api-reference/memory/create-memory-export", - "api-reference/memory/get-memory-export", - "api-reference/memory/feedback" - ] - }, - { - "group": "Entities APIs", - "icon": "users", - "pages": [ - "api-reference/entities/get-users", - "api-reference/entities/delete-user" - ] - }, - { - "group": "Organizations APIs", - "icon": "building", - "pages": [ - "api-reference/organization/create-org", - "api-reference/organization/get-orgs", - "api-reference/organization/get-org", - "api-reference/organization/get-org-members", - "api-reference/organization/add-org-member", - "api-reference/organization/delete-org" - ] - }, - { - "group": "Project APIs", - "icon": "folder", - "pages": [ - "api-reference/project/create-project", - "api-reference/project/get-projects", - "api-reference/project/get-project", - "api-reference/project/get-project-members", - "api-reference/project/add-project-member", - "api-reference/project/delete-project" - ] - }, - { - "group": "Webhook APIs", - "icon": "webhook", - "pages": [ - "api-reference/webhook/create-webhook", - "api-reference/webhook/get-webhook", - "api-reference/webhook/update-webhook", - "api-reference/webhook/delete-webhook" - ] - } - ] - } - ] - }, - { - "tab": "Changelog", - "icon": "clock", - "groups": [ - { - "group": "Product Updates", - "icon": "rocket", - "pages": [ - "changelog" - ] - } - ] - } - ] - } - ] - }, - { - "version": "v0.x Legacy", - "anchors": [ - { - "anchor": "Documentation", - "icon": "book-open", - "tabs": [ - { - "tab": "Documentation", - "groups": [ - { - "group": "Getting Started", - "icon": "rocket", - "pages": [ - "v0x/introduction", - "v0x/quickstart", - "v0x/faqs" - ] - }, - { - "group": "Core Concepts", - "icon": "brain", - "pages": [ - "v0x/core-concepts/memory-types", - { - "group": "Memory Operations", - "icon": "gear", - "pages": [ - "v0x/core-concepts/memory-operations/add", - "v0x/core-concepts/memory-operations/search", - "v0x/core-concepts/memory-operations/update", - "v0x/core-concepts/memory-operations/delete" - ] - } - ] - }, - { - "group": "Open Source", - "icon": "code-branch", - "pages": [ - "v0x/open-source/overview", - "v0x/open-source/python-quickstart", - "v0x/open-source/node-quickstart", - { - "group": "LLMs", - "icon": "brain", - "pages": [ - "v0x/components/llms/overview", - "v0x/components/llms/config", - { - "group": "Supported LLMs", - "icon": "list", - "pages": [ - "v0x/components/llms/models/openai", - "v0x/components/llms/models/anthropic", - "v0x/components/llms/models/azure_openai", - "v0x/components/llms/models/ollama", - "v0x/components/llms/models/together", - "v0x/components/llms/models/groq", - "v0x/components/llms/models/litellm", - "v0x/components/llms/models/mistral_AI", - "v0x/components/llms/models/google_AI", - "v0x/components/llms/models/aws_bedrock", - "v0x/components/llms/models/deepseek", - "v0x/components/llms/models/xAI", - "v0x/components/llms/models/sarvam", - "v0x/components/llms/models/lmstudio", - "v0x/components/llms/models/langchain", - "v0x/components/llms/models/vllm" - ] - } - ] - }, - { - "group": "Vector Databases", - "icon": "database", - "pages": [ - "v0x/components/vectordbs/overview", - "v0x/components/vectordbs/config", - { - "group": "Supported Vector Databases", - "icon": "server", - "pages": [ - "v0x/components/vectordbs/dbs/qdrant", - "v0x/components/vectordbs/dbs/chroma", - "v0x/components/vectordbs/dbs/pgvector", - "v0x/components/vectordbs/dbs/milvus", - "v0x/components/vectordbs/dbs/pinecone", - "v0x/components/vectordbs/dbs/mongodb", - "v0x/components/vectordbs/dbs/azure", - "v0x/components/vectordbs/dbs/azure_mysql", - "v0x/components/vectordbs/dbs/redis", - "v0x/components/vectordbs/dbs/valkey", - "v0x/components/vectordbs/dbs/elasticsearch", - "v0x/components/vectordbs/dbs/opensearch", - "v0x/components/vectordbs/dbs/supabase", - "v0x/components/vectordbs/dbs/upstash-vector", - "v0x/components/vectordbs/dbs/vectorize", - "v0x/components/vectordbs/dbs/vertex_ai", - "v0x/components/vectordbs/dbs/weaviate", - "v0x/components/vectordbs/dbs/faiss", - "v0x/components/vectordbs/dbs/langchain", - "v0x/components/vectordbs/dbs/baidu", - "v0x/components/vectordbs/dbs/s3_vectors", - "v0x/components/vectordbs/dbs/databricks", - "v0x/components/vectordbs/dbs/neptune_analytics" - ] - } - ] - }, - { - "group": "Embedding Models", - "icon": "layer-group", - "pages": [ - "v0x/components/embedders/overview", - "v0x/components/embedders/config", - { - "group": "Supported Embedding Models", - "icon": "list", - "pages": [ - "v0x/components/embedders/models/openai", - "v0x/components/embedders/models/azure_openai", - "v0x/components/embedders/models/ollama", - "v0x/components/embedders/models/huggingface", - "v0x/components/embedders/models/vertexai", - "v0x/components/embedders/models/google_AI", - "v0x/components/embedders/models/lmstudio", - "v0x/components/embedders/models/together", - "v0x/components/embedders/models/langchain", - "v0x/components/embedders/models/aws_bedrock" - ] - } - ] - } - ] - } - ] - }, - { - "tab": "Examples", - "groups": [ - { - "group": "\ud83d\udca1 Examples", - "icon": "lightbulb", - "pages": [ - "examples", - "v0x/examples/mem0-demo", - "v0x/examples/ai_companion_js", - "v0x/examples/mem0-with-ollama", - "v0x/examples/personal-ai-tutor", - "v0x/examples/customer-support-agent", - "v0x/examples/personal-travel-assistant", - "v0x/examples/chrome-extension", - "v0x/examples/youtube-assistant", - "v0x/examples/memory-guided-content-writing", - "v0x/examples/multimodal-demo", - "v0x/examples/email_processing", - "v0x/examples/personalized-deep-research", - "v0x/examples/collaborative-task-agent", - "v0x/examples/llama-index-mem0", - "v0x/examples/llamaindex-multiagent-learning-system", - "v0x/examples/personalized-search-tavily-mem0", - "v0x/examples/mem0-agentic-tool", - "v0x/examples/openai-inbuilt-tools", - "v0x/examples/mem0-openai-voice-demo", - "v0x/examples/mem0-google-adk-healthcare-assistant", - "v0x/examples/mem0-mastra", - "v0x/examples/eliza_os", - "v0x/examples/aws_example", - "v0x/examples/aws_neptune_analytics_hybrid_store" - ] - } - ] - }, - { - "tab": "Integrations", - "groups": [ - { - "group": "Integrations", - "icon": "plug", - "pages": [ - "v0x/integrations/langchain", - "v0x/integrations/langgraph", - "v0x/integrations/llama-index", - "v0x/integrations/agno", - "v0x/integrations/autogen", - "v0x/integrations/crewai", - "v0x/integrations/openai-agents-sdk", - "v0x/integrations/google-ai-adk", - "v0x/integrations/mastra", - "v0x/integrations/vercel-ai-sdk", - "v0x/integrations/livekit", - "v0x/integrations/pipecat", - "v0x/integrations/elevenlabs", - "v0x/integrations/aws-bedrock", - "v0x/integrations/flowise", - "v0x/integrations/langchain-tools", - "v0x/integrations/agentops", - "v0x/integrations/keywords", - "v0x/integrations/dify", - "v0x/integrations/raycast" - ] - } - ] - } - ] - } - ] - } - ] - }, - "logo": { - "light": "/logo/light.svg", - "dark": "/logo/dark.svg", - "href": "https://github.com/mem0ai/mem0" - }, - "background": { - "color": { - "light": "#fff", - "dark": "#09090b" - } - }, - "navbar": { - "primary": { - "type": "button", - "label": "Your Dashboard", - "href": "https://app.mem0.ai" - } - }, - "footer": { - "socials": { - "discord": "https://mem0.dev/DiD", - "x": "https://x.com/mem0ai", - "github": "https://github.com/mem0ai", - "linkedin": "https://www.linkedin.com/company/mem0/" - } - }, - "integrations": { - "posthog": { - "apiKey": "phc_hgJkUVJFYtmaJqrvf6CYN67TIQ8yhXAkWzUn9AMU4yX", - "apiHost": "https://mango.mem0.ai" - }, - "intercom": { - "appId": "jjv2r0tt" - } - }, - "redirects": [ - { - "source": "/api-reference/memory/v2-search-memories", - "destination": "/api-reference/memory/search-memories" - }, - { - "source": "/api-reference/memory/v2-get-memories", - "destination": "/api-reference/memory/get-memories" - } - ] + "$schema": "https://mintlify.com/docs.json", + "name": "Mem0", + "description": "Mem0 is a self-improving memory layer for LLM applications, enabling personalized AI experiences that save costs and delight users.", + "theme": "aspen", + "colors": { + "primary": "#9C58FA", + "light": "#9C58FA", + "dark": "#9C58FA" + }, + "favicon": "/logo/favicon.png", + "navigation": { + "versions": [ + { + "version": "v1.0.0", + "anchors": [ + { + "anchor": "Documentation", + "icon": "book-open", + "tabs": [ + { + "tab": "Welcome", + "groups": [ + { + "group": "Start Here", + "icon": "home", + "pages": ["introduction"] + } + ] + }, + { + "tab": "Mem0 Platform", + "groups": [ + { + "group": "Getting Started", + "icon": "rocket", + "pages": [ + "platform/overview", + "platform/platform-vs-oss", + "platform/quickstart" + ] + }, + { + "group": "Core Concepts", + "icon": "brain", + "pages": [ + "core-concepts/memory-types", + "core-concepts/memory-operations/add", + "core-concepts/memory-operations/search", + "core-concepts/memory-operations/update", + "core-concepts/memory-operations/delete" + ] + }, + { + "group": "Platform Features", + "icon": "star", + "pages": [ + "platform/features/platform-overview", + { + "group": "Essential Features", + "icon": "circle-check", + "pages": [ + "platform/features/v2-memory-filters", + "platform/features/async-client", + "platform/features/async-mode-default-change", + "platform/features/multimodal-support", + "platform/features/custom-categories" + ] + }, + { + "group": "Advanced Features", + "icon": "sparkles", + "pages": [ + "platform/features/graph-memory", + "platform/features/graph-threshold", + "platform/features/advanced-retrieval", + "platform/features/criteria-retrieval", + "platform/features/contextual-add", + "platform/features/custom-instructions" + ] + }, + { + "group": "Data Management", + "icon": "database", + "pages": [ + "platform/features/direct-import", + "platform/features/memory-export", + "platform/features/timestamp", + "platform/features/expiration-date" + ] + }, + { + "group": "Integration Features", + "icon": "plug", + "pages": [ + "platform/features/webhooks", + "platform/features/feedback-mechanism", + "platform/features/group-chat" + ] + } + ] + }, + { + "group": "Support & Troubleshooting", + "icon": "life-buoy", + "pages": ["platform/faqs", "platform/advanced-memory-operations"] + }, + { + "group": "Migration Guide", + "icon": "arrow-right", + "pages": [ + "migration/v0-to-v1", + "migration/breaking-changes", + "migration/api-changes" + ] + } + ] + }, + { + "tab": "Open Source", + "groups": [ + { + "group": "Getting Started", + "icon": "rocket", + "pages": [ + "open-source/overview", + "open-source/python-quickstart", + "open-source/node-quickstart" + ] + }, + { + "group": "Self-Hosting Features", + "icon": "server", + "pages": [ + "open-source/features/overview", + "open-source/features/async-memory", + "open-source/features/openai_compatibility", + "open-source/features/custom-fact-extraction-prompt", + "open-source/features/custom-update-memory-prompt", + "open-source/features/multimodal-support", + "open-source/features/rest-api", + "open-source/features/metadata-filtering", + "open-source/features/reranking", + "open-source/features/reranker-search" + ] + }, + { + "group": "Graph Memory", + "icon": "network-wired", + "pages": [ + "open-source/graph_memory/overview", + "open-source/graph_memory/features" + ] + }, + { + "group": "Configuration", + "icon": "sliders", + "pages": [ + "open-source/configuration", + { + "group": "LLMs", + "icon": "message-bot", + "pages": [ + "components/llms/overview", + "components/llms/config", + { + "group": "Supported LLMs", + "icon": "list", + "pages": [ + "components/llms/models/openai", + "components/llms/models/anthropic", + "components/llms/models/azure_openai", + "components/llms/models/ollama", + "components/llms/models/together", + "components/llms/models/groq", + "components/llms/models/litellm", + "components/llms/models/mistral_AI", + "components/llms/models/google_AI", + "components/llms/models/aws_bedrock", + "components/llms/models/deepseek", + "components/llms/models/xAI", + "components/llms/models/sarvam", + "components/llms/models/lmstudio", + "components/llms/models/langchain", + "components/llms/models/vllm" + ] + } + ] + }, + { + "group": "Vector Databases", + "icon": "hard-drive", + "pages": [ + "components/vectordbs/overview", + "components/vectordbs/config", + { + "group": "Supported Vector Databases", + "icon": "list", + "pages": [ + "components/vectordbs/dbs/qdrant", + "components/vectordbs/dbs/chroma", + "components/vectordbs/dbs/pgvector", + "components/vectordbs/dbs/milvus", + "components/vectordbs/dbs/pinecone", + "components/vectordbs/dbs/mongodb", + "components/vectordbs/dbs/azure", + "components/vectordbs/dbs/azure_mysql", + "components/vectordbs/dbs/redis", + "components/vectordbs/dbs/valkey", + "components/vectordbs/dbs/elasticsearch", + "components/vectordbs/dbs/opensearch", + "components/vectordbs/dbs/supabase", + "components/vectordbs/dbs/upstash-vector", + "components/vectordbs/dbs/vectorize", + "components/vectordbs/dbs/vertex_ai", + "components/vectordbs/dbs/weaviate", + "components/vectordbs/dbs/faiss", + "components/vectordbs/dbs/langchain", + "components/vectordbs/dbs/baidu", + "components/vectordbs/dbs/cassandra", + "components/vectordbs/dbs/s3_vectors", + "components/vectordbs/dbs/databricks", + "components/vectordbs/dbs/neptune_analytics" + ] + } + ] + }, + { + "group": "Embedding Models", + "icon": "cube", + "pages": [ + "components/embedders/overview", + "components/embedders/config", + { + "group": "Supported Embedding Models", + "icon": "list", + "pages": [ + "components/embedders/models/openai", + "components/embedders/models/azure_openai", + "components/embedders/models/ollama", + "components/embedders/models/huggingface", + "components/embedders/models/vertexai", + "components/embedders/models/google_AI", + "components/embedders/models/lmstudio", + "components/embedders/models/together", + "components/embedders/models/langchain", + "components/embedders/models/aws_bedrock" + ] + } + ] + }, + { + "group": "Rerankers", + "icon": "ranking-star", + "pages": [ + "components/rerankers/overview", + "components/rerankers/config", + { + "group": "Supported Rerankers", + "icon": "list", + "pages": [ + "components/rerankers/models/cohere", + "components/rerankers/models/sentence_transformer", + "components/rerankers/models/huggingface", + "components/rerankers/models/llm_reranker", + "components/rerankers/models/llm", + "components/rerankers/models/zero_entropy" + ] + }, + "components/rerankers/optimization", + "components/rerankers/custom-prompts" + ] + } + ] + }, + { + "group": "Community & Support", + "icon": "users", + "pages": ["contributing/development", "contributing/documentation"] + } + ] + }, + { + "tab": "OpenMemory", + "groups": [ + { + "group": "Overview & Quickstart", + "icon": "square-terminal", + "pages": [ + "openmemory/overview", + "openmemory/quickstart", + "openmemory/integrations" + ] + } + ] + }, + { + "tab": "Cookbooks", + "groups": [ + { + "group": "Overview", + "icon": "lightbulb", + "pages": ["examples"] + }, + { + "group": "Getting Started Examples", + "icon": "play", + "pages": [ + "examples/mem0-demo", + "examples/ai_companion_js", + "examples/mem0-with-ollama", + "examples/personal-ai-tutor" + ] + }, + { + "group": "Production Use Cases", + "icon": "briefcase", + "pages": [ + "examples/customer-support-agent", + "examples/personal-travel-assistant", + "examples/email_processing", + "examples/memory-guided-content-writing", + "examples/personalized-deep-research" + ] + }, + { + "group": "Framework Integrations", + "icon": "puzzle-piece", + "pages": [ + "examples/llama-index-mem0", + "examples/llamaindex-multiagent-learning-system", + "examples/personalized-search-tavily-mem0", + "examples/mem0-agentic-tool", + "examples/mem0-mastra", + "examples/eliza_os" + ] + }, + { + "group": "Specialized Features", + "icon": "wand-magic-sparkles", + "pages": [ + "examples/multimodal-demo", + "examples/mem0-openai-voice-demo", + "examples/mem0-google-adk-healthcare-assistant", + "examples/collaborative-task-agent" + ] + }, + { + "group": "Extensions & Tools", + "icon": "wrench", + "pages": [ + "examples/chrome-extension", + "examples/youtube-assistant", + "examples/openai-inbuilt-tools" + ] + }, + { + "group": "Cloud & Infrastructure", + "icon": "cloud", + "pages": ["examples/aws_example", "examples/aws_neptune_analytics_hybrid_store"] + } + ] + }, + { + "tab": "Integrations", + "groups": [ + { + "group": "Overview", + "icon": "plug", + "pages": ["integrations"] + }, + { + "group": "Agent Frameworks", + "icon": "robot", + "pages": [ + "integrations/langchain", + "integrations/langgraph", + "integrations/llama-index", + "integrations/crewai", + "integrations/autogen", + "integrations/agno", + "integrations/openai-agents-sdk", + "integrations/google-ai-adk", + "integrations/mastra", + "integrations/vercel-ai-sdk" + ] + }, + { + "group": "Voice & Real-time", + "icon": "microphone", + "pages": [ + "integrations/livekit", + "integrations/pipecat", + "integrations/elevenlabs" + ] + }, + { + "group": "Cloud & Infrastructure", + "icon": "cloud", + "pages": ["integrations/aws-bedrock"] + }, + { + "group": "Developer Tools", + "icon": "wrench", + "pages": [ + "integrations/dify", + "integrations/flowise", + "integrations/langchain-tools", + "integrations/agentops", + "integrations/keywords", + "integrations/raycast" + ] + } + ] + }, + { + "tab": "API Reference", + "groups": [ + { + "group": "Getting Started", + "icon": "rocket", + "pages": ["api-reference", "api-reference/organizations-projects"] + }, + { + "group": "Core Memory Operations", + "icon": "microchip", + "pages": [ + "api-reference/memory/add-memories", + "api-reference/memory/search-memories", + "api-reference/memory/get-memories", + "api-reference/memory/update-memory", + "api-reference/memory/delete-memory" + ] + }, + { + "group": "Advanced Memory APIs", + "icon": "sparkles", + "pages": [ + "api-reference/memory/history-memory", + "api-reference/memory/get-memory", + "api-reference/memory/batch-update", + "api-reference/memory/batch-delete", + "api-reference/memory/delete-memories", + "api-reference/memory/create-memory-export", + "api-reference/memory/get-memory-export", + "api-reference/memory/feedback" + ] + }, + { + "group": "Entities APIs", + "icon": "users", + "pages": [ + "api-reference/entities/get-users", + "api-reference/entities/delete-user" + ] + }, + { + "group": "Organizations APIs", + "icon": "building", + "pages": [ + "api-reference/organization/create-org", + "api-reference/organization/get-orgs", + "api-reference/organization/get-org", + "api-reference/organization/get-org-members", + "api-reference/organization/add-org-member", + "api-reference/organization/delete-org" + ] + }, + { + "group": "Project APIs", + "icon": "folder", + "pages": [ + "api-reference/project/create-project", + "api-reference/project/get-projects", + "api-reference/project/get-project", + "api-reference/project/get-project-members", + "api-reference/project/add-project-member", + "api-reference/project/delete-project" + ] + }, + { + "group": "Webhook APIs", + "icon": "webhook", + "pages": [ + "api-reference/webhook/create-webhook", + "api-reference/webhook/get-webhook", + "api-reference/webhook/update-webhook", + "api-reference/webhook/delete-webhook" + ] + } + ], + "icon": "square-terminal" + }, + { + "tab": "Release Notes", + "groups": [ + { + "group": "Changelog", + "icon": "rocket", + "pages": ["changelog"] + }, + { + "group": "Legacy Docs", + "icon": "archive", + "pages": ["v0x/introduction"] + } + ], + "icon": "clock" + } + ] + } + ] + }, + { + "version": "v0.x Legacy", + "anchors": [ + { + "anchor": "Documentation", + "icon": "book-open", + "tabs": [ + { + "tab": "Documentation", + "groups": [ + { + "group": "Getting Started", + "icon": "rocket", + "pages": ["v0x/introduction", "v0x/quickstart", "v0x/faqs"] + }, + { + "group": "Core Concepts", + "icon": "brain", + "pages": [ + "v0x/core-concepts/memory-types", + { + "group": "Memory Operations", + "icon": "gear", + "pages": [ + "v0x/core-concepts/memory-operations/add", + "v0x/core-concepts/memory-operations/search", + "v0x/core-concepts/memory-operations/update", + "v0x/core-concepts/memory-operations/delete" + ] + } + ] + }, + { + "group": "Open Source", + "icon": "code-branch", + "pages": [ + "v0x/open-source/overview", + "v0x/open-source/python-quickstart", + "v0x/open-source/node-quickstart", + { + "group": "LLMs", + "icon": "brain", + "pages": [ + "v0x/components/llms/overview", + "v0x/components/llms/config", + { + "group": "Supported LLMs", + "icon": "list", + "pages": [ + "v0x/components/llms/models/openai", + "v0x/components/llms/models/anthropic", + "v0x/components/llms/models/azure_openai", + "v0x/components/llms/models/ollama", + "v0x/components/llms/models/together", + "v0x/components/llms/models/groq", + "v0x/components/llms/models/litellm", + "v0x/components/llms/models/mistral_AI", + "v0x/components/llms/models/google_AI", + "v0x/components/llms/models/aws_bedrock", + "v0x/components/llms/models/deepseek", + "v0x/components/llms/models/xAI", + "v0x/components/llms/models/sarvam", + "v0x/components/llms/models/lmstudio", + "v0x/components/llms/models/langchain", + "v0x/components/llms/models/vllm" + ] + } + ] + }, + { + "group": "Vector Databases", + "icon": "database", + "pages": [ + "v0x/components/vectordbs/overview", + "v0x/components/vectordbs/config", + { + "group": "Supported Vector Databases", + "icon": "server", + "pages": [ + "v0x/components/vectordbs/dbs/qdrant", + "v0x/components/vectordbs/dbs/chroma", + "v0x/components/vectordbs/dbs/pgvector", + "v0x/components/vectordbs/dbs/milvus", + "v0x/components/vectordbs/dbs/pinecone", + "v0x/components/vectordbs/dbs/mongodb", + "v0x/components/vectordbs/dbs/azure", + "v0x/components/vectordbs/dbs/azure_mysql", + "v0x/components/vectordbs/dbs/redis", + "v0x/components/vectordbs/dbs/valkey", + "v0x/components/vectordbs/dbs/elasticsearch", + "v0x/components/vectordbs/dbs/opensearch", + "v0x/components/vectordbs/dbs/supabase", + "v0x/components/vectordbs/dbs/upstash-vector", + "v0x/components/vectordbs/dbs/vectorize", + "v0x/components/vectordbs/dbs/vertex_ai", + "v0x/components/vectordbs/dbs/weaviate", + "v0x/components/vectordbs/dbs/faiss", + "v0x/components/vectordbs/dbs/langchain", + "v0x/components/vectordbs/dbs/baidu", + "v0x/components/vectordbs/dbs/s3_vectors", + "v0x/components/vectordbs/dbs/databricks", + "v0x/components/vectordbs/dbs/neptune_analytics" + ] + } + ] + }, + { + "group": "Embedding Models", + "icon": "layer-group", + "pages": [ + "v0x/components/embedders/overview", + "v0x/components/embedders/config", + { + "group": "Supported Embedding Models", + "icon": "list", + "pages": [ + "v0x/components/embedders/models/openai", + "v0x/components/embedders/models/azure_openai", + "v0x/components/embedders/models/ollama", + "v0x/components/embedders/models/huggingface", + "v0x/components/embedders/models/vertexai", + "v0x/components/embedders/models/google_AI", + "v0x/components/embedders/models/lmstudio", + "v0x/components/embedders/models/together", + "v0x/components/embedders/models/langchain", + "v0x/components/embedders/models/aws_bedrock" + ] + } + ] + } + ] + } + ] + }, + { + "tab": "Examples", + "groups": [ + { + "group": "\ud83d\udca1 Examples", + "icon": "lightbulb", + "pages": [ + "examples", + "v0x/examples/mem0-demo", + "v0x/examples/ai_companion_js", + "v0x/examples/mem0-with-ollama", + "v0x/examples/personal-ai-tutor", + "v0x/examples/customer-support-agent", + "v0x/examples/personal-travel-assistant", + "v0x/examples/chrome-extension", + "v0x/examples/youtube-assistant", + "v0x/examples/memory-guided-content-writing", + "v0x/examples/multimodal-demo", + "v0x/examples/email_processing", + "v0x/examples/personalized-deep-research", + "v0x/examples/collaborative-task-agent", + "v0x/examples/llama-index-mem0", + "v0x/examples/llamaindex-multiagent-learning-system", + "v0x/examples/personalized-search-tavily-mem0", + "v0x/examples/mem0-agentic-tool", + "v0x/examples/openai-inbuilt-tools", + "v0x/examples/mem0-openai-voice-demo", + "v0x/examples/mem0-google-adk-healthcare-assistant", + "v0x/examples/mem0-mastra", + "v0x/examples/eliza_os", + "v0x/examples/aws_example", + "v0x/examples/aws_neptune_analytics_hybrid_store" + ] + } + ] + }, + { + "tab": "Integrations", + "groups": [ + { + "group": "Integrations", + "icon": "plug", + "pages": [ + "v0x/integrations/langchain", + "v0x/integrations/langgraph", + "v0x/integrations/llama-index", + "v0x/integrations/agno", + "v0x/integrations/autogen", + "v0x/integrations/crewai", + "v0x/integrations/openai-agents-sdk", + "v0x/integrations/google-ai-adk", + "v0x/integrations/mastra", + "v0x/integrations/vercel-ai-sdk", + "v0x/integrations/livekit", + "v0x/integrations/pipecat", + "v0x/integrations/elevenlabs", + "v0x/integrations/aws-bedrock", + "v0x/integrations/flowise", + "v0x/integrations/langchain-tools", + "v0x/integrations/agentops", + "v0x/integrations/keywords", + "v0x/integrations/dify", + "v0x/integrations/raycast" + ] + } + ] + } + ] + } + ] + } + ] + }, + "logo": { + "light": "/logo/light.svg", + "dark": "/logo/dark.svg", + "href": "https://github.com/mem0ai/mem0" + }, + "background": { + "color": { + "light": "#fff", + "dark": "#09090b" + } + }, + "navbar": { + "primary": { + "type": "button", + "label": "Your Dashboard", + "href": "https://app.mem0.ai" + } + }, + "footer": { + "socials": { + "discord": "https://mem0.dev/DiD", + "x": "https://x.com/mem0ai", + "github": "https://github.com/mem0ai", + "linkedin": "https://www.linkedin.com/company/mem0/" + } + }, + "integrations": { + "posthog": { + "apiKey": "phc_hgJkUVJFYtmaJqrvf6CYN67TIQ8yhXAkWzUn9AMU4yX", + "apiHost": "https://mango.mem0.ai" + }, + "intercom": { + "appId": "jjv2r0tt" + } + }, + "redirects": [ + { + "source": "/api-reference/memory/v2-search-memories", + "destination": "/api-reference/memory/search-memories" + }, + { + "source": "/api-reference/memory/v2-get-memories", + "destination": "/api-reference/memory/get-memories" + } + ] } diff --git a/docs/introduction.mdx b/docs/introduction.mdx index d374a00f3..3c3796ca2 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -1,116 +1,71 @@ --- -title: Introduction -icon: "book" -iconType: "solid" +title: "Welcome to Mem0" +description: "Memory layer for AI agents" +mode: "custom" --- - -Check out our [research paper](https://mem0.ai/research) to learn about the technical foundations and innovations behind Mem0's memory architecture. - +{/* debug: welcome-layout-v2 */} -Mem0 is a memory layer designed for modern AI agents. It acts as a persistent memory layer that agents can use to: +
+

+ Build with mem0 +

-- Recall relevant past interactions -- Store important user preferences and factual context -- Learn from successes and failures +

+ Universal, Self-improving memory layer for LLM applications. +

-It gives AI agents memory so they can remember, learn, and evolve across interactions. Mem0 integrates easily into your agent stack and scales from prototypes to production systems. + + Write your first memory + → + +
+
+
+

+ Mem0 Products +

+
-## Stateless vs. Stateful Agents + + + Managed memory with production-scale infrastructure, ready in minutes. + -Most current agents are stateless: they process a query, generate a response, and forget everything. Even with huge context windows, everything resets the next session. + + Self-host the Mem0 stack for full control over data, deployment, and customization. + -Stateful agents, powered by Mem0, are different. They retain context, recall what matters, and behave more intelligently over time. + + Workspace-based memory for teams collaborating across agents and projects. + - - - + +
+
+
+

+ Developer Resources +

+
-## Where Memory Fits in the Agent Stack + + + Production-ready tutorials that show how to ship memorable AI experiences. + -Mem0 sits alongside your retriever, planner, and LLM. Unlike retrieval-based systems (like RAG), Mem0 tracks past interactions, stores long-term knowledge, and evolves the agent’s behavior. + + Connect Mem0 to LangChain, CrewAI, Vercel AI SDK, and 20+ partner frameworks. + - - - + + Explore every REST endpoint with payload examples and usage guidance. + -Memory isn't about pushing more tokens into a prompt—it's about intelligently remembering context that matters. This distinction is important: - -| Capability | Context Window | Mem0 Memory | -|------------------|------------------------|-----------------------------| -| Retention | Temporary | Persistent | -| Cost | Grows with input size | Optimized (only what matters) | -| Recall | Token proximity | Relevance + intent-based | -| Personalization | None | Deep, evolving profile | -| Behavior | Reactive | Adaptive | - - -## Memory vs. RAG: Complementary Tools - -RAG (Retrieval-Augmented Generation) is great for fetching facts from documents. But it’s stateless. It doesn’t know who the user is, what they’ve asked before, or what failed last time. - -Mem0 provides continuity. It stores decisions, preferences, and context—not just knowledge. - -| Aspect | RAG | Mem0 Memory | -|--------------------|-------------------------------|-------------------------------| -| Statefulness | Stateless | Stateful | -| Recall Type | Document lookup | Evolving user context | -| Use Case | Ground answers in data | Guide behavior across time | - -Together, they're stronger: RAG informs the LLM while Mem0 shapes its memory. - - -## Types of Memory in Mem0 - -Mem0 supports different types of memory to mimic how humans store information: - -- **Working Memory**: short-term session awareness -- **Factual Memory**: long-term structured knowledge (e.g., preferences, settings) -- **Episodic Memory**: records specific past conversations -- **Semantic Memory**: builds general knowledge over time - - -## Why Developers Choose Mem0 - -Mem0 isn’t a wrapper around a vector store. It’s a full memory engine with: - -- **LLM-based extraction**: Intelligently decides what to remember -- **Filtering & decay**: Avoids memory bloat, forgets irrelevant info -- **Cost Reduction**: Save compute costs with smart prompt injection of only relevant memories -- **Dashboards & APIs**: Observability, fine-grained control -- **Cloud and OSS**: Use our platform version or our open-source SDK version - -Plug Mem0 into your agent framework—it doesn't replace your LLM or workflows. Instead, it adds a smart memory layer on top. - - -## Core Capabilities - -- **Reduced token usage and faster responses**: sub-50 ms lookups -- **Semantic memory**: procedural, episodic, and factual support -- **Multimodal support**: handle both text and images -- **Graph memory**: connect insights and entities across sessions -- **Host your way**: either a managed service or a self-hosted version - - -## Getting Started -Mem0 offers two powerful ways to leverage our technology: our [managed platform](/platform/overview) and our [open source solution](/open-source/overview). - - - - - Integrate Mem0 in a few lines of code - - - Mem0 in action - - - See what you can build with Mem0 - - - -## Need help? -If you have any questions, please feel free to reach out to us using one of the following methods: - - + +
diff --git a/docs/logo/mem0 logo.svg b/docs/logo/mem0 logo.svg new file mode 100644 index 000000000..cf13d0d38 --- /dev/null +++ b/docs/logo/mem0 logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/docs/logo/openmemory-icon.svg b/docs/logo/openmemory-icon.svg new file mode 100644 index 000000000..02ca9d5b4 --- /dev/null +++ b/docs/logo/openmemory-icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/docs/open-source/configuration.mdx b/docs/open-source/configuration.mdx new file mode 100644 index 000000000..aa75f7b1b --- /dev/null +++ b/docs/open-source/configuration.mdx @@ -0,0 +1,336 @@ +--- +title: "Configuration" +description: "Configure Mem0 with custom LLMs, vector stores, embedders, and rerankers for production deployments" +icon: "sliders" +iconType: "solid" +--- + +Mem0 is highly configurable, allowing you to customize every component of your memory system. Choose from **51+ supported providers** across LLMs, vector databases, embedders, and rerankers. + +## Quick Start + +The simplest setup uses OpenAI defaults: + +```python +import os +from mem0 import Memory + +os.environ["OPENAI_API_KEY"] = "your-api-key" +m = Memory() +``` + +For production or custom setups, configure specific components: + +```python +from mem0 import Memory + +config = { + "vector_store": { + "provider": "qdrant", + "config": { + "host": "localhost", + "port": 6333 + } + }, + "llm": { + "provider": "openai", + "config": { + "model": "gpt-4.1-nano-2025-04-14", + "temperature": 0.1 + } + } +} + +m = Memory.from_config(config) +``` + +## Configuration Components + +Mem0 has four configurable components. Click any to see all supported providers and detailed configuration options. + + + +**17 providers** including OpenAI, Anthropic, Ollama, Groq, and more + +Configure the language model for memory extraction and processing + + + + +**25+ databases** including Qdrant, Chroma, Pinecone, Weaviate, and more + +Choose where to store and retrieve memory embeddings + + + + +**9 providers** including OpenAI, HuggingFace, Ollama, and more + +Select the model to convert memories into vector embeddings + + + + +**4 models** including Cohere, Zero Entropy, and LLM-based + +Improve search relevance by re-scoring retrieved memories + + + + +## Configuration Recipes + +### Production Setup with Qdrant + +For production deployments, use a dedicated vector store: + + + +```bash +docker pull qdrant/qdrant + +docker run -p 6333:6333 -p 6334:6334 \ + -v $(pwd)/qdrant_storage:/qdrant/storage:z \ + qdrant/qdrant + +```` + + + +```python +import os +from mem0 import Memory + +os.environ["OPENAI_API_KEY"] = "your-api-key" + +config = { + "vector_store": { + "provider": "qdrant", + "config": { + "host": "localhost", + "port": 6333, + } + } +} + +m = Memory.from_config(config) +```` + + + + +### Fully Local Setup + +Run Mem0 completely offline with Ollama (no external APIs): + + + Step-by-step guide to run Mem0 with local LLM and embeddings + + +### Multi-Cloud Setup + +Mix providers from different clouds: + +```python +config = { + "llm": { + "provider": "azure_openai", + "config": { + "api_key": "azure-key", + "deployment_name": "gpt-4.1-nano-2025-04-14" + } + }, + "vector_store": { + "provider": "pinecone", + "config": { + "api_key": "pinecone-key", + "index_name": "mem0" + } + }, + "embedder": { + "provider": "vertexai", + "config": { + "model": "textembedding-gecko@003" + } + } +} +``` + +### Graph Memory Setup + +Enable relationship tracking with Neo4j: + +```python +config = { + "graph_store": { + "provider": "neo4j", + "config": { + "url": "neo4j+s://your-instance.databases.neo4j.io", + "username": "neo4j", + "password": "your-password" + } + } +} + +m = Memory.from_config(config) +``` + + + Learn how to use graph memory for relationship-based retrieval + + +## Advanced Configuration + +### Custom Prompts + +Override default prompts for memory processing: + +```python +config = { + "custom_fact_extraction_prompt": """ + Extract key facts from the conversation. + Focus on: preferences, decisions, and context. + Output as a single sentence. + """, + "custom_update_memory_prompt": """ + Update the existing memory with new information. + Preserve important context from the old memory. + """ +} +``` + + + +Customize how memories are extracted from conversations + + + +Control how existing memories are modified + + + +### Reranking for Better Search + +Add reranking to improve search relevance: + +```python +config = { + "rerank": { + "provider": "cohere", + "config": { + "model": "rerank-english-v3.0", + "top_k": 5 + } + } +} +``` + + + Learn how reranking improves memory search accuracy + + +### History Database + +Configure where operation history is stored: + +```python +config = { + "history_db_path": "/custom/path/to/history.db" +} +``` + +## All Configuration Options + + + +| Parameter | Description | Provider | +|-----------------------|-----------------------------------------------|-------------------| +| `provider` | LLM provider (e.g., "openai", "anthropic") | All | +| `model` | Model to use | All | +| `temperature` | Temperature of the model (0.0-2.0) | All | +| `api_key` | API key to use | Most | +| `max_tokens` | Maximum tokens to generate | All | +| `top_p` | Nucleus sampling threshold | All | +| `top_k` | Top-k sampling parameter | Some | +| `ollama_base_url` | Base URL for Ollama API | Ollama | +| `openai_base_url` | Base URL for OpenAI API | OpenAI | +| `azure_kwargs` | Azure-specific initialization args | Azure OpenAI | + +**See all 17 LLM providers:** [LLMs Overview](/components/llms/overview) + + + + +Common parameters (provider-specific options vary): + +| Parameter | Description | Example | +| ----------------- | -------------------------- | ----------- | +| `provider` | Vector store provider | "qdrant" | +| `host` | Host address | "localhost" | +| `port` | Port number | 6333 | +| `collection_name` | Collection/index name | "memories" | +| `api_key` | API key (for cloud stores) | "your-key" | + +**See all 25+ vector stores:** [Vector Databases Overview](/components/vectordbs/overview) + + + + +| Parameter | Description | Default | +|-------------|---------------------------------|------------------------------| +| `provider` | Embedding provider | "openai" | +| `model` | Embedding model to use | "text-embedding-3-small" | +| `api_key` | API key for embedding service | None | + +**See all 9 embedder providers:** [Embedders Overview](/components/embedders/overview) + + + + +| Parameter | Description | Example | +|-------------|---------------------------------|------------------------------| +| `provider` | Reranker provider | "cohere" | +| `model` | Reranker model to use | "rerank-english-v3.0" | +| `top_k` | Number of results to return | 5 | +| `api_key` | API key for reranker service | "your-key" | + +**See all reranker options:** [Rerankers Overview](/components/rerankers/overview) + + + + +| Parameter | Description | Example | +|-------------|---------------------------------|------------------------------| +| `provider` | Graph store provider | "neo4j" | +| `url` | Connection URL | "neo4j+s://..." | +| `username` | Authentication username | "neo4j" | +| `password` | Authentication password | "your-password" | + +**Learn more:** [Graph Memory Overview](/open-source/graph_memory/overview) + + + + +| Parameter | Description | Default | +|------------------|--------------------------------------|----------------------------| +| `history_db_path` | Path to the history database | "{mem0_dir}/history.db" | +| `custom_fact_extraction_prompt` | Custom prompt for memory extraction | None | +| `custom_update_memory_prompt` | Custom prompt for memory updates | None | + + + +## Next Steps + + + +Get started with the Python SDK + + + + Explore OSS-specific capabilities + + + +See configuration examples in action + + diff --git a/docs/open-source/features/async-memory.mdx b/docs/open-source/features/async-memory.mdx index 59b9f12a7..4cadb341f 100644 --- a/docs/open-source/features/async-memory.mdx +++ b/docs/open-source/features/async-memory.mdx @@ -1,8 +1,6 @@ --- title: Async Memory description: 'Asynchronous memory for Mem0' -icon: "bolt" -iconType: "solid" --- ## AsyncMemory diff --git a/docs/open-source/features/custom-fact-extraction-prompt.mdx b/docs/open-source/features/custom-fact-extraction-prompt.mdx index e9ebb6036..8ac5c44e8 100644 --- a/docs/open-source/features/custom-fact-extraction-prompt.mdx +++ b/docs/open-source/features/custom-fact-extraction-prompt.mdx @@ -1,8 +1,6 @@ --- title: Custom Fact Extraction Prompt description: 'Enhance your product experience by adding custom fact extraction prompt tailored to your needs' -icon: "pencil" -iconType: "solid" --- ## Introduction to Custom Fact Extraction Prompt diff --git a/docs/open-source/features/custom-update-memory-prompt.mdx b/docs/open-source/features/custom-update-memory-prompt.mdx index 1628a42ed..81d1c5703 100644 --- a/docs/open-source/features/custom-update-memory-prompt.mdx +++ b/docs/open-source/features/custom-update-memory-prompt.mdx @@ -1,7 +1,6 @@ --- title: Custom Update Memory Prompt -icon: "pencil" -iconType: "solid" +description: 'Control memory update actions with a custom prompt' --- @@ -234,4 +233,4 @@ The prompt needs to guide the output to follow the structure as shown below: |---------|-------------------------------|-----------------| | Use case | Determine the action to be performed on the memory | Extract facts from messages | | Reference | Retrieved facts from messages and old memory | Messages | -| Output | Action to be performed on the memory | Extracted facts | \ No newline at end of file +| Output | Action to be performed on the memory | Extracted facts | diff --git a/docs/open-source/features/metadata-filtering.mdx b/docs/open-source/features/metadata-filtering.mdx index 423f4bcd3..686e48acb 100644 --- a/docs/open-source/features/metadata-filtering.mdx +++ b/docs/open-source/features/metadata-filtering.mdx @@ -1,8 +1,6 @@ --- title: Enhanced Metadata Filtering description: 'Advanced filtering capabilities for precise memory retrieval in Mem0 1.0.0 ' -icon: "filter" -iconType: "solid" --- @@ -386,4 +384,4 @@ results = m.search( Enhanced metadata filtering provides powerful capabilities for precise memory retrieval. Start with simple filters and gradually adopt more complex patterns as needed. - \ No newline at end of file + diff --git a/docs/open-source/features/multimodal-support.mdx b/docs/open-source/features/multimodal-support.mdx index cf83fd717..138c32fa2 100644 --- a/docs/open-source/features/multimodal-support.mdx +++ b/docs/open-source/features/multimodal-support.mdx @@ -1,8 +1,6 @@ --- title: Multimodal Support description: Integrate images into your interactions with Mem0 -icon: "image" -iconType: "solid" --- Mem0 extends its capabilities beyond text by supporting multimodal data. With this feature, you can seamlessly integrate images into your interactions—allowing Mem0 to extract relevant information and context from visual content. diff --git a/docs/open-source/features/openai_compatibility.mdx b/docs/open-source/features/openai_compatibility.mdx index d8cc45b39..a25f1082a 100644 --- a/docs/open-source/features/openai_compatibility.mdx +++ b/docs/open-source/features/openai_compatibility.mdx @@ -1,7 +1,6 @@ --- title: OpenAI Compatibility -icon: "code" -iconType: "solid" +description: 'Integrate Mem0 using OpenAI-compatible client APIs' --- Mem0 can be easily integrated into chat applications to enhance conversational agents with structured memory. Mem0's APIs are designed to be compatible with OpenAI's, with the goal of making it easy to leverage Mem0 in applications you may have already built. diff --git a/docs/open-source/features/overview.mdx b/docs/open-source/features/overview.mdx index 506e52d04..b4522552c 100644 --- a/docs/open-source/features/overview.mdx +++ b/docs/open-source/features/overview.mdx @@ -1,8 +1,6 @@ --- title: Overview description: 'Build powerful AI applications with self-improving memory using Mem0 open-source' -icon: "eye" -iconType: "solid" --- ## Welcome to Mem0 Open Source diff --git a/docs/open-source/features/reranker-search.mdx b/docs/open-source/features/reranker-search.mdx index 5608b4fc4..6ef34fdb5 100644 --- a/docs/open-source/features/reranker-search.mdx +++ b/docs/open-source/features/reranker-search.mdx @@ -1,8 +1,6 @@ --- title: Reranker-Enhanced Search description: 'Improve search relevance with reranking models in Mem0 1.0.0 ' -icon: "sort" -iconType: "solid" --- @@ -415,4 +413,4 @@ results = m.search("query", user_id="alice") # Automatically reranked Reranker-enhanced search significantly improves result relevance. Start with a local model and upgrade to API-based solutions as your needs grow. - \ No newline at end of file + diff --git a/docs/open-source/features/reranking.mdx b/docs/open-source/features/reranking.mdx index b794604c4..6df935a6e 100644 --- a/docs/open-source/features/reranking.mdx +++ b/docs/open-source/features/reranking.mdx @@ -1,8 +1,6 @@ --- title: Reranking description: 'Improve memory search relevance with advanced reranking capabilities' -icon: "arrow-up-arrow-down" -iconType: "solid" --- ## Overview @@ -127,4 +125,4 @@ results = memory.search("query", user_id="alice", rerank=False) - 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 \ No newline at end of file +- See [Async Memory](./async-memory) for non-blocking reranking operations diff --git a/docs/open-source/features/rest-api.mdx b/docs/open-source/features/rest-api.mdx index 69e550a11..72c6f97a5 100644 --- a/docs/open-source/features/rest-api.mdx +++ b/docs/open-source/features/rest-api.mdx @@ -1,7 +1,6 @@ --- title: REST API Server -icon: "server" -iconType: "solid" +description: 'Reach every Mem0 capability through a FastAPI-powered REST server' --- Mem0 provides a REST API server (written using FastAPI). Users can perform all operations through REST endpoints. The API also includes OpenAPI documentation, accessible at `/docs` when the server is running. diff --git a/docs/open-source/graph_memory/features.mdx b/docs/open-source/graph_memory/features.mdx index 3357fde2e..41800e6c5 100644 --- a/docs/open-source/graph_memory/features.mdx +++ b/docs/open-source/graph_memory/features.mdx @@ -1,7 +1,7 @@ --- title: Features description: 'Graph Memory features' -icon: "list-check" +icon: "sparkles" iconType: "solid" --- diff --git a/docs/open-source/graph_memory/overview.mdx b/docs/open-source/graph_memory/overview.mdx index 3b21382cb..126d4acb0 100644 --- a/docs/open-source/graph_memory/overview.mdx +++ b/docs/open-source/graph_memory/overview.mdx @@ -1,7 +1,7 @@ --- title: Overview description: 'Enhance your memory system with graph-based knowledge representation and retrieval' -icon: "info" +icon: "network-wired" iconType: "solid" --- diff --git a/docs/open-source/overview.mdx b/docs/open-source/overview.mdx index 9d990e1aa..ea32abab3 100644 --- a/docs/open-source/overview.mdx +++ b/docs/open-source/overview.mdx @@ -1,28 +1,86 @@ --- -title: Overview -icon: "eye" +title: "Overview" +icon: "code-branch" iconType: "solid" +description: "Self-host Mem0 with full control over your infrastructure and data" --- -Welcome to Mem0 Open Source, a powerful, self-hosted memory management solution for AI agents and assistants. With Mem0 OSS, you get full control over your infrastructure while maintaining complete customization flexibility. + +**Mem0 v1.0.0 is now available** — Introducing rerankers, async by default, Azure support, and more. [View changelog →](/changelog) + -We offer two SDKs: Python and Node.js. +## Self-Host Mem0 with Full Control -Check out our [GitHub repository](https://mem0.dev/gd) to explore the source code. +Mem0 Open Source gives you a powerful, self-hosted memory layer for AI agents. Deploy on your infrastructure, customize every component, and maintain complete data ownership. + +## Get Started + +Choose your preferred SDK and get Mem0 running locally in minutes: - - Learn more about Mem0 OSS Python SDK - - - Learn more about Mem0 OSS Node.js SDK - + + Install and configure Mem0 OSS with Python in 10 minutes + + + + Set up Mem0 OSS with Node.js and TypeScript support + -## Key Features +## Explore OSS Capabilities -- **Full Infrastructure Control**: Host Mem0 on your own servers. -- **Customizable Implementation**: Modify and extend functionality as needed. -- **Local Development**: Perfect for development and testing. -- **No Vendor Lock-in**: Own your data and infrastructure. -- **Community Driven**: Benefit from and contribute to community improvements. +Mem0 Open Source offers powerful features for building production-grade AI applications with memory. From graph-based knowledge structures to flexible component configuration, you have full control over how memory works in your system. + + + + Build relationship-aware memory with knowledge graph capabilities + + + + Choose your LLM, vector database, embedding model, and rerankers + + + + Build high-throughput pipelines with async clients and REST endpoints + + + + +**Platform vs OSS?** See our [comparison guide](/platform/platform-vs-oss) to understand which deployment option fits your use case. + + +--- + +## Why Choose Open Source? + +| Benefit | What You Get | +|---------|--------------| +| **Full Infrastructure Control** | Host on your own servers with complete access to configuration and deployment | +| **Complete Customization** | Modify implementation, extend functionality, and adapt to your specific needs | +| **Local Development** | Perfect for development, testing, and air-gapped environments | +| **No Vendor Lock-in** | Own your data, choose your stack, and maintain full independence | +| **Community Driven** | Contribute to and benefit from active community improvements and integrations | + + +**Looking for production scale?** [Mem0 Platform](/platform/overview) offers managed infrastructure with advanced features like webhooks, multimodal support, and enterprise support. + + + +**Need help?** Check out our [GitHub repository](https://mem0.dev/gd) for source code, issues, and community discussions. + + +--- + +## Default Components + + +**No configuration needed to get started.** Mem0 works out of the box with sensible defaults: + +- **LLM**: OpenAI `gpt-4.1-nano-2025-04-14` via your `OPENAI_API_KEY` +- **Embeddings**: OpenAI `text-embedding-3-small` (1536 dimensions) +- **Vector store**: Local Qdrant instance storing data at `/tmp/qdrant` +- **History storage**: SQLite database at `~/.mem0/history.db` +- **Reranker**: Disabled unless you configure one + +Override any component with [`Memory.from_config`](/open-source/configuration). + diff --git a/docs/open-source/python-quickstart.mdx b/docs/open-source/python-quickstart.mdx index 79aebc1ca..131f9f1f2 100644 --- a/docs/open-source/python-quickstart.mdx +++ b/docs/open-source/python-quickstart.mdx @@ -1,546 +1,95 @@ --- title: Python SDK Quickstart -description: 'Get started with Mem0 quickly!' +description: "Get started with Mem0 quickly!" icon: "python" iconType: "solid" --- -> Welcome to the Mem0 quickstart guide. This guide will help you get up and running with Mem0 in no time. +Get started with Mem0's Python SDK in under 5 minutes. This guide shows you how to install Mem0 and store your first memory. + +## Prerequisites + +- Python 3.10 or higher +- OpenAI API key ([Get one here](https://platform.openai.com/api-keys)) ## Installation -To install Mem0, you can use pip. Run the following command in your terminal: - + + ```bash pip install mem0ai ``` + -## Basic Usage - -### Initialize Mem0 - - - + ```python -import os from mem0 import Memory -os.environ["OPENAI_API_KEY"] = "your-api-key" - -m = Memory() +m = Memory(api_key="your-openai-api-key") ``` - - + + + ```python -import os -from mem0 import AsyncMemory - -os.environ["OPENAI_API_KEY"] = "your-api-key" - -m = AsyncMemory() -``` - - -If you want to run Mem0 in production, initialize using the following method: - -Run Qdrant first: - -```bash -docker pull qdrant/qdrant - -docker run -p 6333:6333 -p 6334:6334 \ - -v $(pwd)/qdrant_storage:/qdrant/storage:z \ - qdrant/qdrant -``` - -Then, instantiate memory with qdrant server: - -```python -import os -from mem0 import Memory - -os.environ["OPENAI_API_KEY"] = "your-api-key" - -config = { - "vector_store": { - "provider": "qdrant", - "config": { - "host": "localhost", - "port": 6333, - } - }, -} - -m = Memory.from_config(config) -``` - - - - -```python -import os -from mem0 import Memory - -os.environ["OPENAI_API_KEY"] = "your-api-key" - -config = { - "graph_store": { - "provider": "neo4j", - "config": { - "url": "neo4j+s://---", - "username": "neo4j", - "password": "---" - } - } -} - -m = Memory.from_config(config_dict=config) -``` - - - - - -### Store a Memory - - -```python Code messages = [ - {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, - {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, - {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."}, - {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} + {"role": "user", "content": "Hi, I'm Alex. I love basketball and gaming."}, + {"role": "assistant", "content": "Hey Alex! I'll remember your interests."} ] +m.add(messages, user_id="alex") +``` + -# Store inferred memories (default behavior) -result = m.add(messages, user_id="alice", metadata={"category": "movie_recommendations"}) - -# Store memories with agent and run context -result = m.add(messages, user_id="alice", agent_id="movie-assistant", run_id="session-001", metadata={"category": "movie_recommendations"}) - -# Store raw messages without inference -# result = m.add(messages, user_id="alice", metadata={"category": "movie_recommendations"}, infer=False) + +```python +results = m.search("What do you know about me?", filters={"user_id": "alex"}) +print(results) ``` -```json Output -{ - "results": [ - { - "id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "memory": "User is planning to watch a movie tonight.", - "metadata": { - "category": "movie_recommendations" - }, - "event": "ADD" - }, - { - "id": "cbb1fe73-0bf1-4067-8c1f-63aa53e7b1a4", - "memory": "User is not a big fan of thriller movies.", - "metadata": { - "category": "movie_recommendations" - }, - "event": "ADD" - }, - { - "id": "475bde34-21e6-42ab-8bef-0ab84474f156", - "memory": "User loves sci-fi movies.", - "metadata": { - "category": "movie_recommendations" - }, - "event": "ADD" - } - ] -} -``` - - -### Retrieve Memories - - -```python Code -# Get all memories -all_memories = m.get_all(user_id="alice") -``` - -```json Output -{ - "results": [ - { - "id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "memory": "User is planning to watch a movie tonight.", - "hash": "1a271c007316c94377175ee80e746a19", - "created_at": "2025-02-27T16:33:20.557Z", - "updated_at": "2025-02-27T16:33:27.051Z", - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" - }, - { - "id": "475bde34-21e6-42ab-8bef-0ab84474f156", - "memory": "User loves sci-fi movies.", - "hash": "285d07801ae42054732314853e9eadd7", - "created_at": "2025-02-27T16:33:20.560Z", - "updated_at": None, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" - }, - { - "id": "cbb1fe73-0bf1-4067-8c1f-63aa53e7b1a4", - "memory": "User is not a big fan of thriller movies.", - "hash": "285d07801ae42054732314853e9eadd7", - "created_at": "2025-02-27T16:33:20.560Z", - "updated_at": None, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" - } - ] -} -``` - - - -
- - -```python Code -# Get a single memory by ID -specific_memory = m.get("892db2ae-06d9-49e5-8b3e-585ef9b85b8e") -``` - -```json Output -{ - "id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "memory": "User is planning to watch a movie tonight.", - "hash": "1a271c007316c94377175ee80e746a19", - "created_at": "2025-02-27T16:33:20.557Z", - "updated_at": None, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" -} -``` - - -### Search Memories - - -```python Code -related_memories = m.search(query="What do you know about me?", user_id="alice") -``` - -```json Output +**Output:** +```json { "results": [ { - "id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "memory": "User is planning to watch a movie tonight.", - "hash": "1a271c007316c94377175ee80e746a19", - "created_at": "2025-02-27T16:33:20.557Z", - "updated_at": None, - "score": 0.38920719231944799, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" - }, - { - "id": "475bde34-21e6-42ab-8bef-0ab84474f156", - "memory": "User loves sci-fi movies.", - "hash": "285d07801ae42054732314853e9eadd7", - "created_at": "2025-02-27T16:33:20.560Z", - "updated_at": None, - "score": 0.36869761478135689, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" - }, - { - "id": "cbb1fe73-0bf1-4067-8c1f-63aa53e7b1a4", - "memory": "User is not a big fan of thriller movies.", - "hash": "285d07801ae42054732314853e9eadd7", - "created_at": "2025-02-27T16:33:20.560Z", - "updated_at": None, - "score": 0.33855272141248272, - "metadata": { - "category": "movie_recommendations" - }, - "user_id": "alice" + "id": "mem_123abc", + "memory": "Name is Alex. Enjoys basketball and gaming.", + "user_id": "alex", + "categories": ["personal_info"], + "created_at": "2025-10-22T04:40:22.864647-07:00", + "score": 0.89 } ] } ``` - + +
-### Update a Memory + +By default `Memory()` wires up: +- OpenAI `gpt-4.1-nano-2025-04-14` for fact extraction and updates +- OpenAI `text-embedding-3-small` embeddings (1536 dimensions) +- Qdrant vector store with on-disk data at `/tmp/qdrant` +- SQLite history at `~/.mem0/history.db` +- No reranker (add one in the config when you need it) + - -```python Code -result = m.update(memory_id="892db2ae-06d9-49e5-8b3e-585ef9b85b8e", data="I love India, it is my favorite country.") -``` +## What's Next? -```json Output -{'message': 'Memory updated successfully!'} -``` - + + +Learn how to search, update, and manage memories with full CRUD operations + -### Memory History + +Customize Mem0 with different LLMs, vector stores, and embedders for production use + - -```python Code -history = m.history(memory_id="892db2ae-06d9-49e5-8b3e-585ef9b85b8e") -``` + +Explore async support, graph memory, and multi-agent memory organization + + -```json Output -[ - { - "id": 39, - "memory_id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "previous_value": "User is planning to watch a movie tonight.", - "new_value": "I love India, it is my favorite country.", - "action": "UPDATE", - "created_at": "2025-02-27T16:33:20.557Z", - "updated_at": "2025-02-27T16:33:27.051Z", - "is_deleted": 0 - }, - { - "id": 37, - "memory_id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e", - "previous_value": null, - "new_value": "User is planning to watch a movie tonight.", - "action": "ADD", - "created_at": "2025-02-27T16:33:20.557Z", - "updated_at": null, - "is_deleted": 0 - } -] -``` - +## Additional Resources -### Delete Memory - -```python -# Delete a memory by id -m.delete(memory_id="892db2ae-06d9-49e5-8b3e-585ef9b85b8e") -# Delete all memories for a user -m.delete_all(user_id="alice") -``` - -### Reset Memory - -```python -m.reset() # Reset all memories -``` - -## Advanced Memory Organization - -Mem0 supports three key parameters for organizing memories: - -- **`user_id`**: Organize memories by user identity. -- **`agent_id`**: Organize memories by AI agent or assistant. -- **`run_id`**: Organize memories by session, workflow, or execution context. - -### Using All Three Parameters - -```python -# Store memories with full context -m.add("User prefers vegetarian food", - user_id="alice", - agent_id="diet-assistant", - run_id="consultation-001") - -# Retrieve memories with different scopes -all_user_memories = m.get_all(user_id="alice") -agent_memories = m.get_all(user_id="alice", agent_id="diet-assistant") -session_memories = m.get_all(user_id="alice", run_id="consultation-001") -specific_memories = m.get_all(user_id="alice", agent_id="diet-assistant", run_id="consultation-001") - -# Search with context -general_search = m.search("What do you know about me?", user_id="alice") -agent_search = m.search("What do you know about me?", user_id="alice", agent_id="diet-assistant") -session_search = m.search("What do you know about me?", user_id="alice", run_id="consultation-001") -``` - -## Configuration Parameters - -Mem0 offers extensive configuration options to customize its behavior according to your needs. These configurations span different components like vector stores, language models, embedders, and graph stores. - - - -| Parameter | Description | Default | -|-------------|---------------------------------|-------------| -| `provider` | Vector store provider (e.g., "qdrant") | "qdrant" | -| `host` | Host address | "localhost" | -| `port` | Port number | 6333 | - - - -| Parameter | Description | Provider | -|-----------------------|-----------------------------------------------|-------------------| -| `provider` | LLM provider (e.g., "openai", "anthropic") | All | -| `model` | Model to use | All | -| `temperature` | Temperature of the model | All | -| `api_key` | API key to use | All | -| `max_tokens` | Tokens to generate | All | -| `top_p` | Probability threshold for nucleus sampling | All | -| `top_k` | Number of highest probability tokens to keep | All | -| `http_client_proxies` | Allow proxy server settings | AzureOpenAI | -| `models` | List of models | Openrouter | -| `route` | Routing strategy | Openrouter | -| `openrouter_base_url` | Base URL for Openrouter API | Openrouter | -| `site_url` | Site URL | Openrouter | -| `app_name` | Application name | Openrouter | -| `ollama_base_url` | Base URL for Ollama API | Ollama | -| `openai_base_url` | Base URL for OpenAI API | OpenAI | -| `azure_kwargs` | Azure LLM args for initialization | AzureOpenAI | -| `deepseek_base_url` | Base URL for DeepSeek API | DeepSeek | - - - -| Parameter | Description | Default | -|-------------|---------------------------------|------------------------------| -| `provider` | Embedding provider | "openai" | -| `model` | Embedding model to use | "text-embedding-3-small" | -| `api_key` | API key for embedding service | None | - - - -| Parameter | Description | Default | -|-------------|---------------------------------|-------------| -| `provider` | Graph store provider (e.g., "neo4j") | "neo4j" | -| `url` | Connection URL | None | -| `username` | Authentication username | None | -| `password` | Authentication password | None | - - - -| Parameter | Description | Default | -|------------------|--------------------------------------|----------------------------| -| `history_db_path` | Path to the history database | "{mem0_dir}/history.db" | -| `version` | API version | "v1.1" | -| `custom_fact_extraction_prompt` | Custom prompt for memory processing | None | -| `custom_update_memory_prompt` | Custom prompt for memory updates | None | - - - -```python -config = { - "vector_store": { - "provider": "qdrant", - "config": { - "host": "localhost", - "port": 6333 - } - }, - "llm": { - "provider": "openai", - "config": { - "api_key": "your-api-key", - "model": "gpt-4" - } - }, - "embedder": { - "provider": "openai", - "config": { - "api_key": "your-api-key", - "model": "text-embedding-3-small" - } - }, - "graph_store": { - "provider": "neo4j", - "config": { - "url": "neo4j+s://your-instance", - "username": "neo4j", - "password": "password" - } - }, - "history_db_path": "/path/to/history.db", - "version": "v1.1", - "custom_fact_extraction_prompt": "Optional custom prompt for fact extraction for memory", - "custom_update_memory_prompt": "Optional custom prompt for update memory" -} -``` - - - -## Run Mem0 Locally - -Please refer to the example [Mem0 with Ollama](../examples/mem0-with-ollama) to run Mem0 locally. - - -## Chat Completion - -Mem0 can be easily integrated into chat applications to enhance conversational agents with structured memory. Mem0's APIs are designed to be compatible with OpenAI's, with the goal of making it easy to leverage Mem0 in applications you may have already built. - -If you have a `Mem0 API key`, you can use it to initialize the client. Alternatively, you can initialize Mem0 without an API key if you're using it locally. - -Mem0 supports several language models (LLMs) through integration with various [providers](https://litellm.vercel.app/docs/providers). - -## Use Mem0 OSS - -```python -config = { - "vector_store": { - "provider": "qdrant", - "config": { - "host": "localhost", - "port": 6333, - } - }, -} - -client = Mem0(config=config) - -chat_completion = client.chat.completions.create( - messages=[ - { - "role": "user", - "content": "What's the capital of France?", - } - ], - model="gpt-4.1-nano-2025-04-14", -) -``` - -## Contributing - -We welcome contributions to Mem0. Here's how you can contribute: - -1. Fork the repository and create your branch from `main`. -2. Clone the forked repository to your local machine. -3. Install the project dependencies: - - ```bash - poetry install - ``` - -4. Install pre-commit hooks: - - ```bash - pip install pre-commit # If pre-commit is not already installed - pre-commit install - ``` - -5. Make your changes and ensure they adhere to the project's coding standards. - -6. Run the tests locally: - - ```bash - poetry run pytest - ``` - -7. If all tests pass, commit your changes and push to your fork. -8. Open a pull request with a clear title and description. - -Please ensure your code follows our coding conventions and is well-documented. - - -If you have any questions, please feel free to reach out to us using one of the following methods: - - \ No newline at end of file +- **[OpenAI Compatibility](/open-source/features/openai_compatibility)** - Use Mem0 with OpenAI-compatible chat completions +- **[Contributing Guide](/contributing/development)** - Learn how to contribute to Mem0 +- **[Examples](/examples/mem0-with-ollama)** - See Mem0 in action with Ollama and other integrations diff --git a/docs/faqs.mdx b/docs/platform/faqs.mdx similarity index 100% rename from docs/faqs.mdx rename to docs/platform/faqs.mdx diff --git a/docs/platform/features/advanced-retrieval.mdx b/docs/platform/features/advanced-retrieval.mdx index e57a2bd46..4b0c21490 100644 --- a/docs/platform/features/advanced-retrieval.mdx +++ b/docs/platform/features/advanced-retrieval.mdx @@ -1,7 +1,5 @@ --- title: Advanced Retrieval -icon: "magnifying-glass" -iconType: "solid" description: "Advanced memory search with keyword expansion, intelligent reranking, and precision filtering" --- diff --git a/docs/platform/features/async-client.mdx b/docs/platform/features/async-client.mdx index 1ee048fad..cd5fbdc6a 100644 --- a/docs/platform/features/async-client.mdx +++ b/docs/platform/features/async-client.mdx @@ -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. diff --git a/docs/platform/features/async-mode-default-change.mdx b/docs/platform/features/async-mode-default-change.mdx index ae5019135..28a7dc490 100644 --- a/docs/platform/features/async-mode-default-change.mdx +++ b/docs/platform/features/async-mode-default-change.mdx @@ -1,8 +1,6 @@ --- title: Async Mode Default Change description: 'Important update to Memory Addition API behavior' -icon: "clock-rotate-left" -iconType: "solid" --- diff --git a/docs/platform/features/contextual-add.mdx b/docs/platform/features/contextual-add.mdx index 0cb792a15..481193910 100644 --- a/docs/platform/features/contextual-add.mdx +++ b/docs/platform/features/contextual-add.mdx @@ -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" --- diff --git a/docs/platform/features/criteria-retrieval.mdx b/docs/platform/features/criteria-retrieval.mdx index dfabe0dfa..6ef7d7a14 100644 --- a/docs/platform/features/criteria-retrieval.mdx +++ b/docs/platform/features/criteria-retrieval.mdx @@ -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. diff --git a/docs/platform/features/custom-categories.mdx b/docs/platform/features/custom-categories.mdx index 575815322..a1c0b851c 100644 --- a/docs/platform/features/custom-categories.mdx +++ b/docs/platform/features/custom-categories.mdx @@ -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 diff --git a/docs/platform/features/custom-instructions.mdx b/docs/platform/features/custom-instructions.mdx index 5c937e056..3c80ac8cf 100644 --- a/docs/platform/features/custom-instructions.mdx +++ b/docs/platform/features/custom-instructions.mdx @@ -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? diff --git a/docs/platform/features/direct-import.mdx b/docs/platform/features/direct-import.mdx index dc7d77220..8e4cbf2f8 100644 --- a/docs/platform/features/direct-import.mdx +++ b/docs/platform/features/direct-import.mdx @@ -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 diff --git a/docs/platform/features/expiration-date.mdx b/docs/platform/features/expiration-date.mdx index 044183ce6..86a1b3ac7 100644 --- a/docs/platform/features/expiration-date.mdx +++ b/docs/platform/features/expiration-date.mdx @@ -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 diff --git a/docs/platform/features/feedback-mechanism.mdx b/docs/platform/features/feedback-mechanism.mdx index ab26be789..ac9b9bc19 100644 --- a/docs/platform/features/feedback-mechanism.mdx +++ b/docs/platform/features/feedback-mechanism.mdx @@ -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. diff --git a/docs/platform/features/graph-memory.mdx b/docs/platform/features/graph-memory.mdx index b48aa1d61..a525a0a46 100644 --- a/docs/platform/features/graph-memory.mdx +++ b/docs/platform/features/graph-memory.mdx @@ -1,7 +1,5 @@ --- title: Graph Memory -icon: "circle-nodes" -iconType: "solid" description: "Enable graph-based memory retrieval for more contextually relevant results" --- diff --git a/docs/platform/features/group-chat.mdx b/docs/platform/features/group-chat.mdx index 9e7204586..9b2c051cd 100644 --- a/docs/platform/features/group-chat.mdx +++ b/docs/platform/features/group-chat.mdx @@ -1,8 +1,6 @@ --- title: Group Chat description: 'Enable multi-participant conversations with automatic memory attribution to individual speakers' -icon: "users" -iconType: "solid" --- diff --git a/docs/platform/features/memory-export.mdx b/docs/platform/features/memory-export.mdx index fed637105..3d08a4cd5 100644 --- a/docs/platform/features/memory-export.mdx +++ b/docs/platform/features/memory-export.mdx @@ -1,8 +1,6 @@ --- title: Memory Export description: 'Export memories in a structured format using customizable Pydantic schemas' -icon: "file-export" -iconType: "solid" --- ## Overview diff --git a/docs/platform/features/multimodal-support.mdx b/docs/platform/features/multimodal-support.mdx index 0fc7324ea..b1d419ba1 100644 --- a/docs/platform/features/multimodal-support.mdx +++ b/docs/platform/features/multimodal-support.mdx @@ -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. diff --git a/docs/platform/features/platform-overview.mdx b/docs/platform/features/platform-overview.mdx index 8ccf2c3b3..cba077f9c 100644 --- a/docs/platform/features/platform-overview.mdx +++ b/docs/platform/features/platform-overview.mdx @@ -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. diff --git a/docs/platform/features/timestamp.mdx b/docs/platform/features/timestamp.mdx index 8b77a1459..ceb20a722 100644 --- a/docs/platform/features/timestamp.mdx +++ b/docs/platform/features/timestamp.mdx @@ -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 diff --git a/docs/platform/features/v2-memory-filters.mdx b/docs/platform/features/v2-memory-filters.mdx index 750161a54..d4fc204eb 100644 --- a/docs/platform/features/v2-memory-filters.mdx +++ b/docs/platform/features/v2-memory-filters.mdx @@ -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. --- diff --git a/docs/platform/features/webhooks.mdx b/docs/platform/features/webhooks.mdx index 73327958b..240022216 100644 --- a/docs/platform/features/webhooks.mdx +++ b/docs/platform/features/webhooks.mdx @@ -1,8 +1,6 @@ --- title: Webhooks description: 'Configure and manage webhooks to receive real-time notifications about memory events' -icon: "webhook" -iconType: "solid" --- ## Overview diff --git a/docs/platform/overview.mdx b/docs/platform/overview.mdx index 7e6c054ba..85ef4ec5d 100644 --- a/docs/platform/overview.mdx +++ b/docs/platform/overview.mdx @@ -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" --- + +**Mem0 v1.0.0 is now available** — Introducing rerankers, async by default, Azure support, and more. [View changelog →](/changelog) + + ## 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 + + + + Get your first memory stored in 5 minutes. Step-by-step guide with code examples. + + + + Compare managed and self-hosted options. See which fits your needs best. + + + + Understand user memories, agent memories, and session-specific context. + + + + Explore graph memory, multimodal support, webhooks, and advanced retrieval. + + + + Use Mem0 with LangChain, CrewAI, LlamaIndex, and 15+ other frameworks. + + + + Monitor memory operations, track usage, and manage your AI agents. + + + +--- ## 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. + + + Follow the quickstart guide to create your first memory in 5 minutes + + + + See the full comparison between Platform and Open Source + + diff --git a/docs/platform/platform-vs-oss.mdx b/docs/platform/platform-vs-oss.mdx new file mode 100644 index 000000000..0b4ee1bcf --- /dev/null +++ b/docs/platform/platform-vs-oss.mdx @@ -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: + + + + **Managed, hassle-free** + + Get started in 5 minutes with our hosted solution. Perfect for fast iteration and production apps. + + + + **Self-hosted, full control** + + Deploy on your infrastructure. Choose your vector DB, LLM, and configure everything. + + + +--- + +## Feature Comparison + + + + | 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 | + + + + | Feature | Platform | Open Source | + |---------|----------|-------------| + | **User & agent memories** | ✅ | ✅ | + | **Smart deduplication** | ✅ | ✅ | + | **Semantic search** | ✅ | ✅ | + | **Memory updates** | ✅ | ✅ | + | **Multi-language SDKs** | Python, JavaScript | Python, JavaScript | + + + + | Feature | Platform | Open Source | + |---------|----------|-------------| + | **Graph Memory** | ✅ (Managed) | ✅ (Self-configured) | + | **Multimodal support** | ✅ | ✅ | + | **Custom categories** | ✅ | Limited | + | **Advanced retrieval** | ✅ | ✅ | + | **Memory filters v2** | ✅ | ⚠️ (via metadata) | + | **Webhooks** | ✅ | ❌ | + | **Memory export** | ✅ | ❌ | + + + + | 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 | + + + + | 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 | + + + + | 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 | + + + +--- + +## Decision Guide + +### Choose **Platform** if you want: + + + + Get your AI app with memory live in hours, not weeks. No infrastructure setup needed. + + + + Auto-scaling, high availability, and managed infrastructure out of the box. + + + + Track memory usage, query patterns, and user engagement through our dashboard. + + + + Access to webhooks, memory export, custom categories, and priority support. + + + +### Choose **Open Source** if you need: + + + + Host everything on your infrastructure. Complete data residency and privacy control. + + + + Choose your own vector DB, LLM provider, embedder, and deployment strategy. + + + + Modify the codebase, add custom features, and contribute back to the community. + + + + Use local LLMs (Ollama), self-hosted vector DBs, and optimize for your specific use case. + + + +--- + +## Still not sure? + + + + Sign up and test the Platform with our free tier. No credit card required. + + + + Clone the repo and run locally to see how it works. Star us while you're there! + + diff --git a/docs/platform/quickstart.mdx b/docs/platform/quickstart.mdx index e27d709a7..de77d99fd 100644 --- a/docs/platform/quickstart.mdx +++ b/docs/platform/quickstart.mdx @@ -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 + + + ```bash pip pip install mem0ai @@ -17,205 +25,126 @@ pip install mem0ai ```bash npm npm install mem0ai ``` + + -## 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 - + ```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" ``` + + -## 4. Basic Operations - -### Add Memories - -Store user preferences and context: - + ```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" + }' ``` + + -### Search Memories - -Retrieve relevant memories based on queries: - + ```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"} + }' ``` + -### Get All Memories +**Output:** -Fetch all memories for a user: - - -```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)); -``` - + + -## 5. Memory Types +## What's Next? -### User Memories -Long-term memories that persist across sessions: + + +Learn how to search, update, and delete memories with complete CRUD operations + - -```python Python -client.add(messages, user_id="alex", metadata={"category": "preferences"}) -``` + + Explore advanced features like metadata filtering, graph memory, and webhooks + -```javascript JavaScript -client.add(messages, { user_id: "alex", metadata: { category: "preferences" } }); -``` - + +See complete API documentation and integration examples + + -### Session Memories -Short-term memories for specific conversations: +## Additional Resources - -```python Python -client.add(messages, user_id="alex", run_id="session-123") -``` - -```javascript JavaScript -client.add(messages, { user_id: "alex", run_id: "session-123" }); -``` - - -### Agent Memories -Memories for AI assistants and agents: - - -```python Python -client.add(messages, agent_id="support-bot") -``` - -```javascript JavaScript -client.add(messages, { agent_id: "support-bot" }); -``` - - -## 6. Advanced Features - -### Async Processing -Process memories in the background for faster responses: - - -```python Python -client.add(messages, user_id="alex", async_mode=True) -``` - -```javascript JavaScript -client.add(messages, { user_id: "alex", async_mode: true }); -``` - - -### Search with Filters -Filter results by categories and metadata: - - -```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" } -}); -``` - - -## TypeScript Example - - -```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)); -``` - - -## 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 - - \ No newline at end of file +- **[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 diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx deleted file mode 100644 index 62ac2e07d..000000000 --- a/docs/quickstart.mdx +++ /dev/null @@ -1,418 +0,0 @@ ---- -title: Quickstart -icon: "bolt" -iconType: "solid" ---- - -Mem0 offers two powerful ways to leverage our technology: [our managed platform](#mem0-platform-managed-solution) and [our open source solution](#mem0-open-source). - -Check out our [Playground](https://mem0.dev/pd-pg) to see Mem0 in action. - - - - Better, faster, fully managed, and hassle-free solution. - - - Self-hosted, fully customizable, and open source. - - - - -## Mem0 Platform (Managed Solution) - -Our fully managed platform provides a hassle-free way to integrate Mem0's capabilities into your AI agents and assistants. Sign up for Mem0 platform [here](https://mem0.dev/pd). - -The Mem0 SDK supports both Python and JavaScript, with full [TypeScript](/platform/quickstart/#4-11-working-with-mem0-in-typescript) support as well. - -Follow the steps below to get started with Mem0 Platform: - -1. [Install Mem0](#1-install-mem0) -2. [Add Memories](#2-add-memories) -3. [Retrieve Memories](#3-retrieve-memories) - -### 1. Install Mem0 - - - - -```bash pip -pip install mem0ai -``` - -```bash npm -npm install mem0ai -``` - - - - -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) - - - - -### 2. Add Memories - - - - -```python Python -import os -from mem0 import MemoryClient - -os.environ["MEM0_API_KEY"] = "your-api-key" - -client = MemoryClient() -``` - -```javascript JavaScript -import MemoryClient from 'mem0ai'; -const client = new MemoryClient({ apiKey: 'your-api-key' }); -``` - - - - - -```python Python -messages = [ - {"role": "user", "content": "Thinking of making a sandwich. What do you recommend?"}, - {"role": "assistant", "content": "How about adding some cheese for extra flavor?"}, - {"role": "user", "content": "Actually, I don't like cheese."}, - {"role": "assistant", "content": "I'll remember that you don't like cheese for future recommendations."} -] -client.add(messages, user_id="alex") -``` - -```javascript JavaScript -const messages = [ - {"role": "user", "content": "Thinking of making a sandwich. What do you recommend?"}, - {"role": "assistant", "content": "How about adding some cheese for extra flavor?"}, - {"role": "user", "content": "Actually, I don't like cheese."}, - {"role": "assistant", "content": "I'll remember that you don't like cheese for future recommendations."} -]; -client.add(messages, { user_id: "alex" }) - .then(response => console.log(response)) - .catch(error => console.error(error)); -``` - -```bash cURL -curl -X POST "https://api.mem0.ai/v1/memories/" \ - -H "Authorization: Token your-api-key" \ - -H "Content-Type: application/json" \ - -d '{ - "messages": [ - {"role": "user", "content": "I live in San Francisco. Thinking of making a sandwich. What do you recommend?"}, - {"role": "assistant", "content": "How about adding some cheese for extra flavor?"}, - {"role": "user", "content": "Actually, I don't like cheese."}, - {"role": "assistant", "content": "I'll remember that you don't like cheese for future recommendations."} - ], - "user_id": "alex" - }' -``` - -```json Output -[ - { - "id": "24e466b5-e1c6-4bde-8a92-f09a327ffa60", - "memory": "Does not like cheese", - "event": "ADD" - }, - { - "id": "e8d78459-fadd-4c5a-bece-abb8c3dc7ed7", - "memory": "Lives in San Francisco", - "event": "ADD" - } -] -``` - - - - -### 3. Retrieve Memories - - - - - -```python Python -# Example showing location and preference-aware recommendations -query = "I'm craving some pizza. Any recommendations?" -filters = { - "AND": [ - { - "user_id": "alex" - } - ] -} -client.search(query, filters=filters) -``` - -```javascript JavaScript -const query = "I'm craving some pizza. Any recommendations?"; -const filters = { - "AND": [ - { - "user_id": "alex" - } - ] -}; -client.search(query, { filters }) - .then(results => console.log(results)) - .catch(error => console.error(error)); -``` - -```bash cURL -curl -X POST "https://api.mem0.ai/v2/memories/search/" \ - -H "Authorization: Token your-api-key" \ - -H "Content-Type: application/json" \ - -d '{ - "query": "I'm craving some pizza. Any recommendations?", - "filters": { - "AND": [ - { - "user_id": "alex" - } - ] - } - }' -``` - -```json Output -[ - { - "id": "7f165f7e-b411-4afe-b7e5-35789b72c4a5", - "memory": "Does not like cheese", - "user_id": "alex", - "metadata": null, - "created_at": "2024-07-20T01:30:36.275141-07:00", - "updated_at": "2024-07-20T01:30:36.275172-07:00", - "score": 0.92 - }, - { - "id": "8f165f7e-b411-4afe-b7e5-35789b72c4b6", - "memory": "Lives in San Francisco", - "user_id": "alex", - "metadata": null, - "created_at": "2024-07-20T01:30:36.275141-07:00", - "updated_at": "2024-07-20T01:30:36.275172-07:00", - "score": 0.85 - } -] -``` - - - - - - - -```python Python -filters = { - "AND": [ - { - "user_id": "alex" - } - ] -} - -all_memories = client.get_all(filters=filters, page=1, page_size=50) -``` - -```javascript JavaScript -const filters = { - "AND": [ - { - "user_id": "alex" - } - ] -}; - -client.getAll({ filters, page: 1, page_size: 50 }) - .then(memories => console.log(memories)) - .catch(error => console.error(error)); -``` - -```bash cURL -curl -X GET "https://api.mem0.ai/v2/memories/?page=1&page_size=50" \ - -H "Authorization: Token your-api-key" \ - -H "Content-Type: application/json" \ - -d '{ - "filters": { - "AND": [ - { - "user_id": "alice" - } - ] - } - }' -``` - -```json Output -[ - { - "id": "7f165f7e-b411-4afe-b7e5-35789b72c4a5", - "memory": "Does not like cheese", - "user_id": "alex", - "metadata": null, - "created_at": "2024-07-20T01:30:36.275141-07:00", - "updated_at": "2024-07-20T01:30:36.275172-07:00", - "score": 0.92 - }, - { - "id": "8f165f7e-b411-4afe-b7e5-35789b72c4b6", - "memory": "Lives in San Francisco", - "user_id": "alex", - "metadata": null, - "created_at": "2024-07-20T01:30:36.275141-07:00", - "updated_at": "2024-07-20T01:30:36.275172-07:00", - "score": 0.85 - } -] -``` - - - - - - Learn more about Mem0 platform - - -## Mem0 Open Source - -Our open-source version is available for those who prefer full control and customization. You can self-host Mem0 on your infrastructure and integrate it with your AI agents and assistants. Check out our [GitHub repository](https://mem0.dev/gd). - -Follow the steps below to get started with Mem0 Open Source: - -1. [Install Mem0 Open Source](#1-install-mem0-open-source) -2. [Add Memories](#2-add-memories-open-source) -3. [Retrieve Memories](#3-retrieve-memories-open-source) - -### 1. Install Mem0 Open Source - - - - -```bash pip -pip install mem0ai -``` - -```bash npm -npm install mem0ai -``` - - - - -### 2. Add Memories - - - - -```python Python -from mem0 import Memory -m = Memory() -``` - -```typescript TypeScript -import { Memory } from 'mem0ai/oss'; -const memory = new Memory(); -``` - - - - -```python Code -# For a user -messages = [ - { - "role": "user", - "content": "I like to drink coffee in the morning and go for a walk" - } -] -result = m.add(messages, user_id="alice", metadata={"category": "preferences"}) -``` - -```typescript TypeScript -const messages = [ - { - role: "user", - content: "I like to drink coffee in the morning and go for a walk" - } -]; -const result = memory.add(messages, { userId: "alice", metadata: { category: "preferences" } }); -``` - -```json Output -[ - { - "id": "3dc6f65f-fb3f-4e91-89a8-ed1a22f8898a", - "data": {"memory": "Likes to drink coffee in the morning"}, - "event": "ADD" - }, - { - "id": "f1673706-e3d6-4f12-a767-0384c7697d53", - "data": {"memory": "Likes to go for a walk"}, - "event": "ADD" - } -] -``` - - - - -### 3. Retrieve Memories - - - - -```python Python -related_memories = m.search("Should I drink coffee or tea?", user_id="alice") -``` - -```typescript TypeScript -const relatedMemories = memory.search("Should I drink coffee or tea?", { userId: "alice" }); -``` - -```json Output -[ - { - "id": "3dc6f65f-fb3f-4e91-89a8-ed1a22f8898a", - "memory": "Likes to drink coffee in the morning", - "user_id": "alice", - "metadata": {"category": "preferences"}, - "categories": ["user_preferences", "food"], - "immutable": false, - "created_at": "2025-02-24T20:11:39.010261-08:00", - "updated_at": "2025-02-24T20:11:39.010274-08:00", - "score": 0.5915589089130715 - }, - { - "id": "e8d78459-fadd-4c5a-bece-abb8c3dc7ed7", - "memory": "Likes to go for a walk", - "user_id": "alice", - "metadata": {"category": "preferences"}, - "categories": ["hobby", "food"], - "immutable": false, - "created_at": "2025-02-24T11:47:52.893038-08:00", - "updated_at": "2025-02-24T11:47:52.893048-08:00", - "score": 0.43263634637810866 - } -] -``` - - - - - - - - Learn more about Mem0 OSS Python SDK - - - Learn more about Mem0 OSS Node.js SDK - - \ No newline at end of file diff --git a/docs/v0x/examples/mem0-openai-voice-demo.mdx b/docs/v0x/examples/mem0-openai-voice-demo.mdx index d61d40868..e3b236570 100644 --- a/docs/v0x/examples/mem0-openai-voice-demo.mdx +++ b/docs/v0x/examples/mem0-openai-voice-demo.mdx @@ -1,6 +1,6 @@ --- -title: 'Mem0 with OpenAI Agents SDK for Voice' -description: 'Integrate memory capabilities into your voice agents using Mem0 and OpenAI Agents SDK' +title: "Mem0 with OpenAI Agents SDK for Voice" +description: "Integrate memory capabilities into your voice agents using Mem0 and OpenAI Agents SDK" --- # Building Voice Agents with Memory using Mem0 and OpenAI Agents SDK @@ -12,16 +12,19 @@ This guide demonstrates how to combine OpenAI's Agents SDK for voice application Before you begin, make sure you have: 1. Installed OpenAI Agents SDK with voice dependencies: + ```bash pip install 'openai-agents[voice]' ``` 2. Installed Mem0 SDK: + ```bash pip install mem0ai ``` 3. Installed other required dependencies: + ```bash pip install numpy sounddevice pydantic ``` @@ -64,6 +67,7 @@ mem0_client = AsyncMemoryClient() ``` This section handles: + - Importing required modules from OpenAI Agents SDK and Mem0 - Setting up environment variables for API keys - Defining a simple user identification system (using a global variable) @@ -94,7 +98,7 @@ async def save_memories( """Store a user memory in memory.""" # This will be visible in your console logger.debug(f"Saving memory: {memory} for user {USER_ID}") - + # Store the preference in Mem0 memory_content = f"User memory - {memory}" await mem0_client.add( @@ -106,6 +110,7 @@ async def save_memories( ``` This function: + - Takes a memory string - Creates a formatted memory string - Stores it in Mem0 using the `add()` method @@ -132,16 +137,17 @@ async def search_memories( threshold=0.7, # Higher threshold for more relevant results output_format="v1.1" ) - + # Format and return the results if not results.get('results', []): return "I don't have any relevant memories about this topic." - + memories = [f"• {result['memory']}" for result in results.get('results', [])] return "Here's what I remember that might be relevant:\n" + "\n".join(memories) ``` This tool: + - Takes a search query string - Passes it to Mem0's semantic search to find related memories - Sets a threshold for relevance to ensure quality results @@ -165,11 +171,12 @@ def create_memory_voice_agent(): model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) - + return agent ``` This function: + - Creates an OpenAI Agent with specific instructions - Configures it to use gpt-4.1-nano (you can use other models) - Registers the memory-related tools with the agent @@ -181,24 +188,25 @@ This function: async def record_from_microphone(duration=5, samplerate=24000): """Record audio from the microphone for a specified duration.""" print(f"Recording for {duration} seconds...") - + # Create a buffer to store the recorded audio frames = [] - + # Callback function to store audio data def callback(indata, frames_count, time_info, status): frames.append(indata.copy()) - + # Start recording with sd.InputStream(samplerate=samplerate, channels=1, callback=callback, dtype=np.int16): await asyncio.sleep(duration) - + # Combine all frames into a single numpy array audio_data = np.concatenate(frames) return audio_data ``` This function: + - Creates a simple asynchronous microphone recording function - Uses the sounddevice library to capture audio input - Stores frames in a buffer during recording @@ -211,16 +219,16 @@ This function: async def main(): # Create the agent agent = create_memory_voice_agent() - + # Set up the voice pipeline pipeline = VoicePipeline( workflow=SingleAgentVoiceWorkflow(agent) ) - + # Configure TTS settings pipeline.config.tts_settings.voice = "alloy" pipeline.config.tts_settings.speed = 1.0 - + try: while True: # Get user input @@ -228,19 +236,19 @@ async def main(): user_input = input() if user_input.lower() == 'q': break - + # Record and process audio audio_data = await record_from_microphone(duration=5) audio_input = AudioInput(buffer=audio_data) result = await pipeline.run(audio_input) - + # Play response and handle events player = sd.OutputStream(samplerate=24000, channels=1, dtype=np.int16) player.start() - + agent_response = "" print("\nAgent response:") - + async for event in result.stream(): if event.type == "voice_stream_event_audio": player.write(event.data) @@ -248,23 +256,24 @@ async def main(): content = event.data agent_response += content print(content, end="", flush=True) - + # Save the agent's response to memory if agent_response: try: await mem0_client.add( - f"Agent response: {agent_response}", + f"Agent response: {agent_response}", user_id=USER_ID, metadata={"type": "agent_response"} ) except Exception as e: print(f"Failed to store memory: {e}") - + except KeyboardInterrupt: print("\nExiting...") ``` This main function orchestrates the entire process: + 1. Creates the memory-enabled voice agent 2. Sets up the voice pipeline with TTS settings 3. Implements an interactive loop for recording and processing voice input @@ -348,11 +357,11 @@ async def search_memories( threshold=0.7, # Higher threshold for more relevant results output_format="v1.1" ) - + # Format and return the results if not results.get('results', []): return "I don't have any relevant memories about this topic." - + memories = [f"• {result['memory']}" for result in results.get('results', [])] return "Here's what I remember that might be relevant:\n" + "\n".join(memories) @@ -372,43 +381,43 @@ def create_memory_voice_agent(): model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) - + return agent async def record_from_microphone(duration=5, samplerate=24000): """Record audio from the microphone for a specified duration.""" print(f"Recording for {duration} seconds...") - + # Create a buffer to store the recorded audio frames = [] - + # Callback function to store audio data def callback(indata, frames_count, time_info, status): frames.append(indata.copy()) - + # Start recording with sd.InputStream(samplerate=samplerate, channels=1, callback=callback, dtype=np.int16): await asyncio.sleep(duration) - + # Combine all frames into a single numpy array audio_data = np.concatenate(frames) return audio_data async def main(): print("Starting Memory Voice Agent") - + # Create the agent and context agent = create_memory_voice_agent() - + # Set up the voice pipeline pipeline = VoicePipeline( workflow=SingleAgentVoiceWorkflow(agent) ) - + # Configure TTS settings pipeline.config.tts_settings.voice = "alloy" pipeline.config.tts_settings.speed = 1.0 - + try: while True: # Get user input @@ -416,23 +425,23 @@ async def main(): user_input = input() if user_input.lower() == 'q': break - + # Record and process audio audio_data = await record_from_microphone(duration=5) audio_input = AudioInput(buffer=audio_data) - + print("Processing your request...") - + # Process the audio input result = await pipeline.run(audio_input) - + # Create an audio player player = sd.OutputStream(samplerate=24000, channels=1, dtype=np.int16) player.start() - + # Store the agent's response for adding to memory agent_response = "" - + print("\nAgent response:") # Play the audio stream as it comes in async for event in result.stream(): @@ -443,20 +452,20 @@ async def main(): content = event.data agent_response += content print(content, end="", flush=True) - + print("\n") - + # Example of saving the conversation to Mem0 after completion if agent_response: try: await mem0_client.add( - f"Agent response: {agent_response}", + f"Agent response: {agent_response}", user_id=USER_ID, metadata={"type": "agent_response"} ) except Exception as e: print(f"Failed to store memory: {e}") - + except KeyboardInterrupt: print("\nExiting...") @@ -486,7 +495,7 @@ To run this example: 1. Replace the placeholder API keys with your actual keys 2. Make sure your microphone is properly connected -3. Run the script with Python 3.8 or newer +3. Run the script with Python 3.10 or newer 4. Press Enter to start recording, then speak your request 5. Press 'q' to quit the application @@ -533,6 +542,6 @@ async def save_memories( """Store a user memory in memory.""" # This will be visible in your console logger.debug(f"Saving memory: {memory} for user {USER_ID}") - + # Rest of your function... -``` \ No newline at end of file +``` diff --git a/docs/v0x/integrations/aws-bedrock.mdx b/docs/v0x/integrations/aws-bedrock.mdx index 4c6b9bec7..78f67f6eb 100644 --- a/docs/v0x/integrations/aws-bedrock.mdx +++ b/docs/v0x/integrations/aws-bedrock.mdx @@ -18,7 +18,7 @@ In this guide, you'll: - AWS account with access to: - Bedrock foundation models (e.g., Titan, Claude) - OpenSearch Service with a configured domain -- Python 3.8+ +- Python 3.10+ - Valid AWS credentials (via environment or IAM role) ## Setup and Installation @@ -127,4 +127,3 @@ all_memories = m.get_all(user_id="alice") - [Mem0 Platform](https://app.mem0.ai) -