Welcome to the Mem0 quickstart guide. This guide will help you get up and running with Mem0 in no time.
Installation
To install Mem0, you can use npm. Run the following command in your terminal:Basic Usage
Initialize Mem0
Store a Memory
Retrieve Memories
Search Memories
Update a Memory
Memory History
Delete Memory
Reset Memory
History Store
Mem0 TypeScript SDK support history stores to run on a serverless environment: We recommend usingSupabase
as a history store for serverless environments or disable history store to run on a serverless environment.
Create Memory History Table in Supabase
You may need to create a memory history table in Supabase to store the history of memories. Use the following SQL command inSQL Editor
on the Supabase project dashboard to create a memory history table:
Configuration Parameters
Mem0 offers extensive configuration options to customize its behavior according to your needs. These configurations span across different components like vector stores, language models, embedders, and graph stores.Vector Store Configuration
Vector Store Configuration
Parameter | Description | Default |
---|---|---|
provider | Vector store provider (e.g., “memory”) | “memory” |
host | Host address | ”localhost” |
port | Port number | undefined |
LLM Configuration
LLM Configuration
Parameter | Description | Provider |
---|---|---|
provider | LLM provider (e.g., “openai”, “anthropic”) | All |
model | Model to use | All |
temperature | Temperature of the model | All |
apiKey | API key to use | All |
maxTokens | Tokens to generate | All |
topP | Probability threshold for nucleus sampling | All |
topK | Number of highest probability tokens to keep | All |
openaiBaseUrl | Base URL for OpenAI API | OpenAI |
Graph Store Configuration
Graph Store Configuration
Parameter | Description | Default |
---|---|---|
provider | Graph store provider (e.g., “neo4j”) | “neo4j” |
url | Connection URL | env.NEO4J_URL |
username | Authentication username | env.NEO4J_USERNAME |
password | Authentication password | env.NEO4J_PASSWORD |
Embedder Configuration
Embedder Configuration
Parameter | Description | Default |
---|---|---|
provider | Embedding provider | ”openai” |
model | Embedding model to use | ”text-embedding-3-small” |
apiKey | API key for embedding service | None |
General Configuration
General Configuration
Parameter | Description | Default |
---|---|---|
historyDbPath | Path to the history database | ”/history.db” |
version | API version | ”v1.0” |
customPrompt | Custom prompt for memory processing | None |
History Table Configuration
History Table Configuration
Parameter | Description | Default |
---|---|---|
provider | History store provider | ”sqlite” |
config | History store configuration | None (Defaults to SQLite) |
disableHistory | Disable history store | false |
Complete Configuration Example
Complete Configuration Example