Overview
Mem0 relies on vector stores to organize, store, and retrieve long-term memories efficiently. By default, Mem0 uses built-in vector storage options, but you can easily connect custom vector databases like Qdrant, Chroma, PGVector, or Pinecone to match your infrastructure requirements.
Supported storage providers: qdrant, chroma, pgvector, pinecone, mongodb, milvus, baidu, cassandra, neptune, upstash_vector, azure_ai_search, azure_mysql, redis, valkey, databricks, elasticsearch, vertex_ai_vector_search, opensearch, supabase, weaviate, faiss, langchain, s3_vectors, turbopuffer, oracledb.
Sources: mem0/vector_stores/configs.py, mem0/utils/factory.py, mem0-ts/src/oss/src/utils/factory.ts.
Configuring a Vector Store Provider
Supported Providers and Requirements
When setting up your storage provider, you need to supply the appropriate connection settings depending on whether you are running locally or connecting to a managed cloud service.
| Provider | Key Configuration Options |
|---|---|
| Qdrant | host, port, path, url, api_key, on_disk, collection_name |
| Chroma | path, host, port, api_key, tenant, collection_name |
| PGVector | dbname, user, password, host, port, connection_string, hnsw |
| Pinecone | api_key, collection_name, embedding_model_dims, serverless_config, pod_config |
| Upstash Vector | url, token, collection_name, enable_embeddings |
Note
For cloud-managed providers like Pinecone or Upstash, make sure your API keys or REST tokens are correctly specified either inside the provider configuration block or through corresponding environment variables (such as PINECONE_API_KEY or UPSTASH_VECTOR_REST_URL).
Step-by-Step Configuration
1. Install Required Dependencies
Before connecting a custom vector database, ensure you have installed the necessary Python or TypeScript package bindings for your chosen provider. For example, if you are using Pinecone or Chroma in Python, install the respective packages:
pip install pinecone pinecone-text chromadb2. Define the Vector Store Settings
Configure your memory instance by specifying the provider name alongside its corresponding config parameters.
from mem0 import Memory
config = {
"vector_store": {
"provider": "pinecone",
"config": {
"collection_name": "my-mem0-index",
"embedding_model_dims": 1536,
"metric": "cosine",
"serverless_config": {
"cloud": "aws",
"region": "us-east-1"
}
}
}
}
memory = Memory.from_config(config)Warning
Do not specify both pod_config and serverless_config simultaneously when configuring Pinecone. Choose one deployment method to avoid initialization errors.
Best Practices and Tips
Tip
Dimension Matching: Always ensure that the embedding_model_dims (or dimension) defined in your vector store configuration matches the dimension size output by your active embedding model (e.g., 1536 for OpenAI's text-embedding-3-small).
Caution
Extra Fields Validation: Mem0's configuration validators strictly reject unrecognized parameter keys. Ensure you only include parameters supported by that specific provider's configuration schema.