Skip to main content

Configure Mem0 OSS Components

Prerequisites
  • Python 3.10+ with pip available
  • Running vector database (e.g., Qdrant, Postgres + pgvector) or access credentials for a managed store
  • API keys for your chosen LLM, embedder, and reranker providers
Start from the Python quickstart if you still need the base CLI and repository.

Install dependencies

  • Python
  • Docker Compose
1

Install Mem0 OSS

pip install mem0ai
2

Add provider SDKs (example: Qdrant + OpenAI)

pip install qdrant-client openai

Define your configuration

  • Python
  • config.yaml
1

Create a configuration dictionary

from mem0 import Memory

config = {
    "vector_store": {
        "provider": "qdrant",
        "config": {"host": "localhost", "port": 6333},
    },
    "llm": {
        "provider": "openai",
        "config": {"model": "gpt-4.1-mini", "temperature": 0.1},
    },
    "embedder": {
        "provider": "vertexai",
        "config": {"model": "textembedding-gecko@003"},
    },
    "reranker": {
        "provider": "cohere",
        "config": {"model": "rerank-english-v3.0"},
    },
}

memory = Memory.from_config(config)
2

Store secrets as environment variables

export QDRANT_API_KEY="..."
export OPENAI_API_KEY="..."
export COHERE_API_KEY="..."
Run memory.add(["Remember my favorite cafe in Tokyo."], user_id="alex") and then memory.search("favorite cafe", user_id="alex"). You should see the Qdrant collection populate and the reranker mark the memory as a top hit.

Tune component settings

Name collections explicitly in production (collection_name) to isolate tenants and enable per-tenant retention policies.
Keep extraction temperatures ≤0.2 so advanced memories stay deterministic. Raise it only when you see missing facts.
Limit top_k to 10–20 results; sending more adds latency without meaningful gains.
Mixing managed and self-hosted components? Make sure every outbound provider call happens through a secure network path. Managed rerankers often require outbound internet even if your vector store is on-prem.

Quick recovery

  • Qdrant connection errors → confirm port 6333 is exposed and API key (if set) matches.
  • Empty search results → verify the embedder model name; a mismatch causes dimension errors.
  • Unknown reranker → update the SDK (pip install --upgrade mem0ai) to load the latest provider registry.