Files
wehub-resource-sync 555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:45 +08:00

167 lines
5.5 KiB
Plaintext

---
title: "Configure the OSS Stack"
description: "Configure Mem0 OSS in Python or TypeScript with your own LLM, embedder, and vector store."
icon: "sliders"
---
Mem0 OSS works out of the box with OpenAI defaults. Point it at your own LLM, embedder, and vector store by passing a config when you create `Memory`. The Python SDK also supports a reranker and graph memory.
<Info>
**Prerequisites**
- Python 3.10+ (`pip`) or Node.js 18+ (`npm`)
- A running vector store such as Qdrant or Postgres + pgvector (Python's default Qdrant and Node's in-memory store need nothing extra)
- API keys for your chosen LLM and embedder providers
</Info>
<Tip>
New to Mem0 OSS? Run the <Link href="/open-source/python-quickstart">Python</Link> or <Link href="/open-source/node-quickstart">Node.js</Link> quickstart first, then come back to swap in your own providers.
</Tip>
## Install dependencies
<CodeGroup>
```bash pip
pip install mem0ai
```
```bash npm
npm install mem0ai
```
</CodeGroup>
Using Qdrant as your vector store? Install its Python client (the Node SDK talks to Qdrant over REST) and run the server locally:
```bash
pip install qdrant-client # Python only
docker run -p 6333:6333 qdrant/qdrant
```
## Define your configuration
Each component takes a `provider` and a `config`. Keys are `snake_case` in Python and `camelCase` in TypeScript. Pass the config when you create `Memory`:
<CodeGroup>
```python Python
from mem0 import Memory
config = {
"vector_store": {
"provider": "qdrant",
"config": {"host": "localhost", "port": 6333},
},
"llm": {
"provider": "openai",
"config": {"model": "gpt-5-mini", "temperature": 0.1},
},
"embedder": {
"provider": "openai",
"config": {"model": "text-embedding-3-small"},
},
"reranker": {
"provider": "cohere",
"config": {"model": "rerank-v3.5"},
},
}
memory = Memory.from_config(config)
```
```ts Node.js
import { Memory } from "mem0ai/oss";
const memory = new Memory({
llm: {
provider: "openai",
config: { apiKey: process.env.OPENAI_API_KEY || "", model: "gpt-5-mini", temperature: 0.1 },
},
embedder: {
provider: "openai",
config: { apiKey: process.env.OPENAI_API_KEY || "", model: "text-embedding-3-small" },
},
vectorStore: {
provider: "qdrant",
config: { host: "localhost", port: 6333, collectionName: "memories" },
},
});
```
</CodeGroup>
Set your provider keys as environment variables:
```bash
export OPENAI_API_KEY="..."
export COHERE_API_KEY="..." # Python reranker only
```
<Note>
The TypeScript OSS SDK configures the LLM, embedder, vector store, and history store. Reranker and graph memory are Python-only today.
</Note>
Prefer a config file? Load YAML into Python's `from_config`:
```python
import yaml
from mem0 import Memory
with open("config.yaml") as f:
config = yaml.safe_load(f)
memory = Memory.from_config(config)
```
<Info icon="check">
Verify it works: add a memory and search it back. `memory.add(...)` followed by `memory.search(...)` should populate your vector store and return the memory as a top hit.
</Info>
## Available providers
Change the `provider` string to switch backends. The most common options:
| Component | Python | TypeScript |
| --- | --- | --- |
| LLM | `openai`, `anthropic`, `gemini`, `groq`, `ollama`, `aws_bedrock`, `azure_openai`, `litellm` | `openai`, `anthropic`, `gemini`, `groq`, `ollama`, `aws_bedrock`, `azure_openai`, `mistral`, `deepseek` |
| Embedder | `openai`, `gemini`, `azure_openai`, `ollama`, `huggingface`, `vertexai`, `aws_bedrock` | `openai`, `gemini`, `azure_openai`, `ollama` |
| Vector store | `qdrant`, `pgvector`, `chroma`, `pinecone`, `redis`, `weaviate`, `milvus`, `elasticsearch` | `memory`, `qdrant`, `pgvector`, `redis`, `supabase`, `azure-ai-search`, `vectorize`, `milvus` |
See the full catalog in <Link href="/components/llms/overview">Components</Link>.
## Tune component settings
<AccordionGroup>
<Accordion title="Vector store collections">
Name collections explicitly in production (`collection_name` / `collectionName`) to isolate tenants and enable per-tenant retention policies.
</Accordion>
<Accordion title="LLM extraction temperature">
Keep extraction temperature at or below 0.2 so memories stay deterministic. Raise it only when you see facts being missed.
</Accordion>
<Accordion title="Reranker depth (Python)">
Limit `top_k` to 10 to 20 results. Sending more adds latency without meaningful gains.
</Accordion>
</AccordionGroup>
<Warning>
Mixing managed and self-hosted components? Make sure every outbound provider call has a secure network path. Managed rerankers and embedders often require outbound internet even if your vector store is on-prem.
</Warning>
## Quick recovery
- Qdrant connection errors: confirm port `6333` is exposed and the API key (if set) matches.
- Empty search results: verify the embedder model name. A mismatch causes dimension errors.
- `Unknown reranker` (Python): upgrade the SDK with `pip install --upgrade mem0ai` to load the latest provider registry.
- `Cannot find module` (Node): import from the OSS entry point, `import { Memory } from "mem0ai/oss"`, not `"mem0ai"`.
<CardGroup cols={2}>
<Card
title="Pick Providers"
description="Browse the LLM, vector store, embedder, and reranker catalogs."
icon="sitemap"
href="/components/llms/overview"
/>
<Card
title="Deploy with Docker Compose"
description="Follow the end-to-end OSS deployment walkthrough."
icon="server"
href="/open-source/features/rest-api"
/>
</CardGroup>