Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 047fc1254f | |||
| 9b04509433 | |||
| 803ff13bb8 | |||
| 94e46526bc | |||
| d122479687 | |||
| cc52f0e367 | |||
| 87276ef968 | |||
| 002fe46ab3 | |||
| 9d36b2c94d | |||
| c944bed460 | |||
| 2cc060fd76 | |||
| 2bc2f763d9 | |||
| 7fb3feb5cd | |||
| fec7cdf118 | |||
| 03b41ab00f | |||
| 4c974c8fa8 | |||
| b0bee551cb | |||
| b8141aaea8 | |||
| a7ecf781cd | |||
| 6dc4606dcf | |||
| 580d390e4d | |||
| 2bd3ff1eff | |||
| cd79fa8914 | |||
| 59484f066f | |||
| 8a5c0729e5 | |||
| 3b9aed866a | |||
| fb2593e10d | |||
| 207f65deda |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mem0/cli",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.11",
|
||||
"description": "The official CLI for mem0 — the memory layer for AI agents",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -17,6 +17,10 @@ import {
|
||||
type SearchOptions,
|
||||
} from "./base.js";
|
||||
|
||||
function encodePathSegment(value: unknown): string {
|
||||
return encodeURIComponent(String(value));
|
||||
}
|
||||
|
||||
export class PlatformBackend implements Backend {
|
||||
private baseUrl: string;
|
||||
private headers: Record<string, string>;
|
||||
@@ -218,9 +222,13 @@ export class PlatformBackend implements Backend {
|
||||
}
|
||||
|
||||
async get(memoryId: string): Promise<Record<string, unknown>> {
|
||||
return (await this._request("GET", `/v1/memories/${memoryId}/`, {
|
||||
params: { source: "CLI" },
|
||||
})) as Record<string, unknown>;
|
||||
return (await this._request(
|
||||
"GET",
|
||||
`/v1/memories/${encodePathSegment(memoryId)}/`,
|
||||
{
|
||||
params: { source: "CLI" },
|
||||
},
|
||||
)) as Record<string, unknown>;
|
||||
}
|
||||
|
||||
async listMemories(
|
||||
@@ -277,9 +285,13 @@ export class PlatformBackend implements Backend {
|
||||
if (content) payload.text = content;
|
||||
if (metadata) payload.metadata = metadata;
|
||||
payload.source = "CLI";
|
||||
return (await this._request("PUT", `/v1/memories/${memoryId}/`, {
|
||||
json: payload,
|
||||
})) as Record<string, unknown>;
|
||||
return (await this._request(
|
||||
"PUT",
|
||||
`/v1/memories/${encodePathSegment(memoryId)}/`,
|
||||
{
|
||||
json: payload,
|
||||
},
|
||||
)) as Record<string, unknown>;
|
||||
}
|
||||
|
||||
async delete(
|
||||
@@ -297,9 +309,13 @@ export class PlatformBackend implements Backend {
|
||||
})) as Record<string, unknown>;
|
||||
}
|
||||
if (memoryId) {
|
||||
return (await this._request("DELETE", `/v1/memories/${memoryId}/`, {
|
||||
params: { source: "CLI" },
|
||||
})) as Record<string, unknown>;
|
||||
return (await this._request(
|
||||
"DELETE",
|
||||
`/v1/memories/${encodePathSegment(memoryId)}/`,
|
||||
{
|
||||
params: { source: "CLI" },
|
||||
},
|
||||
)) as Record<string, unknown>;
|
||||
}
|
||||
throw new Error("Either memoryId or --all is required");
|
||||
}
|
||||
@@ -323,7 +339,7 @@ export class PlatformBackend implements Backend {
|
||||
for (const [entityType, entityId] of entities) {
|
||||
results[entityType] = (await this._request(
|
||||
"DELETE",
|
||||
`/v2/entities/${entityType}/${entityId}/`,
|
||||
`/v2/entities/${encodePathSegment(entityType)}/${encodePathSegment(entityId)}/`,
|
||||
{ params: { source: "CLI" } },
|
||||
)) as Record<string, unknown>;
|
||||
}
|
||||
@@ -386,9 +402,9 @@ export class PlatformBackend implements Backend {
|
||||
}
|
||||
|
||||
async getEvent(eventId: string): Promise<Record<string, unknown>> {
|
||||
return (await this._request("GET", `/v1/event/${eventId}/`)) as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
return (await this._request(
|
||||
"GET",
|
||||
`/v1/event/${encodePathSegment(eventId)}/`,
|
||||
)) as Record<string, unknown>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
/**
|
||||
* `mem0 agent-rush <add|search> "..."` — wraps the AGENTRUSH platform endpoints.
|
||||
* Project routing is implicit (server-side); zero flags needed.
|
||||
*/
|
||||
|
||||
import readline from "node:readline";
|
||||
import { colors, printError, printSuccess } from "../branding.js";
|
||||
import { loadConfig, saveConfig } from "../config.js";
|
||||
import { CLI_VERSION } from "../version.js";
|
||||
|
||||
const PII_WARNING = [
|
||||
"",
|
||||
"⚠️ AGENTRUSH memories are PUBLIC — visible to any other player.",
|
||||
" Do not include real names, emails, secrets, work content, or PII.",
|
||||
"",
|
||||
].join("\n");
|
||||
|
||||
const ERROR_HINTS: Record<string, string> = {
|
||||
agentrush_search_first:
|
||||
"Run 3 'mem0 agent-rush search' commands before adding.",
|
||||
agentrush_search_quota: "You've used your 3 lifetime searches.",
|
||||
agentrush_add_quota: "You've used your 3 lifetime adds.",
|
||||
agentrush_not_agent_mode:
|
||||
"Re-run 'mem0 init --agent' to bootstrap an agent-mode key.",
|
||||
agentrush_length: "Memory text must be 50-1000 characters.",
|
||||
agentrush_no_urls: "URLs are not allowed.",
|
||||
agentrush_blocklist: "Content contains a blocked term.",
|
||||
agentrush_global_quota: "Event-wide cap reached. Try again later.",
|
||||
agentrush_not_provisioned:
|
||||
"AGENTRUSH is not provisioned in this environment.",
|
||||
};
|
||||
|
||||
async function callEndpoint(
|
||||
path: string,
|
||||
body: Record<string, unknown>,
|
||||
): Promise<unknown> {
|
||||
const config = loadConfig();
|
||||
const baseUrl = (config.platform?.baseUrl ?? "https://api.mem0.ai").replace(
|
||||
/\/+$/,
|
||||
"",
|
||||
);
|
||||
|
||||
if (!config.platform?.apiKey) {
|
||||
printError("Not initialized. Run `mem0 init --agent` first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const resp = await fetch(`${baseUrl}${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Token ${config.platform.apiKey}`,
|
||||
"Content-Type": "application/json",
|
||||
"X-Mem0-Source": "cli",
|
||||
"X-Mem0-Client-Language": "node",
|
||||
"X-Mem0-Client-Version": CLI_VERSION,
|
||||
"X-Mem0-Mode": "agent-rush",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: AbortSignal.timeout(30_000),
|
||||
});
|
||||
|
||||
const json = await resp.json().catch(() => ({}));
|
||||
|
||||
if (!resp.ok) {
|
||||
const code =
|
||||
(json as { error?: { code?: string } }).error?.code ?? "unknown";
|
||||
printError(`AGENTRUSH error: ${code}`);
|
||||
if (ERROR_HINTS[code]) {
|
||||
console.log(` ${colors.dim(ERROR_HINTS[code])}`);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
function promptLine(question: string): Promise<string> {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
rl.question(question, (answer) => {
|
||||
rl.close();
|
||||
resolve(answer.trim());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the human has acknowledged that AGENTRUSH memories are PUBLIC.
|
||||
*
|
||||
* Interactive (TTY): show the prompt; on "y" persist `agentRush.acknowledgedAt`
|
||||
* so we never ask the same machine twice. On anything else, abort.
|
||||
*
|
||||
* Non-interactive (agent invocation, no TTY): print the warning to stderr
|
||||
* for the human reading the agent's transcript and proceed — agents can't
|
||||
* answer y/N prompts.
|
||||
*/
|
||||
async function ensureWarningAcknowledged(): Promise<void> {
|
||||
const config = loadConfig();
|
||||
if (config.agentRush?.acknowledgedAt) return;
|
||||
|
||||
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
||||
// Agent context: surface the warning to stderr, don't block.
|
||||
console.error(PII_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(PII_WARNING);
|
||||
const answer = (await promptLine(" Continue? [y/N]: ")).toLowerCase();
|
||||
if (answer !== "y" && answer !== "yes") {
|
||||
printError("Aborted.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
config.agentRush.acknowledgedAt = new Date().toISOString();
|
||||
saveConfig(config);
|
||||
}
|
||||
|
||||
export async function cmdAgentRushAdd(content: string): Promise<void> {
|
||||
await ensureWarningAcknowledged();
|
||||
const result = await callEndpoint("/v1/agent-rush/memories/", { content });
|
||||
printSuccess(
|
||||
`Memory submitted (event_id: ${(result as { event_id?: string }).event_id ?? "?"})`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function cmdAgentRushSearch(query: string): Promise<void> {
|
||||
const result = (await callEndpoint("/v1/agent-rush/memories/search/", {
|
||||
query,
|
||||
})) as {
|
||||
results?: Array<{ memory?: string }>;
|
||||
memories?: Array<{ memory?: string }>;
|
||||
};
|
||||
|
||||
const memories = result.results ?? result.memories ?? [];
|
||||
|
||||
if (memories.length === 0) {
|
||||
console.log(colors.dim("(no results)"));
|
||||
return;
|
||||
}
|
||||
|
||||
memories.slice(0, 5).forEach((m, i) => {
|
||||
console.log(` ${i + 1}. ${m.memory ?? JSON.stringify(m)}`);
|
||||
});
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* `mem0 whoami` — print the active agent's default_user_id (AGENTRUSH identifier).
|
||||
* `mem0 whoami` — print the active agent's default_user_id.
|
||||
* Reads from local config; no network call.
|
||||
*/
|
||||
|
||||
import { colors, printError, printInfo } from "../branding.js";
|
||||
import { colors, printError } from "../branding.js";
|
||||
import { loadConfig } from "../config.js";
|
||||
|
||||
export async function cmdWhoami(): Promise<void> {
|
||||
@@ -13,6 +13,5 @@ export async function cmdWhoami(): Promise<void> {
|
||||
printError("No default_user_id found. Run `mem0 init --agent` first.");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Your AGENTRUSH identifier: ${colors.brand(sessionId)}`);
|
||||
printInfo("Find your row at https://mem0.ai/agentrush");
|
||||
console.log(`Your user_id: ${colors.brand(sessionId)}`);
|
||||
}
|
||||
|
||||
@@ -40,18 +40,11 @@ export interface TelemetryConfig {
|
||||
anonymousId: string;
|
||||
}
|
||||
|
||||
export interface AgentRushConfig {
|
||||
// ISO timestamp the human acknowledged the "memories are public" warning.
|
||||
// Empty until first interactive `mem0 agent-rush add`.
|
||||
acknowledgedAt: string;
|
||||
}
|
||||
|
||||
export interface Mem0Config {
|
||||
version: number;
|
||||
defaults: DefaultsConfig;
|
||||
platform: PlatformConfig;
|
||||
telemetry: TelemetryConfig;
|
||||
agentRush: AgentRushConfig;
|
||||
}
|
||||
|
||||
export function createDefaultConfig(): Mem0Config {
|
||||
@@ -76,9 +69,6 @@ export function createDefaultConfig(): Mem0Config {
|
||||
telemetry: {
|
||||
anonymousId: "",
|
||||
},
|
||||
agentRush: {
|
||||
acknowledgedAt: "",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -113,8 +103,6 @@ export function loadConfig(): Mem0Config {
|
||||
config.defaults.runId = defaults.run_id ?? "";
|
||||
const telemetry = data.telemetry ?? {};
|
||||
config.telemetry.anonymousId = telemetry.anonymous_id ?? "";
|
||||
const agentRush = data.agent_rush ?? {};
|
||||
config.agentRush.acknowledgedAt = agentRush.acknowledged_at ?? "";
|
||||
}
|
||||
|
||||
// Environment variable overrides
|
||||
@@ -155,9 +143,6 @@ export function saveConfig(config: Mem0Config): void {
|
||||
telemetry: {
|
||||
anonymous_id: config.telemetry.anonymousId,
|
||||
},
|
||||
agent_rush: {
|
||||
acknowledged_at: config.agentRush.acknowledgedAt,
|
||||
},
|
||||
};
|
||||
|
||||
fs.writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2));
|
||||
|
||||
@@ -266,44 +266,12 @@ program
|
||||
|
||||
program
|
||||
.command("whoami")
|
||||
.description("Print the active agent's AGENTRUSH identifier.")
|
||||
.description("Print your user_id (default_user_id).")
|
||||
.action(async () => {
|
||||
const { cmdWhoami } = await import("./commands/whoami.js");
|
||||
await cmdWhoami();
|
||||
});
|
||||
|
||||
// ── AGENTRUSH subcommand group ────────────────────────────────────────────
|
||||
|
||||
const agentRush = program
|
||||
.command("agent-rush")
|
||||
.description("AGENTRUSH game commands.")
|
||||
.addHelpCommand(false)
|
||||
.configureHelp({ formatHelp: richFormatHelp });
|
||||
|
||||
agentRush
|
||||
.command("add <content...>")
|
||||
.description("Submit a memory to AGENTRUSH.")
|
||||
.addHelpText(
|
||||
"after",
|
||||
'\nExamples:\n $ mem0 agent-rush add "I used mem0 to build a coding agent"\n $ mem0 agent-rush add "Agents that remember are better agents"',
|
||||
)
|
||||
.action(async (parts: string[]) => {
|
||||
const { cmdAgentRushAdd } = await import("./commands/agent-rush.js");
|
||||
await cmdAgentRushAdd(parts.join(" "));
|
||||
});
|
||||
|
||||
agentRush
|
||||
.command("search <query...>")
|
||||
.description("Search AGENTRUSH memories.")
|
||||
.addHelpText(
|
||||
"after",
|
||||
'\nExamples:\n $ mem0 agent-rush search "agents and memory and tools"\n $ mem0 agent-rush search "coding assistant"',
|
||||
)
|
||||
.action(async (parts: string[]) => {
|
||||
const { cmdAgentRushSearch } = await import("./commands/agent-rush.js");
|
||||
await cmdAgentRushSearch(parts.join(" "));
|
||||
});
|
||||
|
||||
// ── Memory: add ───────────────────────────────────────────────────────────
|
||||
|
||||
program
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Tests for the Platform backend (mem0 Platform API client).
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { PlatformBackend } from "../src/backend/platform.js";
|
||||
import { createDefaultConfig } from "../src/config.js";
|
||||
|
||||
@@ -12,6 +12,22 @@ function makeBackend(): PlatformBackend {
|
||||
return new PlatformBackend(createDefaultConfig().platform);
|
||||
}
|
||||
|
||||
function mockFetch() {
|
||||
const fetchMock = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
status: 200,
|
||||
headers: { get: vi.fn().mockReturnValue(null) },
|
||||
json: vi.fn().mockResolvedValue({ message: "ok" }),
|
||||
});
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
return fetchMock;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
describe("deleteEntities", () => {
|
||||
it("returns all results keyed by entity type for a multi-entity delete", async () => {
|
||||
const backend = makeBackend();
|
||||
@@ -50,3 +66,35 @@ describe("deleteEntities", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("PlatformBackend path encoding", () => {
|
||||
it("encodes memory IDs before interpolating them into paths", async () => {
|
||||
const fetchMock = mockFetch();
|
||||
const backend = makeBackend();
|
||||
|
||||
await backend.get("mem/a?b#c");
|
||||
await backend.update("mem/a?b#c", "updated");
|
||||
await backend.delete("mem/a?b#c");
|
||||
|
||||
const urls = fetchMock.mock.calls.map((call) => call[0]);
|
||||
expect(urls).toEqual([
|
||||
"https://api.mem0.ai/v1/memories/mem%2Fa%3Fb%23c/?source=CLI",
|
||||
"https://api.mem0.ai/v1/memories/mem%2Fa%3Fb%23c/",
|
||||
"https://api.mem0.ai/v1/memories/mem%2Fa%3Fb%23c/?source=CLI",
|
||||
]);
|
||||
});
|
||||
|
||||
it("encodes entity and event IDs before interpolating them into paths", async () => {
|
||||
const fetchMock = mockFetch();
|
||||
const backend = makeBackend();
|
||||
|
||||
await backend.deleteEntities({ userId: "org/team?active#frag" });
|
||||
await backend.getEvent("evt/a?b#c");
|
||||
|
||||
const urls = fetchMock.mock.calls.map((call) => call[0]);
|
||||
expect(urls).toEqual([
|
||||
"https://api.mem0.ai/v2/entities/user/org%2Fteam%3Factive%23frag/?source=CLI",
|
||||
"https://api.mem0.ai/v1/event/evt%2Fa%3Fb%23c/",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "mem0-cli"
|
||||
version = "0.2.9"
|
||||
version = "0.2.10"
|
||||
description = "The official CLI for mem0 — the memory layer for AI agents"
|
||||
readme = "README.md"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""mem0 CLI — the command-line interface for the mem0 memory layer."""
|
||||
|
||||
__version__ = "0.2.9"
|
||||
__version__ = "0.2.10"
|
||||
|
||||
@@ -916,7 +916,7 @@ def identify(
|
||||
|
||||
@app.command(name="whoami", rich_help_panel="Setup")
|
||||
def whoami_cmd() -> None:
|
||||
"""Print your AGENTRUSH identifier (default_user_id).
|
||||
"""Print your user_id (default_user_id).
|
||||
|
||||
Example:
|
||||
mem0 whoami
|
||||
@@ -926,53 +926,6 @@ def whoami_cmd() -> None:
|
||||
run_whoami()
|
||||
|
||||
|
||||
# ── AGENTRUSH sub-app ─────────────────────────────────────────────────────
|
||||
|
||||
agent_rush_app = typer.Typer(
|
||||
name="agent-rush",
|
||||
help="AGENTRUSH game commands",
|
||||
no_args_is_help=True,
|
||||
rich_markup_mode="rich",
|
||||
)
|
||||
|
||||
|
||||
@agent_rush_app.callback(invoke_without_command=True)
|
||||
def _agent_rush_callback(ctx: typer.Context) -> None:
|
||||
if ctx.invoked_subcommand:
|
||||
_fire_telemetry(f"agent-rush.{ctx.invoked_subcommand}")
|
||||
|
||||
|
||||
@agent_rush_app.command(name="add")
|
||||
def agent_rush_add(
|
||||
content: str = typer.Argument(..., help="Memory content (50-1000 characters, no URLs)."),
|
||||
) -> None:
|
||||
"""Submit a memory to AGENTRUSH.
|
||||
|
||||
Example:
|
||||
mem0 agent-rush add "I enjoy solving constraint-satisfaction problems."
|
||||
"""
|
||||
from mem0_cli.commands.agent_rush_cmd import run_agent_rush_add
|
||||
|
||||
run_agent_rush_add(content)
|
||||
|
||||
|
||||
@agent_rush_app.command(name="search")
|
||||
def agent_rush_search(
|
||||
query: str = typer.Argument(..., help="Search query."),
|
||||
) -> None:
|
||||
"""Search AGENTRUSH memories.
|
||||
|
||||
Example:
|
||||
mem0 agent-rush search "constraint satisfaction"
|
||||
"""
|
||||
from mem0_cli.commands.agent_rush_cmd import run_agent_rush_search
|
||||
|
||||
run_agent_rush_search(query)
|
||||
|
||||
|
||||
app.add_typer(agent_rush_app, name="agent-rush", rich_help_panel="Setup")
|
||||
|
||||
|
||||
# (entity_app registered at module level, below sub-group definitions)
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
@@ -11,6 +12,10 @@ from mem0_cli.backend.base import Backend
|
||||
from mem0_cli.config import PlatformConfig
|
||||
|
||||
|
||||
def _encode_path_segment(value: Any) -> str:
|
||||
return quote(str(value), safe="")
|
||||
|
||||
|
||||
class PlatformBackend(Backend):
|
||||
"""Backend that talks to the mem0 Platform API."""
|
||||
|
||||
@@ -196,7 +201,11 @@ class PlatformBackend(Backend):
|
||||
)
|
||||
|
||||
def get(self, memory_id: str) -> dict:
|
||||
return self._request("GET", f"/v1/memories/{memory_id}/", params={"source": "CLI"})
|
||||
return self._request(
|
||||
"GET",
|
||||
f"/v1/memories/{_encode_path_segment(memory_id)}/",
|
||||
params={"source": "CLI"},
|
||||
)
|
||||
|
||||
def list_memories(
|
||||
self,
|
||||
@@ -250,7 +259,11 @@ class PlatformBackend(Backend):
|
||||
if metadata:
|
||||
payload["metadata"] = metadata
|
||||
payload["source"] = "CLI"
|
||||
return self._request("PUT", f"/v1/memories/{memory_id}/", json=payload)
|
||||
return self._request(
|
||||
"PUT",
|
||||
f"/v1/memories/{_encode_path_segment(memory_id)}/",
|
||||
json=payload,
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
@@ -274,7 +287,11 @@ class PlatformBackend(Backend):
|
||||
params["run_id"] = run_id
|
||||
return self._request("DELETE", "/v1/memories/", params=params)
|
||||
elif memory_id:
|
||||
return self._request("DELETE", f"/v1/memories/{memory_id}/", params={"source": "CLI"})
|
||||
return self._request(
|
||||
"DELETE",
|
||||
f"/v1/memories/{_encode_path_segment(memory_id)}/",
|
||||
params={"source": "CLI"},
|
||||
)
|
||||
else:
|
||||
raise ValueError("Either memory_id or --all is required")
|
||||
|
||||
@@ -302,7 +319,9 @@ class PlatformBackend(Backend):
|
||||
results: dict = {}
|
||||
for entity_type, entity_id in entities.items():
|
||||
results[entity_type] = self._request(
|
||||
"DELETE", f"/v2/entities/{entity_type}/{entity_id}/", params={"source": "CLI"}
|
||||
"DELETE",
|
||||
f"/v2/entities/{_encode_path_segment(entity_type)}/{_encode_path_segment(entity_id)}/",
|
||||
params={"source": "CLI"},
|
||||
)
|
||||
return results
|
||||
|
||||
@@ -348,7 +367,7 @@ class PlatformBackend(Backend):
|
||||
return result if isinstance(result, list) else result.get("results", [])
|
||||
|
||||
def get_event(self, event_id: str) -> dict:
|
||||
return self._request("GET", f"/v1/event/{event_id}/")
|
||||
return self._request("GET", f"/v1/event/{_encode_path_segment(event_id)}/")
|
||||
|
||||
|
||||
class AuthError(Exception):
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
"""mem0 agent-rush — AGENTRUSH game commands.
|
||||
|
||||
Wraps the platform's /v1/agent-rush/{memories/, memories/search/} endpoints.
|
||||
Hardcoded routing; no flags needed.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import httpx
|
||||
import typer
|
||||
from rich.console import Console
|
||||
|
||||
from mem0_cli.branding import print_error, print_success
|
||||
from mem0_cli.config import load_config, save_config
|
||||
|
||||
console = Console()
|
||||
err_console = Console(stderr=True)
|
||||
|
||||
_PII_WARNING_LINES = (
|
||||
"",
|
||||
"[yellow]⚠️ AGENTRUSH memories are PUBLIC — visible to any other player.[/yellow]",
|
||||
"[yellow] Do not include real names, emails, secrets, work content, or PII.[/yellow]",
|
||||
"",
|
||||
)
|
||||
|
||||
_SOURCE_HEADERS = {
|
||||
"X-Mem0-Source": "cli",
|
||||
"X-Mem0-Client-Language": "python",
|
||||
"X-Mem0-Mode": "agent-rush",
|
||||
}
|
||||
|
||||
_ERROR_HINTS = {
|
||||
"agentrush_search_first": "Run 3 'mem0 agent-rush search' commands before adding.",
|
||||
"agentrush_search_quota": "You've used your 3 lifetime searches.",
|
||||
"agentrush_add_quota": "You've used your 3 lifetime adds.",
|
||||
"agentrush_not_agent_mode": "Re-run 'mem0 init --agent' to bootstrap an agent-mode key.",
|
||||
"agentrush_length": "Memory text must be 50-1000 characters.",
|
||||
"agentrush_no_urls": "URLs are not allowed.",
|
||||
"agentrush_blocklist": "Content contains a blocked term.",
|
||||
"agentrush_global_quota": "Event-wide cap reached. Try again later.",
|
||||
"agentrush_not_provisioned": "AGENTRUSH is not provisioned in this environment.",
|
||||
}
|
||||
|
||||
|
||||
def _call(path: str, body: dict) -> dict:
|
||||
config = load_config()
|
||||
if not config.platform.api_key:
|
||||
print_error(err_console, "Not initialized. Run `mem0 init --agent` first.")
|
||||
raise typer.Exit(1)
|
||||
base_url = (config.platform.base_url or "https://api.mem0.ai").rstrip("/")
|
||||
try:
|
||||
with httpx.Client(timeout=30.0) as client:
|
||||
resp = client.post(
|
||||
f"{base_url}{path}",
|
||||
headers={
|
||||
**_SOURCE_HEADERS,
|
||||
"Authorization": f"Token {config.platform.api_key}",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
json=body,
|
||||
)
|
||||
except httpx.HTTPError as exc:
|
||||
print_error(err_console, f"Network error: {exc}")
|
||||
raise typer.Exit(1) from exc
|
||||
try:
|
||||
data = resp.json()
|
||||
except Exception:
|
||||
data = {}
|
||||
if resp.status_code >= 400:
|
||||
code = (
|
||||
(data.get("error") or {}).get("code", "unknown")
|
||||
if isinstance(data, dict)
|
||||
else "unknown"
|
||||
)
|
||||
print_error(err_console, f"AGENTRUSH error: {code}")
|
||||
hint = _ERROR_HINTS.get(code)
|
||||
if hint:
|
||||
console.print(f" [dim]{hint}[/dim]")
|
||||
raise typer.Exit(1)
|
||||
return data
|
||||
|
||||
|
||||
def _ensure_warning_acknowledged() -> None:
|
||||
"""Block the first interactive add on the PII warning; pass-through for agents.
|
||||
|
||||
Interactive (TTY): show prompt, require explicit 'y', persist
|
||||
`agent_rush.acknowledged_at` so we never ask the same machine twice.
|
||||
|
||||
Non-interactive (no TTY — typical when an agent runs the CLI): surface
|
||||
the warning to stderr for the human reading the agent transcript and
|
||||
proceed without prompting (agents can't answer y/N).
|
||||
"""
|
||||
config = load_config()
|
||||
if config.agent_rush.acknowledged_at:
|
||||
return
|
||||
|
||||
is_tty = sys.stdin.isatty() and sys.stdout.isatty()
|
||||
if not is_tty:
|
||||
for line in _PII_WARNING_LINES:
|
||||
err_console.print(line)
|
||||
return
|
||||
|
||||
for line in _PII_WARNING_LINES:
|
||||
console.print(line)
|
||||
answer = typer.prompt(" Continue? [y/N]", default="N", show_default=False).strip().lower()
|
||||
if answer not in ("y", "yes"):
|
||||
print_error(err_console, "Aborted.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
config.agent_rush.acknowledged_at = datetime.now(timezone.utc).isoformat()
|
||||
save_config(config)
|
||||
|
||||
|
||||
def run_agent_rush_add(content: str) -> None:
|
||||
_ensure_warning_acknowledged()
|
||||
result = _call("/v1/agent-rush/memories/", {"content": content})
|
||||
event_id = result.get("event_id", "?")
|
||||
print_success(console, f"Memory submitted (event_id: {event_id})")
|
||||
|
||||
|
||||
def run_agent_rush_search(query: str) -> None:
|
||||
result = _call("/v1/agent-rush/memories/search/", {"query": query})
|
||||
memories = result.get("results") or result.get("memories") or []
|
||||
if not memories:
|
||||
console.print("[dim](no results)[/dim]")
|
||||
return
|
||||
for i, m in enumerate(memories[:5], start=1):
|
||||
text = m.get("memory") if isinstance(m, dict) else str(m)
|
||||
console.print(f" {i}. {text}")
|
||||
@@ -1,11 +1,11 @@
|
||||
"""mem0 whoami — print the active agent's default_user_id (AGENTRUSH identifier)."""
|
||||
"""mem0 whoami — print the active agent's default_user_id."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import typer
|
||||
from rich.console import Console
|
||||
|
||||
from mem0_cli.branding import BRAND_COLOR, print_error, print_info
|
||||
from mem0_cli.branding import BRAND_COLOR, print_error
|
||||
from mem0_cli.config import load_config
|
||||
|
||||
console = Console()
|
||||
@@ -21,5 +21,4 @@ def run_whoami() -> None:
|
||||
"No default_user_id found. Run `mem0 init --agent` first.",
|
||||
)
|
||||
raise typer.Exit(1)
|
||||
console.print(f"Your AGENTRUSH identifier: [{BRAND_COLOR}]{session_id}[/{BRAND_COLOR}]")
|
||||
print_info(console, "Find your row at https://mem0.ai/agentrush")
|
||||
console.print(f"Your user_id: [{BRAND_COLOR}]{session_id}[/{BRAND_COLOR}]")
|
||||
|
||||
@@ -51,20 +51,12 @@ class TelemetryConfig:
|
||||
anonymous_id: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class AgentRushConfig:
|
||||
# ISO timestamp the human acknowledged the "memories are public" warning.
|
||||
# Empty until first interactive `mem0 agent-rush add`.
|
||||
acknowledged_at: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class Mem0Config:
|
||||
version: int = CONFIG_VERSION
|
||||
defaults: DefaultsConfig = field(default_factory=DefaultsConfig)
|
||||
platform: PlatformConfig = field(default_factory=PlatformConfig)
|
||||
telemetry: TelemetryConfig = field(default_factory=TelemetryConfig)
|
||||
agent_rush: AgentRushConfig = field(default_factory=AgentRushConfig)
|
||||
|
||||
|
||||
SHORT_KEY_ALIASES: dict[str, str] = {
|
||||
@@ -113,9 +105,6 @@ def load_config() -> Mem0Config:
|
||||
telemetry = data.get("telemetry", {})
|
||||
config.telemetry.anonymous_id = telemetry.get("anonymous_id", "")
|
||||
|
||||
agent_rush = data.get("agent_rush", {})
|
||||
config.agent_rush.acknowledged_at = agent_rush.get("acknowledged_at", "")
|
||||
|
||||
# Environment variable overrides
|
||||
env_key = os.environ.get("MEM0_API_KEY")
|
||||
if env_key:
|
||||
@@ -169,9 +158,6 @@ def save_config(config: Mem0Config) -> None:
|
||||
"telemetry": {
|
||||
"anonymous_id": config.telemetry.anonymous_id,
|
||||
},
|
||||
"agent_rush": {
|
||||
"acknowledged_at": config.agent_rush.acknowledged_at,
|
||||
},
|
||||
}
|
||||
|
||||
with open(CONFIG_FILE, "w") as f:
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from mem0_cli.backend.platform import PlatformBackend
|
||||
|
||||
|
||||
def _backend(sample_config):
|
||||
backend = PlatformBackend(sample_config.platform)
|
||||
backend._client = MagicMock()
|
||||
backend._client.request.return_value = MagicMock(
|
||||
status_code=200,
|
||||
json=lambda: {"message": "ok"},
|
||||
headers={},
|
||||
raise_for_status=lambda: None,
|
||||
)
|
||||
return backend
|
||||
|
||||
|
||||
def test_memory_id_path_segments_are_encoded(sample_config):
|
||||
backend = _backend(sample_config)
|
||||
|
||||
backend.get("mem/a?b#c")
|
||||
backend.update("mem/a?b#c", content="updated")
|
||||
backend.delete("mem/a?b#c")
|
||||
|
||||
paths = [call.args[1] for call in backend._client.request.call_args_list]
|
||||
assert paths == [
|
||||
"/v1/memories/mem%2Fa%3Fb%23c/",
|
||||
"/v1/memories/mem%2Fa%3Fb%23c/",
|
||||
"/v1/memories/mem%2Fa%3Fb%23c/",
|
||||
]
|
||||
|
||||
|
||||
def test_entity_and_event_path_segments_are_encoded(sample_config):
|
||||
backend = _backend(sample_config)
|
||||
|
||||
backend.delete_entities(user_id="org/team?active#frag")
|
||||
backend.get_event("evt/a?b#c")
|
||||
|
||||
paths = [call.args[1] for call in backend._client.request.call_args_list]
|
||||
assert paths == [
|
||||
"/v2/entities/user/org%2Fteam%3Factive%23frag/",
|
||||
"/v1/event/evt%2Fa%3Fb%23c/",
|
||||
]
|
||||
@@ -24,7 +24,7 @@ mintlify dev
|
||||
|
||||
### Publishing Changes
|
||||
|
||||
Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
|
||||
Install our GitHub App to auto-propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{/* Subtle, value-anchored nudge to star the repo. Drop in at peak-end "win" moments in the OSS docs (after a successful add/search, a server bootstrap, etc.). Keep it off the Platform/API pages. */}
|
||||
{/* Clicks are tracked via PostHog autocapture: the data-ph-capture-attribute-cta below tags each click with cta="star-on-github" so it's filterable as an event property. Metric = count of $autocapture where cta = star-on-github; break down by Current URL to see which win-moment converts. */}
|
||||
<Callout icon="star" iconType="solid" color="#FACC15">
|
||||
**Using Mem0?** <a href="https://github.com/mem0ai/mem0" data-ph-capture-attribute-cta="star-on-github">Star us on GitHub</a> to help more developers discover memory for AI apps.
|
||||
</Callout>
|
||||
@@ -97,7 +97,7 @@ Get your API key from the <a href="https://app.mem0.ai/dashboard/api-keys?utm_so
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Add Your First Memory" icon="rocket" href="/api-reference/memory/add-memories">
|
||||
Start storing memories via the REST API
|
||||
</Card>
|
||||
@@ -105,4 +105,8 @@ Get your API key from the <a href="https://app.mem0.ai/dashboard/api-keys?utm_so
|
||||
<Card title="Search with Filters" icon="filter" href="/api-reference/memory/search-memories">
|
||||
Learn advanced search and filtering techniques
|
||||
</Card>
|
||||
|
||||
<Card title="Build with cookbooks" icon="book-open" href="/cookbooks/overview">
|
||||
See the API used end to end in real projects.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -1606,6 +1606,15 @@ See the [TypeScript SDK migration guide](https://docs.mem0.ai/migration/ts-v2-to
|
||||
|
||||
<Tab title="CLI">
|
||||
|
||||
<Update label="2026-07-07" description="Python v0.2.10 / Node v0.2.11">
|
||||
|
||||
**Changes:**
|
||||
- **`mem0 agent-rush` removed:** The AGENTRUSH game has ended; the `agent-rush add` and `agent-rush search` commands are removed from both CLIs.
|
||||
- **`mem0 whoami` output:** Now prints `Your user_id: <default_user_id>` instead of the AGENTRUSH-branded line. The value and the exit-code behavior are unchanged.
|
||||
- **Config schema:** The `agent_rush.acknowledged_at` key is no longer read or written. Existing config files that still contain it are unaffected; the key is ignored.
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="2026-07-01" description="Python v0.2.9 / Node v0.2.10">
|
||||
|
||||
**Bug Fixes:**
|
||||
|
||||
@@ -3,7 +3,7 @@ title: Azure OpenAI
|
||||
description: "Configure Azure OpenAI as an embedding provider in Mem0 with API key, deployment, and endpoint settings."
|
||||
---
|
||||
|
||||
To use Azure OpenAI embedding models, set the `EMBEDDING_AZURE_OPENAI_API_KEY`, `EMBEDDING_AZURE_DEPLOYMENT`, `EMBEDDING_AZURE_ENDPOINT` and `EMBEDDING_AZURE_API_VERSION` environment variables. You can obtain the Azure OpenAI API key from the Azure.
|
||||
To use Azure OpenAI embedding models, set the `EMBEDDING_AZURE_OPENAI_API_KEY`, `EMBEDDING_AZURE_DEPLOYMENT`, `EMBEDDING_AZURE_ENDPOINT` and `EMBEDDING_AZURE_API_VERSION` environment variables. You can obtain the Azure OpenAI API key from the Azure Portal.
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
@@ -7,10 +7,18 @@ You can use FastEmbed to run embedding models locally in Mem0. FastEmbed is an O
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
FastEmbed is an optional dependency, so install it alongside Mem0.
|
||||
|
||||
<CodeGroup>
|
||||
```bash Python
|
||||
pip install fastembed
|
||||
```
|
||||
|
||||
```bash TypeScript
|
||||
npm install fastembed
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Usage
|
||||
|
||||
<CodeGroup>
|
||||
@@ -38,13 +46,66 @@ messages = [
|
||||
]
|
||||
m.add(messages, user_id="john")
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
// FastEmbed needs no API key. Leave the embedder config empty to use the
|
||||
// default model (fast-bge-small-en-v1.5), or set `model` to one of the
|
||||
// supported models listed below.
|
||||
const memory = new Memory({
|
||||
embedder: {
|
||||
provider: "fastembed",
|
||||
config: {
|
||||
model: "fast-bge-small-en-v1.5",
|
||||
},
|
||||
},
|
||||
llm: {
|
||||
provider: "openai",
|
||||
config: { apiKey: process.env.OPENAI_API_KEY }, // For fact extraction
|
||||
},
|
||||
});
|
||||
|
||||
const 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." },
|
||||
];
|
||||
await memory.add(messages, { userId: "john" });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
**The Python and TypeScript SDKs default to different models.** Python defaults to `thenlper/gte-large` (1024 dimensions), while TypeScript defaults to `fast-bge-small-en-v1.5` (384 dimensions). The TypeScript package (`fastembed` on npm) ships a fixed set of ONNX models and does not include `thenlper/gte-large`. Because the two defaults produce vectors of different dimensions, do not point both SDKs at the same vector store collection unless you configure them to use the same model.
|
||||
</Note>
|
||||
|
||||
The TypeScript SDK supports these FastEmbed models. Pass the exact string as `model`:
|
||||
|
||||
- `fast-bge-small-en-v1.5` (default)
|
||||
- `fast-bge-small-en`
|
||||
- `fast-bge-base-en`
|
||||
- `fast-bge-base-en-v1.5`
|
||||
- `fast-bge-small-zh-v1.5`
|
||||
- `fast-all-MiniLM-L6-v2`
|
||||
- `fast-multilingual-e5-large`
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring FastEmbed embedder:
|
||||
Here are the parameters available for configuring the FastEmbed embedder:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `model` | The name of the FastEmbed model to use | `thenlper/gte-large` |
|
||||
| `embedding_dims` | Dimensions of the embedding model (auto-derived from the model if not set) | `None` |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `model` | The FastEmbed model to use (see the supported list above) | `fast-bge-small-en-v1.5` |
|
||||
|
||||
The embedding dimension is detected automatically at startup, so you do not need to set it manually.
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
---
|
||||
title: Together
|
||||
description: "Configure Together AI as an embedding provider in Mem0 with support for 768-dimensional embedding models."
|
||||
description: "Configure Together AI as an embedding provider in Mem0 with support for 1024-dimensional embedding models."
|
||||
---
|
||||
|
||||
To use Together embedding models, set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from the [Together Platform](https://api.together.xyz/settings/api-keys).
|
||||
To use Together embedding models, set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from the [Together Platform](https://api.together.ai/settings/projects/~current/api-keys).
|
||||
|
||||
### Usage
|
||||
|
||||
<Note> The `embedding_model_dims` parameter for `vector_store` should be set to `768` for Together embedder. </Note>
|
||||
<Note> The `embedding_model_dims` parameter for `vector_store` should be set to `1024` for Together embedder. </Note>
|
||||
|
||||
```python
|
||||
<Warning>
|
||||
**Breaking default change.** The default Together embedding model is now `intfloat/multilingual-e5-large-instruct` (**1024-dim**), replacing the previous default `togethercomputer/m2-bert-80M-8k-retrieval` (**768-dim**). If you created a self-hosted vector store with the old default, its collection is 768-dim and will reject the new 1024-dim vectors **recreate/reindex the collection at 1024 dimensions** after upgrading. To defer the change, pin the previous values explicitly (`model="togethercomputer/m2-bert-80M-8k-retrieval"`, `embedding_dims=768`) note Together no longer lists this model among its recommended embeddings, so reindexing at 1024 is the durable path.
|
||||
</Warning>
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -20,7 +25,7 @@ config = {
|
||||
"embedder": {
|
||||
"provider": "together",
|
||||
"config": {
|
||||
"model": "togethercomputer/m2-bert-80M-8k-retrieval"
|
||||
"model": "intfloat/multilingual-e5-large-instruct"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,18 +34,50 @@ m = Memory.from_config(config)
|
||||
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": "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."}
|
||||
]
|
||||
m.add(messages, user_id="john")
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
const config = {
|
||||
embedder: {
|
||||
provider: 'together',
|
||||
config: {
|
||||
apiKey: process.env.TOGETHER_API_KEY || '',
|
||||
model: 'intfloat/multilingual-e5-large-instruct',
|
||||
embeddingDims: 1024,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
await memory.add("I'm visiting Paris", { userId: "john" });
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Together embedder:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `model` | The name of the embedding model to use | `togethercomputer/m2-bert-80M-8k-retrieval` |
|
||||
| `embedding_dims` | Dimensions of the embedding model | `768` |
|
||||
| `model` | The name of the embedding model to use | `intfloat/multilingual-e5-large-instruct` |
|
||||
| `embedding_dims` | Dimensions of the embedding model | `1024` |
|
||||
| `api_key` | The Together API key | `None` |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `model` | The name of the embedding model to use | `intfloat/multilingual-e5-large-instruct` |
|
||||
| `embeddingDims` | Dimensions of the embedding model for vector store configuration | `1024` |
|
||||
| `apiKey` | The Together API key | `TOGETHER_API_KEY` |
|
||||
| `baseURL` | Base URL for an OpenAI-compatible Together endpoint | `https://api.together.ai/v1` |
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
@@ -10,21 +10,21 @@ Mem0 offers support for various embedding models, allowing users to choose the o
|
||||
See the list of supported embedders below.
|
||||
|
||||
<Note>
|
||||
All embedders listed below are supported in the Python implementation. The TypeScript implementation supports: **OpenAI**, **Azure OpenAI**, **Google AI**, **Langchain**, **LM Studio**, and **Ollama**.
|
||||
All embedders listed below are supported in the Python implementation. The TypeScript implementation supports: **OpenAI**, **Azure OpenAI**, **FastEmbed**, **Google AI**, **Langchain**, **LM Studio**, **Ollama**, and **Together**.
|
||||
</Note>
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="OpenAI" href="/components/embedders/models/openai"></Card>
|
||||
<Card title="Azure OpenAI" href="/components/embedders/models/azure_openai"></Card>
|
||||
<Card title="Ollama" href="/components/embedders/models/ollama"></Card>
|
||||
<Card title="Hugging Face" href="/components/embedders/models/huggingface"></Card>
|
||||
<Card title="Google AI" href="/components/embedders/models/google_AI"></Card>
|
||||
<Card title="Vertex AI" href="/components/embedders/models/vertexai"></Card>
|
||||
<Card title="Together" href="/components/embedders/models/together"></Card>
|
||||
<Card title="LM Studio" href="/components/embedders/models/lmstudio"></Card>
|
||||
<Card title="Langchain" href="/components/embedders/models/langchain"></Card>
|
||||
<Card title="AWS Bedrock" href="/components/embedders/models/aws_bedrock"></Card>
|
||||
<Card title="FastEmbed" href="/components/embedders/models/fastembed"></Card>
|
||||
<Card title="OpenAI" icon="/images/provider-icons/openai.svg" href="/components/embedders/models/openai"></Card>
|
||||
<Card title="Azure OpenAI" icon="/images/provider-icons/azure-color.svg" href="/components/embedders/models/azure_openai"></Card>
|
||||
<Card title="Ollama" icon="/images/provider-icons/ollama.svg" href="/components/embedders/models/ollama"></Card>
|
||||
<Card title="Hugging Face" icon="/images/provider-icons/huggingface.svg" href="/components/embedders/models/huggingface"></Card>
|
||||
<Card title="Google AI" icon="/images/provider-icons/google-color.svg" href="/components/embedders/models/google_AI"></Card>
|
||||
<Card title="Vertex AI" icon="/images/provider-icons/vertexai.svg" href="/components/embedders/models/vertexai"></Card>
|
||||
<Card title="Together" icon="/images/provider-icons/together-color.svg" href="/components/embedders/models/together"></Card>
|
||||
<Card title="LM Studio" icon="/images/provider-icons/lmstudio.svg" href="/components/embedders/models/lmstudio"></Card>
|
||||
<Card title="Langchain" icon="/images/provider-icons/langchain-color.svg" href="/components/embedders/models/langchain"></Card>
|
||||
<Card title="AWS Bedrock" icon="/images/provider-icons/bedrock-color.svg" href="/components/embedders/models/aws_bedrock"></Card>
|
||||
<Card title="FastEmbed" icon="/images/provider-icons/qdrant.svg" href="/components/embedders/models/fastembed"></Card>
|
||||
</CardGroup>
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -5,7 +5,7 @@ description: "Configure Azure OpenAI as an LLM provider in Mem0 with Azure Ident
|
||||
|
||||
<Note> Mem0 Now Supports Azure OpenAI Models in TypeScript SDK </Note>
|
||||
|
||||
To use Azure OpenAI models, you have to set the `LLM_AZURE_OPENAI_API_KEY`, `LLM_AZURE_ENDPOINT`, `LLM_AZURE_DEPLOYMENT` and `LLM_AZURE_API_VERSION` environment variables. You can obtain the Azure API key from the [Azure](https://azure.microsoft.com/).
|
||||
To use Azure OpenAI models, you have to set the `LLM_AZURE_OPENAI_API_KEY`, `LLM_AZURE_ENDPOINT`, `LLM_AZURE_DEPLOYMENT` and `LLM_AZURE_API_VERSION` environment variables. You can obtain the Azure API key from the [Azure Portal](https://azure.microsoft.com/).
|
||||
|
||||
Optionally, you can use Azure Identity to authenticate with Azure OpenAI, which allows you to use managed identities or service principals for production and Azure CLI login for development instead of an API key. If an Azure Identity is to be used, ***do not*** set the `LLM_AZURE_OPENAI_API_KEY` environment variable or the api_key in the config dictionary.
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
---
|
||||
title: Together
|
||||
description: "Configure Together AI as an LLM provider in Mem0 with API key setup and Mixtral model configuration."
|
||||
description: "Configure Together AI as an LLM provider in Mem0 with API key setup and optional custom endpoint configuration."
|
||||
---
|
||||
|
||||
To use Together LLM models, you have to set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from their [Account settings page](https://api.together.xyz/settings/api-keys).
|
||||
To use Together LLM models, you have to set the `TOGETHER_API_KEY` environment variable. You can obtain the Together API key from their [Account settings page](https://api.together.ai/settings/projects/~current/api-keys).
|
||||
In the TypeScript SDK, you can optionally set `TOGETHER_API_BASE` or pass `baseURL` in the config (defaults to `https://api.together.ai/v1`).
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -18,7 +20,7 @@ config = {
|
||||
"llm": {
|
||||
"provider": "together",
|
||||
"config": {
|
||||
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
"model": "MiniMaxAI/MiniMax-M3",
|
||||
"temperature": 0.2,
|
||||
"max_tokens": 2000,
|
||||
}
|
||||
@@ -29,12 +31,68 @@ m = Memory.from_config(config)
|
||||
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": "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."}
|
||||
]
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
const config = {
|
||||
llm: {
|
||||
provider: 'together',
|
||||
config: {
|
||||
apiKey: process.env.TOGETHER_API_KEY || '',
|
||||
model: 'MiniMaxAI/MiniMax-M3',
|
||||
temperature: 0.2,
|
||||
maxTokens: 2000,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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." },
|
||||
];
|
||||
await memory.add(messages, { userId: 'alice', metadata: { category: 'movies' } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
You can also configure the API base URL in the config:
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"llm": {
|
||||
"provider": "together",
|
||||
"config": {
|
||||
"model": "MiniMaxAI/MiniMax-M3",
|
||||
"api_key": "your-api-key"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
const config = {
|
||||
llm: {
|
||||
provider: "together",
|
||||
config: {
|
||||
model: "MiniMaxAI/MiniMax-M3",
|
||||
baseURL: "https://api.together.ai/v1",
|
||||
apiKey: "your-api-key",
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Config
|
||||
|
||||
All available parameters for the `together` config are present in [Master List of All Params in Config](../config).
|
||||
All available parameters for the `together` config are present in [Master List of All Params in Config](../config).
|
||||
|
||||
@@ -25,7 +25,8 @@ description: "Configure vLLM as an LLM provider in Mem0 for high-performance loc
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -53,6 +54,46 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
const config = {
|
||||
llm: {
|
||||
provider: "vllm",
|
||||
config: {
|
||||
model: "Qwen/Qwen2.5-32B-Instruct",
|
||||
baseURL: "http://localhost:8000/v1",
|
||||
apiKey: process.env.VLLM_API_KEY || "vllm-api-key",
|
||||
temperature: 0.1,
|
||||
maxTokens: 2000,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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 thrillers, but I love sci-fi movies.",
|
||||
},
|
||||
{
|
||||
role: "assistant",
|
||||
content: "Got it! I'll avoid thrillers and suggest sci-fi movies instead.",
|
||||
},
|
||||
];
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Configuration Parameters
|
||||
|
||||
| Parameter | Description | Default | Environment Variable |
|
||||
|
||||
@@ -5,11 +5,12 @@ description: "Configure xAI Grok models as an LLM provider in Mem0 with API key
|
||||
|
||||
[xAI](https://x.ai/) is a new AI company founded by Elon Musk that develops large language models, including Grok. Grok is trained on real-time data from X (formerly Twitter) and aims to provide accurate, up-to-date responses with a touch of wit and humor.
|
||||
|
||||
In order to use LLMs from xAI, go to their [platform](https://console.x.ai) and get the API key. Set the API key as `XAI_API_KEY` environment variable to use the model as given below in the example.
|
||||
In order to use LLMs from xAI, go to their [platform](https://console.x.ai) and get the API key. Set the API key as `XAI_API_KEY` environment variable to use the model as given below in the example. You can also optionally set `XAI_API_BASE` to use a different API endpoint (defaults to `https://api.x.ai/v1`).
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -37,6 +38,31 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
const config = {
|
||||
llm: {
|
||||
provider: 'xai',
|
||||
config: {
|
||||
apiKey: process.env.XAI_API_KEY || '',
|
||||
model: 'grok-4.3',
|
||||
temperature: 0.1,
|
||||
maxTokens: 2000,
|
||||
},
|
||||
},
|
||||
};
|
||||
const memory = new Memory(config);
|
||||
const 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."}
|
||||
];
|
||||
await memory.add(messages, { userId: 'alice', metadata: { category: 'movies' } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Config
|
||||
|
||||
All available parameters for the `xai` config are present in [Master List of All Params in Config](../config).
|
||||
@@ -7,7 +7,7 @@ Mem0 includes built-in support for various popular large language models. Memory
|
||||
|
||||
## Usage
|
||||
|
||||
To use a llm, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and `OpenAI` will be used as the llm.
|
||||
To use an LLM, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and `OpenAI` will be used as the LLM.
|
||||
|
||||
For a comprehensive list of available parameters for llm configuration, please refer to [Config](./config).
|
||||
|
||||
@@ -20,22 +20,22 @@ See the list of supported LLMs below.
|
||||
</Note>
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="OpenAI" href="/components/llms/models/openai" />
|
||||
<Card title="Ollama" href="/components/llms/models/ollama" />
|
||||
<Card title="Azure OpenAI" href="/components/llms/models/azure_openai" />
|
||||
<Card title="Anthropic" href="/components/llms/models/anthropic" />
|
||||
<Card title="Together" href="/components/llms/models/together" />
|
||||
<Card title="Groq" href="/components/llms/models/groq" />
|
||||
<Card title="Litellm" href="/components/llms/models/litellm" />
|
||||
<Card title="Mistral AI" href="/components/llms/models/mistral_AI" />
|
||||
<Card title="Google AI" href="/components/llms/models/google_AI" />
|
||||
<Card title="AWS bedrock" href="/components/llms/models/aws_bedrock" />
|
||||
<Card title="DeepSeek" href="/components/llms/models/deepseek" />
|
||||
<Card title="MiniMax" href="/components/llms/models/minimax" />
|
||||
<Card title="xAI" href="/components/llms/models/xAI" />
|
||||
<Card title="Sarvam AI" href="/components/llms/models/sarvam" />
|
||||
<Card title="LM Studio" href="/components/llms/models/lmstudio" />
|
||||
<Card title="Langchain" href="/components/llms/models/langchain" />
|
||||
<Card title="OpenAI" icon="/images/provider-icons/openai.svg" href="/components/llms/models/openai" />
|
||||
<Card title="Ollama" icon="/images/provider-icons/ollama.svg" href="/components/llms/models/ollama" />
|
||||
<Card title="Azure OpenAI" icon="/images/provider-icons/azure-color.svg" href="/components/llms/models/azure_openai" />
|
||||
<Card title="Anthropic" icon="/images/provider-icons/anthropic.svg" href="/components/llms/models/anthropic" />
|
||||
<Card title="Together" icon="/images/provider-icons/together-color.svg" href="/components/llms/models/together" />
|
||||
<Card title="Groq" icon="/images/provider-icons/groq.svg" href="/components/llms/models/groq" />
|
||||
<Card title="Litellm" icon="shuffle" href="/components/llms/models/litellm" />
|
||||
<Card title="Mistral AI" icon="/images/provider-icons/mistral-color.svg" href="/components/llms/models/mistral_AI" />
|
||||
<Card title="Google AI" icon="/images/provider-icons/google-color.svg" href="/components/llms/models/google_AI" />
|
||||
<Card title="AWS bedrock" icon="/images/provider-icons/bedrock-color.svg" href="/components/llms/models/aws_bedrock" />
|
||||
<Card title="DeepSeek" icon="/images/provider-icons/deepseek-color.svg" href="/components/llms/models/deepseek" />
|
||||
<Card title="MiniMax" icon="/images/provider-icons/minimax-color.svg" href="/components/llms/models/minimax" />
|
||||
<Card title="xAI" icon="/images/provider-icons/xai.svg" href="/components/llms/models/xAI" />
|
||||
<Card title="Sarvam AI" icon="/images/provider-icons/sarvam.svg" href="/components/llms/models/sarvam" />
|
||||
<Card title="LM Studio" icon="/images/provider-icons/lmstudio.svg" href="/components/llms/models/lmstudio" />
|
||||
<Card title="Langchain" icon="/images/provider-icons/langchain-color.svg" href="/components/llms/models/langchain" />
|
||||
</CardGroup>
|
||||
|
||||
## Structured vs Unstructured Outputs
|
||||
|
||||
@@ -9,6 +9,18 @@ Mem0 rerankers rescore vector search hits so your agents surface the most releva
|
||||
Reranking trades extra latency for better precision. Start once you have baseline search working and measure before/after relevance.
|
||||
</Info>
|
||||
|
||||
## Supported Rerankers
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Cohere" icon="/images/provider-icons/cohere.svg" href="/components/rerankers/models/cohere" />
|
||||
<Card title="Sentence Transformers" icon="vector-square" href="/components/rerankers/models/sentence_transformer" />
|
||||
<Card title="Hugging Face" icon="/images/provider-icons/huggingface.svg" href="/components/rerankers/models/huggingface" />
|
||||
<Card title="LLM Reranker" icon="wand-magic-sparkles" href="/components/rerankers/models/llm_reranker" />
|
||||
<Card title="Zero Entropy" icon="/images/provider-icons/zeroentropy.svg" href="/components/rerankers/models/zero_entropy" />
|
||||
</CardGroup>
|
||||
|
||||
## Reranking Workflow
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card
|
||||
title="Understand Reranking"
|
||||
@@ -19,13 +31,13 @@ Reranking trades extra latency for better precision. Start once you have baselin
|
||||
<Card
|
||||
title="Configure Providers"
|
||||
description="Add reranker blocks to your memory configuration."
|
||||
icon="settings"
|
||||
icon="gear"
|
||||
href="/components/rerankers/config"
|
||||
/>
|
||||
<Card
|
||||
title="Optimize Performance"
|
||||
description="Balance relevance, latency, and cost with tuning tactics."
|
||||
icon="speedometer"
|
||||
icon="gauge"
|
||||
href="/components/rerankers/optimization"
|
||||
/>
|
||||
<Card
|
||||
@@ -43,7 +55,7 @@ Reranking trades extra latency for better precision. Start once you have baselin
|
||||
<Card
|
||||
title="Sentence Transformers"
|
||||
description="Keep reranking on-device with cross-encoder models."
|
||||
icon="cpu"
|
||||
icon="microchip"
|
||||
href="/components/rerankers/models/sentence_transformer"
|
||||
/>
|
||||
</CardGroup>
|
||||
@@ -66,7 +78,7 @@ Reranking trades extra latency for better precision. Start once you have baselin
|
||||
<Card
|
||||
title="Set Up Reranking"
|
||||
description="Walk through the configuration fields and defaults."
|
||||
icon="settings"
|
||||
icon="gear"
|
||||
href="/components/rerankers/config"
|
||||
/>
|
||||
<Card
|
||||
|
||||
@@ -81,13 +81,13 @@ Azure client ID, secret, tenant ID, or certificate in environment variables for
|
||||
Utilizes Azure Workload Identity (relevant for Kubernetes and Azure workloads).
|
||||
|
||||
3. **Managed Identity Credential:**
|
||||
Authenticates as a Managed Identity (for apps/services hosted in Azure with Managed Identity enabled), this is the most secure production credential.
|
||||
Authenticates as a Managed Identity (for apps/services hosted in Azure with Managed Identity enabled); this is the most secure production credential.
|
||||
|
||||
4. **Shared Token Cache Credential / Visual Studio Credential (Windows only):**
|
||||
Uses cached credentials from Visual Studio sign-ins (and sometimes VS Code if SSO is enabled).
|
||||
|
||||
5. **Azure CLI Credential:**
|
||||
Uses the currently logged-in user from the Azure CLI (`az login`), this is the most common development credential.
|
||||
Uses the currently logged-in user from the Azure CLI (`az login`); this is the most common development credential.
|
||||
|
||||
6. **Azure PowerShell Credential:**
|
||||
Uses the identity from Azure PowerShell (`Connect-AzAccount`).
|
||||
@@ -135,7 +135,7 @@ config = {
|
||||
```
|
||||
|
||||
### Environment Variables to Use Azure Identity Credential
|
||||
* For an Environment Credential, you will need to setup a Service Principal and set the following environment variables:
|
||||
* For an Environment Credential, you will need to set up a Service Principal and set the following environment variables:
|
||||
- `AZURE_TENANT_ID`: Your Azure Active Directory tenant ID.
|
||||
- `AZURE_CLIENT_ID`: The client ID of your service principal or managed identity.
|
||||
- `AZURE_CLIENT_SECRET`: The client secret of your service principal.
|
||||
|
||||
@@ -7,7 +7,8 @@ description: "Use Apache Cassandra as a distributed vector store in Mem0 with se
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -37,11 +38,43 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
// Set OPENAI_API_KEY in your environment for the default embedder
|
||||
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'cassandra',
|
||||
config: {
|
||||
contactPoints: ['127.0.0.1'],
|
||||
localDataCenter: 'datacenter1', // required with contactPoints; "datacenter1" is the default for a single-node cluster
|
||||
port: 9042,
|
||||
username: 'cassandra',
|
||||
password: 'cassandra',
|
||||
keyspace: 'mem0',
|
||||
collectionName: 'memories',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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."}
|
||||
]
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
#### Using DataStax Astra DB
|
||||
|
||||
For managed Cassandra with DataStax Astra DB:
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"vector_store": {
|
||||
"provider": "cassandra",
|
||||
@@ -57,8 +90,24 @@ config = {
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'cassandra',
|
||||
config: {
|
||||
username: 'token',
|
||||
password: 'AstraCS:...', // Your Astra DB application token
|
||||
keyspace: 'mem0',
|
||||
collectionName: 'memories',
|
||||
secureConnectBundle: '/path/to/secure-connect-bundle.zip',
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
When using DataStax Astra DB, provide the secure connect bundle path. The contact_points parameter is ignored when a secure connect bundle is provided.
|
||||
When using DataStax Astra DB, provide the secure connect bundle path. Contact points and `localDataCenter` are not needed when a secure connect bundle is provided.
|
||||
</Note>
|
||||
|
||||
### Config
|
||||
@@ -78,6 +127,10 @@ Here are the parameters available for configuring Apache Cassandra:
|
||||
| `protocol_version` | CQL protocol version | `4` |
|
||||
| `load_balancing_policy` | Custom load balancing policy | `None` |
|
||||
|
||||
<Note>
|
||||
The TypeScript SDK uses camelCase keys: `contactPoints`, `collectionName`, `embeddingModelDims`, `secureConnectBundle`, `protocolVersion`, and `loadBalancingPolicy`. It also requires `localDataCenter` (for example, `datacenter1`) when you connect with `contactPoints` instead of a secure connect bundle. The Node.js driver needs this to route queries; it has no default.
|
||||
</Note>
|
||||
|
||||
### Setup
|
||||
|
||||
#### Option 1: Local Cassandra Setup using Docker:
|
||||
@@ -139,14 +192,20 @@ brew services start cassandra
|
||||
cqlsh
|
||||
```
|
||||
|
||||
### Python Client Installation
|
||||
### Client Installation
|
||||
|
||||
Install the required Python package:
|
||||
Install the driver for your SDK:
|
||||
|
||||
```bash
|
||||
<CodeGroup>
|
||||
```bash Python
|
||||
pip install cassandra-driver
|
||||
```
|
||||
|
||||
```bash TypeScript
|
||||
npm install cassandra-driver
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Performance Considerations
|
||||
|
||||
- **Replication Factor**: For production, use replication factor of at least 3
|
||||
@@ -156,7 +215,8 @@ pip install cassandra-driver
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
from cassandra.policies import DCAwareRoundRobinPolicy
|
||||
|
||||
config = {
|
||||
@@ -176,6 +236,28 @@ config = {
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
// The Node.js driver routes to localDataCenter by default, so set it to your
|
||||
// primary DC for datacenter-aware routing. Pass loadBalancingPolicy only when
|
||||
// you need a custom policy from the cassandra-driver package.
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'cassandra',
|
||||
config: {
|
||||
contactPoints: ['node1.example.com', 'node2.example.com', 'node3.example.com'],
|
||||
localDataCenter: 'DC1',
|
||||
port: 9042,
|
||||
username: 'mem0_user',
|
||||
password: 'secure_password',
|
||||
keyspace: 'mem0_prod',
|
||||
collectionName: 'memories',
|
||||
protocolVersion: 4,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Warning>
|
||||
For production use, configure appropriate replication strategies and consistency levels based on your availability and consistency requirements.
|
||||
</Warning>
|
||||
|
||||
@@ -6,15 +6,22 @@ description: "Use Elasticsearch as a vector database in Mem0 for distributed vec
|
||||
|
||||
### Installation
|
||||
|
||||
Elasticsearch support requires additional dependencies. Install them with:
|
||||
Elasticsearch support requires the Elasticsearch client as an extra dependency.
|
||||
|
||||
```bash
|
||||
<CodeGroup>
|
||||
```bash Python
|
||||
pip install elasticsearch>=8.0.0
|
||||
```
|
||||
|
||||
```bash TypeScript
|
||||
npm install mem0ai @elastic/elasticsearch
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -36,12 +43,52 @@ m = Memory.from_config(config)
|
||||
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": "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."}
|
||||
]
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
// Set OPENAI_API_KEY in your environment.
|
||||
const config = {
|
||||
embedder: {
|
||||
provider: "openai",
|
||||
config: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
model: "text-embedding-3-small",
|
||||
},
|
||||
},
|
||||
vectorStore: {
|
||||
provider: "elasticsearch",
|
||||
config: {
|
||||
collectionName: "mem0",
|
||||
embeddingModelDims: 1536,
|
||||
host: "localhost",
|
||||
port: 9200,
|
||||
// For Elastic Cloud, pass cloudId and apiKey instead of host/port.
|
||||
// For basic auth, pass username and password.
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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." },
|
||||
];
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
The TypeScript SDK uses camelCase config keys: `collectionName`, `embeddingModelDims`, `cloudId`, `apiKey`, `useSsl`, `verifyCerts`, `caCerts`, `autoCreateIndex`, and `username` (in place of the Python `user`). `collectionName` and `embeddingModelDims` are required. Because the vector store embeds text with your configured embedder before writing, set an `embedder` in the config as shown above.
|
||||
</Note>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Elasticsearch:
|
||||
@@ -74,6 +121,10 @@ Here are the parameters available for configuring Elasticsearch:
|
||||
|
||||
### Custom Search Query
|
||||
|
||||
<Note>
|
||||
`custom_search_query` is available in the Python SDK only. The TypeScript SDK runs a fixed k-NN query with optional metadata filters.
|
||||
</Note>
|
||||
|
||||
The `custom_search_query` parameter allows you to customize the search query when `Memory.search` is called.
|
||||
|
||||
__Example__
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
title: "MongoDB"
|
||||
description: "Use MongoDB as a vector database in Mem0 with built-in vector search for high-dimensional similarity queries."
|
||||
---
|
||||
|
||||
# MongoDB
|
||||
|
||||
[MongoDB](https://www.mongodb.com/) is a versatile document database that supports vector search capabilities, allowing for efficient high-dimensional similarity searches over large datasets with robust scalability and performance.
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -20,30 +22,90 @@ config = {
|
||||
"config": {
|
||||
"db_name": "mem0-db",
|
||||
"collection_name": "mem0-collection",
|
||||
"mongo_uri":"mongodb://username:password@localhost:27017"
|
||||
"mongo_uri": "mongodb://username:password@localhost:27017"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m = Memory.from_config(config)
|
||||
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": "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.",
|
||||
},
|
||||
]
|
||||
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: "mongodb",
|
||||
config: {
|
||||
dbName: "mem0-db",
|
||||
collectionName: "mem0-collection",
|
||||
url: "mongodb://username:password@localhost:27017",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
|
||||
const 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.",
|
||||
},
|
||||
];
|
||||
|
||||
await memory.add(messages, {
|
||||
userId: "alice",
|
||||
metadata: {
|
||||
category: "movies",
|
||||
},
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Config
|
||||
|
||||
Here are the parameters available for configuring MongoDB:
|
||||
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| db_name | Name of the MongoDB database | `"mem0_db"` |
|
||||
| collection_name | Name of the MongoDB collection | `"mem0"` |
|
||||
| embedding_model_dims | Dimensions of the embedding vectors | `1536` |
|
||||
| mongo_uri | The MongoDB URI connection string | `mongodb://localhost:27017` |
|
||||
| Python | TypeScript | Description | Default Value |
|
||||
| --- | --- | --- | --- |
|
||||
| db_name | dbName | Name of the MongoDB database | "mem0_db" |
|
||||
| collection_name | collectionName | Name of the MongoDB collection | "mem0" |
|
||||
| embedding_model_dims | embeddingModelDims | Dimensions of the embedding vectors | 1536 |
|
||||
| mongo_uri | url | The MongoDB URI connection string | mongodb://localhost:27017 |
|
||||
|
||||
> **Note**: If `mongo_uri` is not provided, it will default to `mongodb://localhost:27017`.
|
||||
> **Note**: If `mongo_uri` (Python) or `url` (TypeScript) is not provided, it defaults to `mongodb://localhost:27017`. A local instance must be running MongoDB v8.2+ for vector search to work.
|
||||
|
||||
> **Note**: The vector search index builds asynchronously after the first write. A search issued right after the first `add()` may return no results (and log an "index not initialized" message) until the index finishes building. This takes a few seconds on a local deployment and up to about a minute on Atlas. This is expected; the search returns results once the index is ready.
|
||||
|
||||
@@ -6,12 +6,18 @@ description: "Use OpenSearch as a vector database in Mem0 with k-NN search suppo
|
||||
|
||||
### Installation
|
||||
|
||||
OpenSearch support requires additional dependencies. Install them with:
|
||||
OpenSearch support requires an additional client library. Install the one for your SDK:
|
||||
|
||||
```bash
|
||||
<CodeGroup>
|
||||
```bash Python
|
||||
pip install opensearch-py
|
||||
```
|
||||
|
||||
```bash TypeScript
|
||||
npm install @opensearch-project/opensearch
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before using OpenSearch with Mem0, you need to set up a collection in AWS OpenSearch Service.
|
||||
@@ -26,7 +32,8 @@ You can create a collection through the AWS Console:
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
import boto3
|
||||
@@ -56,8 +63,43 @@ config = {
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
// Basic self-hosted OpenSearch. For AWS OpenSearch Serverless, build an
|
||||
// @opensearch-project/opensearch Client with AwsSigv4Signer and pass it as
|
||||
// `client` instead of host/port/user/password.
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'opensearch',
|
||||
config: {
|
||||
collectionName: 'mem0',
|
||||
embeddingModelDims: 1024,
|
||||
host: 'localhost',
|
||||
port: 9200,
|
||||
user: 'admin',
|
||||
password: 'admin',
|
||||
useSSL: false,
|
||||
verifyCerts: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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." },
|
||||
];
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Configuration Options
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `collection_name` | string | required | Name of the OpenSearch index |
|
||||
@@ -68,6 +110,23 @@ config = {
|
||||
| `use_ssl` | bool | False | Enable SSL/TLS connection |
|
||||
| `verify_certs` | bool | False | Verify SSL certificates |
|
||||
| `auto_refresh` | bool | False | Automatically refresh index after insert. OpenSearch refreshes every ~1 second by default, so this is rarely needed. |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `collectionName` | string | required | Name of the OpenSearch index |
|
||||
| `embeddingModelDims` | number | 1536 | Dimension of embedding vectors |
|
||||
| `host` | string | `localhost` | OpenSearch endpoint host |
|
||||
| `port` | number | 9200 | Port number |
|
||||
| `httpAuth` | object | None | Authentication credentials, an object or `[user, password]` tuple |
|
||||
| `user` | string | None | Username for basic auth (used together with `password`) |
|
||||
| `password` | string | None | Password for basic auth (used together with `user`) |
|
||||
| `useSSL` | boolean | false | Enable SSL/TLS connection |
|
||||
| `verifyCerts` | boolean | false | Verify SSL certificates |
|
||||
| `autoRefresh` | boolean | false | Refresh the index after each write so new memories are searchable immediately. Not supported on AWS Serverless. |
|
||||
| `client` | object | None | Preconfigured OpenSearch client, e.g. one built with AwsSigv4Signer for AWS auth |
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Note>
|
||||
The defaults above match a local OpenSearch instance. The AWS OpenSearch Serverless
|
||||
|
||||
@@ -10,7 +10,8 @@ description: "Use Pinecone as a fully managed vector database in Mem0 with serve
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -44,10 +45,43 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
// Set OPENAI_API_KEY and PINECONE_API_KEY in your environment
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'pinecone',
|
||||
config: {
|
||||
collectionName: 'testing',
|
||||
embeddingModelDims: 1536, // Matches OpenAI's text-embedding-3-small
|
||||
namespace: 'my-namespace', // Optional: specify a namespace for multi-tenancy
|
||||
serverlessConfig: {
|
||||
cloud: 'aws', // 'aws' | 'gcp' | 'azure'
|
||||
region: 'us-east-1',
|
||||
},
|
||||
metric: 'cosine',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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."}
|
||||
]
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Pinecone:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `collection_name` | Name of the index/collection | Required |
|
||||
@@ -61,11 +95,28 @@ Here are the parameters available for configuring Pinecone:
|
||||
| `metric` | Distance metric for vector similarity | `"cosine"` |
|
||||
| `batch_size` | Batch size for operations | `100` |
|
||||
| `namespace` | Namespace for the collection, useful for multi-tenancy. | `None` |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `collectionName` | Name of the index/collection | Required |
|
||||
| `embeddingModelDims` | Dimensions of the embedding model (must match your chosen embedding model) | `1536` |
|
||||
| `client` | Existing Pinecone client instance | `undefined` |
|
||||
| `apiKey` | API key for Pinecone | Environment variable: `PINECONE_API_KEY` |
|
||||
| `serverlessConfig` | Configuration for serverless deployment (`cloud`, `region`) | `undefined` |
|
||||
| `podConfig` | Configuration for pod-based deployment (`environment`, `podType`, `pods`, `replicas`, `shards`) | `undefined` |
|
||||
| `metric` | Distance metric for vector similarity (`cosine`, `dotproduct`, `euclidean`) | `"cosine"` |
|
||||
| `batchSize` | Batch size for insert operations | `100` |
|
||||
| `namespace` | Namespace for the collection, useful for multi-tenancy. | `undefined` |
|
||||
| `extraParams` | Extra parameters spread into the Pinecone `createIndex` call | `{}` |
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
> **Important**: You must choose either `serverless_config` or `pod_config` for your deployment, but not both.
|
||||
|
||||
#### Serverless Config Example
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"vector_store": {
|
||||
"provider": "pinecone",
|
||||
@@ -82,8 +133,27 @@ config = {
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'pinecone',
|
||||
config: {
|
||||
collectionName: 'memory_index',
|
||||
embeddingModelDims: 1536, // For OpenAI's text-embedding-3-small
|
||||
namespace: 'my-namespace', // Optional: custom namespace
|
||||
serverlessConfig: {
|
||||
cloud: 'aws', // 'gcp' | 'azure'
|
||||
region: 'us-east-1', // Choose appropriate region
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
#### Pod Config Example
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"vector_store": {
|
||||
"provider": "pinecone",
|
||||
@@ -99,4 +169,23 @@ config = {
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'pinecone',
|
||||
config: {
|
||||
collectionName: 'memory_index',
|
||||
embeddingModelDims: 1536, // For OpenAI's text-embedding-ada-002
|
||||
namespace: 'my-namespace', // Optional: custom namespace
|
||||
podConfig: {
|
||||
environment: 'gcp-starter',
|
||||
replicas: 1,
|
||||
podType: 'starter',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -9,15 +9,22 @@ description: "Use Amazon S3 Vectors as a cost-optimized vector storage service i
|
||||
|
||||
S3 Vectors support requires additional dependencies. Install them with:
|
||||
|
||||
```bash
|
||||
<CodeGroup>
|
||||
```bash Python
|
||||
pip install boto3
|
||||
```
|
||||
|
||||
```bash TypeScript
|
||||
npm install @aws-sdk/client-s3vectors
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Usage
|
||||
|
||||
To use Amazon S3 Vectors with Mem0, you need to have an AWS account and the necessary IAM permissions (`s3vectors:*`). Ensure your environment is configured with AWS credentials (e.g., via `~/.aws/credentials` or environment variables).
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -47,6 +54,36 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
// Ensure your AWS credentials are configured in your environment
|
||||
// e.g., by setting AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION
|
||||
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 's3_vectors',
|
||||
config: {
|
||||
vectorBucketName: 'my-mem0-vector-bucket',
|
||||
collectionName: 'my-memories-index',
|
||||
embeddingModelDims: 1536,
|
||||
distanceMetric: 'cosine',
|
||||
region: 'us-east-1',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const messages = [
|
||||
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
|
||||
{"role": "assistant", "content": "How about a thriller movie? 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."}
|
||||
]
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Amazon S3 Vectors:
|
||||
|
||||
@@ -6,7 +6,8 @@ description: "Use Turbopuffer as a serverless vector database in Mem0 for low-la
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -39,6 +40,36 @@ m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
results = m.search(query="sci-fi recommendations", filters={"user_id": "alice"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
// Set TURBOPUFFER_API_KEY in your environment, or pass it as config.apiKey below.
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: "turbopuffer",
|
||||
config: {
|
||||
collectionName: "movie_preferences",
|
||||
region: "gcp-us-central1",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
|
||||
const 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 thrillers but I love sci-fi." },
|
||||
{ role: "assistant", content: "Got it! I'll suggest sci-fi movies instead." },
|
||||
];
|
||||
|
||||
await memory.add(messages, { userId: "alice", metadata: { category: "movies" } });
|
||||
|
||||
// Search memories
|
||||
const results = await memory.search("sci-fi recommendations", { userId: "alice" });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Turbopuffer:
|
||||
@@ -53,6 +84,10 @@ Here are the parameters available for configuring Turbopuffer:
|
||||
| `batch_size` | Batch size for bulk operations | `100` |
|
||||
| `extra_params` | Additional parameters for the Turbopuffer client | `None` |
|
||||
|
||||
<Note>
|
||||
**TypeScript (Node.js) config keys** are camelCase: `collectionName`, `apiKey`, `region`, `distanceMetric`, and `batchSize`. The TypeScript SDK infers the vector dimension from your embedder, so `embeddingModelDims` is not required.
|
||||
</Note>
|
||||
|
||||
### Regions
|
||||
|
||||
| Region | Location |
|
||||
@@ -62,7 +97,8 @@ Here are the parameters available for configuring Turbopuffer:
|
||||
|
||||
### Config Example
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"vector_store": {
|
||||
"provider": "turbopuffer",
|
||||
@@ -77,3 +113,19 @@ config = {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: "turbopuffer",
|
||||
config: {
|
||||
collectionName: "my_memories",
|
||||
apiKey: "tpuf_xxxxxxxxxxxx",
|
||||
region: "aws-us-west-2",
|
||||
distanceMetric: "cosine_distance",
|
||||
batchSize: 200,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -8,6 +8,10 @@ description: "Use Upstash Vector as a serverless vector database in Mem0 with op
|
||||
|
||||
You can enable the built-in embedding models by setting `enable_embeddings` to `True`. This allows you to use Upstash's embedding models for vectorization.
|
||||
|
||||
<Note>
|
||||
Server-side Upstash embeddings (`enable_embeddings`) are available in the Python SDK only. The TypeScript SDK always embeds text with your configured embedder before writing to Upstash, so use the external embedding provider setup below.
|
||||
</Note>
|
||||
|
||||
```python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
@@ -34,7 +38,8 @@ m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category"
|
||||
|
||||
### Usage with external embedding providers
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -58,6 +63,36 @@ m = Memory.from_config(config)
|
||||
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
// Set OPENAI_API_KEY, UPSTASH_VECTOR_REST_URL, and UPSTASH_VECTOR_REST_TOKEN in your environment.
|
||||
const config = {
|
||||
embedder: {
|
||||
provider: "openai",
|
||||
config: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
model: "text-embedding-3-large",
|
||||
},
|
||||
},
|
||||
vectorStore: {
|
||||
provider: "upstash_vector",
|
||||
config: {
|
||||
collectionName: "memories",
|
||||
url: process.env.UPSTASH_VECTOR_REST_URL,
|
||||
token: process.env.UPSTASH_VECTOR_REST_TOKEN,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
await memory.add("Likes to play cricket on weekends", {
|
||||
userId: "alice",
|
||||
metadata: { category: "hobbies" },
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Config
|
||||
|
||||
Here are the parameters available for configuring Upstash Vector:
|
||||
@@ -74,3 +109,7 @@ Here are the parameters available for configuring Upstash Vector:
|
||||
When `url` and `token` are not provided, the `UPSTASH_VECTOR_REST_URL` and
|
||||
`UPSTASH_VECTOR_REST_TOKEN` environment variables are used.
|
||||
</Note>
|
||||
|
||||
<Note>
|
||||
The TypeScript SDK uses camelCase config keys (`collectionName`, `url`, `token`), where `collectionName` is required. Pass `url` and `token` (or a preconfigured `client`) explicitly, since the TypeScript SDK does not read them from environment variables. `enable_embeddings` is not supported in TypeScript.
|
||||
</Note>
|
||||
|
||||
@@ -14,7 +14,8 @@ pip install mem0ai[vector-stores]
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
config = {
|
||||
"vector_store": {
|
||||
"provider": "valkey",
|
||||
@@ -37,8 +38,36 @@ messages = [
|
||||
m.add(messages, user_id="alice", metadata={"category": "movies"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from 'mem0ai/oss';
|
||||
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: 'valkey',
|
||||
config: {
|
||||
collectionName: 'test',
|
||||
valkeyUrl: 'valkey://localhost:6379',
|
||||
embeddingModelDims: 1536,
|
||||
indexType: 'flat',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
const 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." },
|
||||
];
|
||||
await memory.add(messages, { userId: 'alice', metadata: { category: 'movies' } });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Parameters
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
Here are the parameters available for configuring Valkey:
|
||||
|
||||
| Parameter | Description | Default Value |
|
||||
@@ -52,6 +81,22 @@ Here are the parameters available for configuring Valkey:
|
||||
| `hnsw_ef_runtime` | Size of dynamic candidate list for search | `10` |
|
||||
| `cluster_mode` | Enable cluster mode for Valkey cluster (CME) deployments | `false` |
|
||||
| `timezone` | Timezone for timestamp handling | `UTC` |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
| `collectionName` | The name of the collection to store the vectors | `mem0` |
|
||||
| `valkeyUrl` | Connection URL for the Valkey server | `valkey://localhost:6379` |
|
||||
| `embeddingModelDims` | Dimensions of the embedding model | `1536` |
|
||||
| `indexType` | Vector index algorithm (`hnsw` or `flat`) | `hnsw` |
|
||||
| `hnswM` | Number of bi-directional links for HNSW | `16` |
|
||||
| `hnswEfConstruction` | Size of dynamic candidate list for HNSW | `200` |
|
||||
| `hnswEfRuntime` | Size of dynamic candidate list for search | `10` |
|
||||
| `clusterMode` | Enable cluster mode for Valkey cluster (CME) deployments | `false` |
|
||||
| `timezone` | Timezone for timestamp handling | `UTC` |
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
|
||||
## Cluster Mode
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ description: "Use Google Cloud Vertex AI Vector Search as a managed vector store
|
||||
|
||||
To use Google Cloud Vertex AI Vector Search with `mem0`, you need to configure the `vector_store` in your `mem0` config:
|
||||
|
||||
|
||||
```python
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
import os
|
||||
from mem0 import Memory
|
||||
|
||||
@@ -20,7 +20,7 @@ config = {
|
||||
"provider": "vertex_ai_vector_search",
|
||||
"config": {
|
||||
"endpoint_id": "YOUR_ENDPOINT_ID", # Required: Vector Search endpoint ID
|
||||
"index_id": "YOUR_INDEX_ID", # Required: Vector Search index ID
|
||||
"index_id": "YOUR_INDEX_ID", # Required: Vector Search index ID
|
||||
"deployment_index_id": "YOUR_DEPLOYMENT_INDEX_ID", # Required: Deployment-specific ID
|
||||
"project_id": "YOUR_PROJECT_ID", # Required: Google Cloud project ID
|
||||
"project_number": "YOUR_PROJECT_NUMBER", # Required: Google Cloud project number
|
||||
@@ -34,9 +34,40 @@ m = Memory.from_config(config)
|
||||
m.add("Your text here", user_id="user", metadata={"category": "example"})
|
||||
```
|
||||
|
||||
```typescript TypeScript
|
||||
import { Memory } from "mem0ai/oss";
|
||||
|
||||
// Authenticate with GOOGLE_APPLICATION_CREDENTIALS in your environment,
|
||||
// or pass credentialsPath / serviceAccountJson in the config below.
|
||||
const config = {
|
||||
vectorStore: {
|
||||
provider: "vertex_ai_vector_search",
|
||||
config: {
|
||||
endpointId: "YOUR_ENDPOINT_ID", // Required: Vector Search endpoint ID
|
||||
indexId: "YOUR_INDEX_ID", // Required: Vector Search index ID
|
||||
deploymentIndexId: "YOUR_DEPLOYMENT_INDEX_ID", // Required: Deployment-specific ID
|
||||
projectId: "YOUR_PROJECT_ID", // Required: Google Cloud project ID
|
||||
projectNumber: "YOUR_PROJECT_NUMBER", // Required: Google Cloud project number
|
||||
region: "YOUR_REGION", // Required: Google Cloud region
|
||||
credentialsPath: "path/to/credentials.json", // Optional: defaults to GOOGLE_APPLICATION_CREDENTIALS
|
||||
vectorSearchApiEndpoint: "YOUR_API_ENDPOINT", // Required for search/get operations
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const memory = new Memory(config);
|
||||
await memory.add("Your text here", {
|
||||
userId: "user",
|
||||
metadata: { category: "example" },
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
| Parameter | Description | Required |
|
||||
|-----------|-------------|----------|
|
||||
| `endpoint_id` | Vector Search endpoint ID | Yes |
|
||||
@@ -48,3 +79,18 @@ m.add("Your text here", user_id="user", metadata={"category": "example"})
|
||||
| `region` | Google Cloud region | Yes |
|
||||
| `credentials_path` | Path to service account credentials | No (defaults to GOOGLE_APPLICATION_CREDENTIALS) |
|
||||
| `service_account_json` | Service account credentials as a dictionary (alternative to `credentials_path`) | `None` |
|
||||
</Tab>
|
||||
<Tab title="TypeScript">
|
||||
| Parameter | Description | Required |
|
||||
|-----------|-------------|----------|
|
||||
| `endpointId` | Vector Search endpoint ID | Yes |
|
||||
| `indexId` | Vector Search index ID | Yes |
|
||||
| `deploymentIndexId` | Deployment-specific index ID | Yes |
|
||||
| `projectId` | Google Cloud project ID | Yes |
|
||||
| `projectNumber` | Google Cloud project number | Yes |
|
||||
| `vectorSearchApiEndpoint` | Vector search API endpoint | Yes (for get operations) |
|
||||
| `region` | Google Cloud region | Yes |
|
||||
| `credentialsPath` | Path to service account credentials | No (defaults to GOOGLE_APPLICATION_CREDENTIALS) |
|
||||
| `serviceAccountJson` | Service account credentials as an object (alternative to `credentialsPath`) | No |
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
@@ -10,30 +10,30 @@ Mem0 includes built-in support for various popular databases. Memory can utilize
|
||||
See the list of supported vector databases below.
|
||||
|
||||
<Note>
|
||||
The following vector databases are supported in the Python implementation. The TypeScript implementation currently supports Qdrant, Redis, PGVector, Supabase, LangChain, Azure AI Search, Vectorize, and an in-memory store.
|
||||
The following vector databases are supported in the Python implementation. The TypeScript implementation currently supports Qdrant, Redis, PGVector, Supabase, LangChain, Azure AI Search, Vectorize, Amazon S3 Vectors, and an in-memory store.
|
||||
</Note>
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Qdrant" href="/components/vectordbs/dbs/qdrant"></Card>
|
||||
<Card title="Chroma" href="/components/vectordbs/dbs/chroma"></Card>
|
||||
<Card title="PGVector" href="/components/vectordbs/dbs/pgvector"></Card>
|
||||
<Card title="Upstash Vector" href="/components/vectordbs/dbs/upstash-vector"></Card>
|
||||
<Card title="Milvus" href="/components/vectordbs/dbs/milvus"></Card>
|
||||
<Card title="Pinecone" href="/components/vectordbs/dbs/pinecone"></Card>
|
||||
<Card title="MongoDB" href="/components/vectordbs/dbs/mongodb"></Card>
|
||||
<Card title="Azure" href="/components/vectordbs/dbs/azure"></Card>
|
||||
<Card title="Redis" href="/components/vectordbs/dbs/redis"></Card>
|
||||
<Card title="Valkey" href="/components/vectordbs/dbs/valkey"></Card>
|
||||
<Card title="Elasticsearch" href="/components/vectordbs/dbs/elasticsearch"></Card>
|
||||
<Card title="OpenSearch" href="/components/vectordbs/dbs/opensearch"></Card>
|
||||
<Card title="Supabase" href="/components/vectordbs/dbs/supabase"></Card>
|
||||
<Card title="Vertex AI" href="/components/vectordbs/dbs/vertex_ai"></Card>
|
||||
<Card title="Weaviate" href="/components/vectordbs/dbs/weaviate"></Card>
|
||||
<Card title="FAISS" href="/components/vectordbs/dbs/faiss"></Card>
|
||||
<Card title="LangChain" href="/components/vectordbs/dbs/langchain"></Card>
|
||||
<Card title="Amazon S3 Vectors" href="/components/vectordbs/dbs/s3_vectors"></Card>
|
||||
<Card title="Databricks" href="/components/vectordbs/dbs/databricks"></Card>
|
||||
<Card title="Turbopuffer" href="/components/vectordbs/dbs/turbopuffer"></Card>
|
||||
<Card title="Qdrant" icon="/images/provider-icons/qdrant.svg" href="/components/vectordbs/dbs/qdrant"></Card>
|
||||
<Card title="Chroma" icon="/images/provider-icons/chroma.svg" href="/components/vectordbs/dbs/chroma"></Card>
|
||||
<Card title="PGVector" icon="/images/provider-icons/postgresql.svg" href="/components/vectordbs/dbs/pgvector"></Card>
|
||||
<Card title="Upstash Vector" icon="/images/provider-icons/upstash.svg" href="/components/vectordbs/dbs/upstash-vector"></Card>
|
||||
<Card title="Milvus" icon="/images/provider-icons/milvus.svg" href="/components/vectordbs/dbs/milvus"></Card>
|
||||
<Card title="Pinecone" icon="/images/provider-icons/pinecone.svg" href="/components/vectordbs/dbs/pinecone"></Card>
|
||||
<Card title="MongoDB" icon="/images/provider-icons/mongodb.svg" href="/components/vectordbs/dbs/mongodb"></Card>
|
||||
<Card title="Azure" icon="/images/provider-icons/azure-color.svg" href="/components/vectordbs/dbs/azure"></Card>
|
||||
<Card title="Redis" icon="/images/provider-icons/redis.svg" href="/components/vectordbs/dbs/redis"></Card>
|
||||
<Card title="Valkey" icon="/images/provider-icons/valkey.svg" href="/components/vectordbs/dbs/valkey"></Card>
|
||||
<Card title="Elasticsearch" icon="/images/provider-icons/elasticsearch.svg" href="/components/vectordbs/dbs/elasticsearch"></Card>
|
||||
<Card title="OpenSearch" icon="/images/provider-icons/opensearch.svg" href="/components/vectordbs/dbs/opensearch"></Card>
|
||||
<Card title="Supabase" icon="/images/provider-icons/supabase.svg" href="/components/vectordbs/dbs/supabase"></Card>
|
||||
<Card title="Vertex AI" icon="/images/provider-icons/vertexai.svg" href="/components/vectordbs/dbs/vertex_ai"></Card>
|
||||
<Card title="Weaviate" icon="circle-nodes" href="/components/vectordbs/dbs/weaviate"></Card>
|
||||
<Card title="FAISS" icon="layer-group" href="/components/vectordbs/dbs/faiss"></Card>
|
||||
<Card title="LangChain" icon="/images/provider-icons/langchain-color.svg" href="/components/vectordbs/dbs/langchain"></Card>
|
||||
<Card title="Amazon S3 Vectors" icon="/images/provider-icons/aws-color.svg" href="/components/vectordbs/dbs/s3_vectors"></Card>
|
||||
<Card title="Databricks" icon="/images/provider-icons/databricks.svg" href="/components/vectordbs/dbs/databricks"></Card>
|
||||
<Card title="Turbopuffer" icon="/images/provider-icons/turbopuffer.svg" href="/components/vectordbs/dbs/turbopuffer"></Card>
|
||||
</CardGroup>
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -123,3 +123,5 @@ As the conversation progresses, Mem0's memory automatically updates based on the
|
||||
Build a travel companion that remembers preferences and past conversations.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -81,3 +81,5 @@ This local setup of Mem0 using Ollama provides a fully self-contained solution f
|
||||
Learn core companion patterns that work with any LLM provider.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -137,3 +137,5 @@ As users interact with the system, Mem0's memory system continuously learns and
|
||||
Run the full showcase app to see memory-powered companions in action.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -78,3 +78,5 @@ This setup demonstrates how to build an AI Companion that maintains memory acros
|
||||
Implement a command-line companion using the Node.js SDK.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -211,3 +211,5 @@ This Personalized AI Travel Assistant leverages Mem0's memory capabilities to pr
|
||||
Build an educational companion that remembers learning progress and preferences.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -156,7 +156,7 @@ def create_memory_voice_agent():
|
||||
"""You're speaking to a human, so be polite and concise.
|
||||
Always respond in clear, natural English.
|
||||
You have the ability to remember information about the user.
|
||||
Use the save_memories tool when the user shares an important information worth remembering.
|
||||
Use the save_memories tool when the user shares important information worth remembering.
|
||||
Use the search_memories tool when you need context from past conversations or user asks you to recall something.
|
||||
""",
|
||||
),
|
||||
@@ -362,7 +362,7 @@ def create_memory_voice_agent():
|
||||
"""You're speaking to a human, so be polite and concise.
|
||||
Always respond in clear, natural English.
|
||||
You have the ability to remember information about the user.
|
||||
Use the save_memories tool when the user shares an important information worth remembering.
|
||||
Use the save_memories tool when the user shares important information worth remembering.
|
||||
Use the search_memories tool when you need context from past conversations or user asks you to recall something.
|
||||
""",
|
||||
),
|
||||
@@ -544,3 +544,5 @@ async def save_memories(
|
||||
Master the core patterns for building memory-powered companions.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -66,3 +66,5 @@ Your API keys are stored locally in your browser. Your messages are sent to the
|
||||
Combine memory with search tools to conduct comprehensive research projects.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -973,3 +973,5 @@ Before launching:
|
||||
Organize customer context to keep assistants responsive at scale.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -512,3 +512,5 @@ Start with conservative filters (only store confirmed facts) and iterate based o
|
||||
<Card title="Build a Mem0 Companion" icon="users" href="/cookbooks/essentials/building-ai-companion">
|
||||
Learn core memory patterns including temporary vs permanent data handling.
|
||||
</Card>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -334,3 +334,5 @@ You learned how to:
|
||||
href="/cookbooks/essentials/controlling-memory-ingestion"
|
||||
/>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -128,7 +128,7 @@ Dev works at TechCorp as a senior engineer (score: 0.89)
|
||||
|
||||
```
|
||||
|
||||
Search works across all memory fields and ranks by relevance. Use it when you have a specific question, use `get_all()` when you need everything.
|
||||
Search works across all memory fields and ranks by relevance. Use it when you have a specific question; use `get_all()` when you need everything.
|
||||
|
||||
---
|
||||
|
||||
@@ -288,3 +288,5 @@ Use **`get_all()`** for bulk retrieval, **`search()`** for specific questions, a
|
||||
Ensure only verified insights make it into your export pipeline.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -249,3 +249,5 @@ Instead of searching through everything, agents jump directly to the information
|
||||
Use categories to drive audits, migrations, and compliance reports.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -83,3 +83,5 @@ This is a simple example of how to use Mem0 to create a personalized AI agent. Y
|
||||
Build another type of personalized companion with memory capabilities.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -238,17 +238,13 @@ You've successfully built a Gemini 3 agent with persistent memory using Mem0's M
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="MCP Integration Feature"
|
||||
description="Learn about MCP configuration options and deployment methods"
|
||||
icon="plug"
|
||||
href="/platform/features/mcp-integration"
|
||||
/>
|
||||
<CardGroup cols={1}>
|
||||
<Card
|
||||
title="MCP Quickstart"
|
||||
description="Get started with MCP for any AI client in minutes"
|
||||
icon="rocket"
|
||||
href="/platform/mem0-mcp"
|
||||
/>
|
||||
</CardGroup>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -369,3 +369,5 @@ Based on our previous session, I remember we covered Vision Language Models and
|
||||
Learn how to scope memories across multiple agents, users, and sessions.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -197,3 +197,5 @@ I've ordered a pizza for you, and the bill has been sent to your email. Enjoy yo
|
||||
Master the core patterns for memory-powered agents across frameworks.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -41,3 +41,5 @@ Visit [multimodal-demo.mem0.ai](https://multimodal-demo.mem0.ai) to experience M
|
||||
Build voice-first companions that remember conversations.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -236,3 +236,5 @@ context = Mem0Context(user_id="user123")
|
||||
Learn the core patterns for memory-powered agents with any SDK.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -129,3 +129,5 @@ With Mem0 and AWS services like Bedrock and OpenSearch, you can build intelligen
|
||||
Understand how Mem0's memory system is benchmarked and evaluated.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -299,3 +299,5 @@ By storing and retrieving patient information intelligently, the assistant provi
|
||||
Apply similar memory patterns to customer support workflows.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -136,3 +136,5 @@ In the example above:
|
||||
Explore tool-calling patterns with the OpenAI Agents SDK.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -295,3 +295,5 @@ run().catch(console.error);
|
||||
Fine-tune what memories get stored during tool calls.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -39,7 +39,7 @@ Let’s break down the main components.
|
||||
|
||||
### 1: Initialize Mem0 with Custom Instructions
|
||||
|
||||
We configure Mem0 with custom instructions that guide it to infer user memories tailored specifically for our usecase.
|
||||
We configure Mem0 with custom instructions that guide it to infer user memories tailored specifically for our use case.
|
||||
|
||||
```python
|
||||
from mem0 import MemoryClient
|
||||
@@ -202,3 +202,5 @@ Full Code: [Personalized Search GitHub](https://github.com/mem0ai/mem0/blob/main
|
||||
Categorize search results and user preferences for better personalization.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -364,3 +364,5 @@ Mem0 enables a seamless, intelligent content-writing workflow, perfect for conte
|
||||
Automate email drafting with memory-powered context and tone matching.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -77,3 +77,5 @@ Watch Deep Research in action:
|
||||
Build a video research assistant that remembers insights from content.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -432,3 +432,5 @@ By combining Mem0's memory capabilities with email processing, you can create in
|
||||
Build customer support agents that remember context across tickets.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -121,3 +121,5 @@ As the conversation progresses, Mem0's memory automatically updates based on the
|
||||
Extend support capabilities with intelligent email processing and routing.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -134,3 +134,5 @@ Mem0 enables fast, transparent collaboration for teams and agents, with full att
|
||||
Apply collaborative memory patterns to customer support scenarios.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Snippet file="star-on-github.mdx" />
|
||||
|
||||
@@ -9,10 +9,26 @@ With Mem0, you can create stateful LLM-based applications such as chatbots, virt
|
||||
- More reliable
|
||||
- Cost-effective by reducing the number of LLM interactions
|
||||
- More engaging
|
||||
- Enables long-term memory
|
||||
- Enriched by long-term memory
|
||||
|
||||
Here are some examples of how Mem0 can be integrated into various applications:
|
||||
|
||||
## Start here
|
||||
|
||||
The most popular cookbooks to get going fast:
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Build an AI companion" icon="users" href="/cookbooks/essentials/building-ai-companion">
|
||||
The core memory lifecycle, end to end.
|
||||
</Card>
|
||||
<Card title="Self-host with Ollama" icon="server" href="/cookbooks/companions/local-companion-ollama">
|
||||
Run Mem0 fully local with Ollama.
|
||||
</Card>
|
||||
<Card title="Partition memory by entity" icon="layer-group" href="/cookbooks/essentials/entity-partitioning-playbook">
|
||||
Scope memories per user, agent, and app.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Essentials
|
||||
|
||||
<CardGroup cols={2}>
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
title: "How Mem0 Works"
|
||||
description: "What happens when you add, store, and search memories with Mem0."
|
||||
icon: "diagram-project"
|
||||
---
|
||||
|
||||
Mem0 sits between your application and your model. You send conversation turns to `add`, then call `search` before the next model request to fetch relevant context. Your app decides which returned memories to include in the prompt.
|
||||
|
||||
Use Mem0 when you want agents to remember useful facts across turns, sessions, or users without replaying the full transcript every time.
|
||||
|
||||
<Frame caption="Memory extraction: Mem0 turns messages into stored facts with metadata, embeddings, and optional entity relationships.">
|
||||
<img src="/images/memory-extraction.png" alt="Mem0 memory extraction pipeline: store new memories after the response, context lookup to find related memories, extract memories (ADD only) from input and context, deduplicate and embed, entity linking, written to a SQL database (facts and metadata), vector database (embeddings and similarity), and entity store (entities and relationships)." />
|
||||
</Frame>
|
||||
|
||||
## The mental model
|
||||
|
||||
| Without a memory layer | With Mem0 |
|
||||
|---|---|
|
||||
| Keep appending chat history to the prompt | Store facts once, then retrieve them by query |
|
||||
| Make the model re-read old turns | Give the model only the relevant memories |
|
||||
| Lose context when a session ends | Scope memory by `user_id`, `agent_id`, `run_id`, and metadata |
|
||||
|
||||
## Messages vs memories
|
||||
|
||||
You send Mem0 messages. By default, Mem0 stores extracted memories, not a verbatim transcript.
|
||||
|
||||
| Input | Stored memory |
|
||||
|---|---|
|
||||
| `"I prefer aisle seats"` | `User prefers aisle seats` |
|
||||
| `"Let's use Postgres for this project"` | `Project decision: use Postgres` |
|
||||
| Message metadata | Filterable fields such as category, app, user, or run |
|
||||
|
||||
Use `infer=False` when you need to store raw content exactly as provided. Otherwise, keep inference enabled so retrieval works on clean, deduplicated facts.
|
||||
|
||||
## Two phases: extraction and retrieval
|
||||
|
||||
Most applications use Mem0 in two places:
|
||||
|
||||
1. **After a useful interaction**, call `add` to store what should be remembered.
|
||||
2. **Before a model call**, call `search` and pass the best results into your prompt.
|
||||
|
||||
### 1. Extraction (writing memory)
|
||||
|
||||
When new messages arrive, Mem0 extracts durable facts and stores them with the identifiers and metadata you provide.
|
||||
|
||||
1. **Context lookup.** Mem0 checks related existing memories so it can avoid storing the same fact again.
|
||||
2. **Fact extraction.** An LLM extracts preferences, decisions, plans, and other details your agent can reuse.
|
||||
3. **Deduplication and embedding.** Redundant facts are removed, then each memory is embedded for semantic search.
|
||||
4. **Entity linking.** When configured, Mem0 links people, places, organizations, and concepts across memories.
|
||||
|
||||
The automatic extraction path is additive. If a user says, "I moved from Austin to Seattle," Mem0 can store the new fact without silently rewriting the old one. Use explicit `update` or `delete` operations when your application needs to correct or remove a memory.
|
||||
|
||||
### 2. Retrieval (reading memory)
|
||||
|
||||
When you call `search`, Mem0 ranks stored memories against your query and filters.
|
||||
|
||||
| Signal | What it does | Best for |
|
||||
|---|---|---|
|
||||
| **Semantic** | Vector similarity over embeddings | Conceptual questions |
|
||||
| **Keyword** | Term matching for exact words and phrases | Names, IDs, and factual lookups |
|
||||
| **Entity** | Boosts memories linked to entities in the query | Questions about a person, project, or account |
|
||||
| **Temporal** | Scores candidates on time metadata extracted at write time against the query's temporal intent | Temporal questions ("when did...", current state, recency) |
|
||||
|
||||
Platform retrieval fuses these signals in the managed service. OSS retrieval depends on your configured vector store, optional reranker, and graph store.
|
||||
|
||||
<Note>
|
||||
Always scope searches with filters such as `user_id`, `agent_id`, or `run_id`. This keeps memories from different users, agents, or sessions from mixing.
|
||||
</Note>
|
||||
|
||||
## Where memories live
|
||||
|
||||
Mem0 stores different parts of a memory in stores built for different lookup patterns:
|
||||
|
||||
| Store | Holds | Purpose |
|
||||
|---|---|---|
|
||||
| **SQL database** | Facts and metadata | The source of truth for each memory |
|
||||
| **Vector database** | Embeddings | Semantic similarity search |
|
||||
| **Entity or graph store** | Entities and relationships | Relationship-aware retrieval when graph memory is enabled |
|
||||
|
||||
On Mem0 Platform, these stores are managed for you. In OSS, you choose and operate the backing stores through your configuration.
|
||||
|
||||
## Build against this flow
|
||||
|
||||
- Call `add` only for information worth reusing later: preferences, decisions, account facts, goals, and durable feedback.
|
||||
- Call `search` before the model response, then include only the returned memories that help answer the current request.
|
||||
- Use metadata for filters your product already cares about, such as workspace, feature area, tenant, or data source.
|
||||
- Avoid storing secrets, raw credentials, or unredacted sensitive data. Mem0 is designed to retrieve stored context.
|
||||
|
||||
## Next steps
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Memory types" icon="brain" href="/core-concepts/memory-types">
|
||||
Choose the right scope for user, agent, run, and session memory.
|
||||
</Card>
|
||||
<Card title="Memory operations" icon="database" href="/core-concepts/memory-operations/add">
|
||||
Add, search, update, and delete memories from your app.
|
||||
</Card>
|
||||
<Card title="See the benchmarks" icon="chart-line" href="/core-concepts/memory-evaluation">
|
||||
Review the evaluation setup and benchmark results.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -9,7 +9,7 @@ iconType: "solid"
|
||||
|
||||
Most AI agent memory systems retrieve information by maximizing context window size. That works on benchmarks but not in production, where every token adds cost. **Token efficiency** means achieving high accuracy with less context per query. It is what separates benchmark performance from production viability.
|
||||
|
||||
The new Mem0 algorithm achieves competitive accuracy on LoCoMo, LongMemEval, and BEAM while averaging **under 7,000 tokens per retrieval call**. Full-context approaches on the same benchmarks routinely consume 25,000+ tokens per query.
|
||||
Mem0's algorithm achieves competitive accuracy on LoCoMo, LongMemEval, and BEAM while averaging **under 7,000 tokens per retrieval call**. Full-context approaches on the same benchmarks routinely consume 25,000+ tokens per query. Unless noted otherwise, scores are reported at a **top_200 retrieval budget** (the 200 highest-ranked memories per query).
|
||||
|
||||
Evaluating a memory system at scale comes down to three parameters: **accuracy** (what the benchmarks measure), **cost** (context tokens per query), and **performance** (latency). Optimizing one is easy. Balancing all three at scale is the actual problem.
|
||||
|
||||
@@ -17,17 +17,18 @@ Some benchmarks today, particularly smaller ones like LoCoMo and LongMemEval, ca
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
Mem0's memory system operates across two phases, **extraction** (writing) and **retrieval** (reading), with a graph memory layer (entity linking) connecting them.
|
||||
Mem0's memory system operates across two phases, **extraction** (writing) and **retrieval** (reading), connected by a graph memory layer (entity linking) and a temporal reasoning layer (time metadata written during extraction and scored during retrieval).
|
||||
|
||||
### Memory Extraction (Distillation)
|
||||
|
||||
When new conversations arrive, the extraction pipeline processes them through five stages:
|
||||
When new conversations arrive, the extraction pipeline processes them through six stages:
|
||||
|
||||
1. **Store New Memories**: Conversation enters the pipeline asynchronously (after the agent responds)
|
||||
2. **Context Lookup**: Find related existing memories to avoid duplicates
|
||||
3. **Distill Memories**: Single-pass LLM extraction produces ADD-only facts from input + context
|
||||
4. **Deduplicate + Embed**: Hash-based deduplication, then vectorize new memories
|
||||
5. **Graph Memory (Entity Linking)**: Identify entities (proper nouns, quoted text, compound noun phrases) and link them across memories into a graph
|
||||
6. **Temporal Reasoning**: A separate temporal reasoning pass reads each new memory alongside the source conversation and its date, extracting temporal metadata: when the event occurred, whether it is ongoing or completed, how precise the timing is, and the memory type (event, state, plan, preference, relationship, absence). It is independent of extraction and can run asynchronously so writes stay fast; this metadata is stored with the memory and used later at retrieval.
|
||||
|
||||
Memories are distributed across three storage layers, each tuned for a specific retrieval pattern:
|
||||
|
||||
@@ -43,20 +44,21 @@ The key architectural decision is **ADD-only extraction**. New facts are stored
|
||||
|
||||
### Multi-Signal Retrieval
|
||||
|
||||
When a query arrives, the retrieval pipeline scores candidates across three signals in parallel:
|
||||
When a query arrives, the retrieval pipeline scores candidates across multiple signals in parallel:
|
||||
|
||||
1. **Semantic Search**: Vector similarity scoring against memory embeddings
|
||||
2. **Keyword Search**: Normalized term matching via BM25 with verb-form lemmatization
|
||||
3. **Entity Search**: Entity matching boosts memories linked to query entities
|
||||
4. **Temporal Reasoning**: The query's temporal intent is classified (with no extra LLM call), then each candidate is scored by how well the temporal metadata extracted at write time matches that intent.
|
||||
|
||||
Results are fused via rank scoring into a final top-K set. Different query types lean on different signals:
|
||||
These signals are fused via rank scoring into the final top-K set. The temporal score is additive and semantic relevance always dominates; it nudges ranking toward the correct dated instance without filtering candidates out or overriding a strong semantic match, so relevant memories are never dropped. Different query types lean on different signals:
|
||||
|
||||
| Query Type | Primary Signal | Example |
|
||||
|---|---|---|
|
||||
| Conceptual | Semantic | "What does the user think about remote work?" |
|
||||
| Factual/exact | BM25 keyword | "What meetings did I attend last week?" |
|
||||
| Entity-centric | Entity matching | "What do we know about Alice?" |
|
||||
| Temporal | Semantic + keyword | "When did the user first mention the project?" |
|
||||
| Temporal | Temporal reasoning | "When did the user first mention the project?" |
|
||||
|
||||
The combined score outperformed every individual signal across every category tested.
|
||||
|
||||
@@ -66,37 +68,35 @@ The combined score outperformed every individual signal across every category te
|
||||
|
||||
[LoCoMo](https://github.com/snap-stanford/locomo) tests single-hop, multi-hop, open-domain, and temporal memory recall across conversational sessions.
|
||||
|
||||
| Category | Old Algorithm | New Algorithm | Delta |
|
||||
|---|---|---|---|
|
||||
| **Overall** | **71.4** | **91.6** | **+20.2** |
|
||||
| Single-hop | 76.6 | 92.3 | +15.7 |
|
||||
| Multi-hop | 70.2 | 93.3 | +23.1 |
|
||||
| Open-domain | 57.3 | 76.0 | +18.7 |
|
||||
| Temporal | 63.2 | 92.8 | +29.6 |
|
||||
| Category | Score |
|
||||
|---|---|
|
||||
| **Overall** | **92.5** |
|
||||
| Single-hop | 91.2 |
|
||||
| Multi-hop | 91.3 |
|
||||
| Open-domain | 72.7 |
|
||||
| Temporal | 92.0 |
|
||||
|
||||
*Mean tokens: 6,956*
|
||||
*Mean tokens: 6,956.*
|
||||
|
||||
The two largest gains are **temporal queries (+29.6)** and **multi-hop reasoning (+23.1)**. Both categories directly test the ADD-only architecture (preserving temporal context) and graph memory / entity linking (connecting facts across memories).
|
||||
Temporal reasoning is on by default and helps most on temporal (92.0) and multi-hop (91.3) questions, where the system has to identify which dated instance applies, while open-domain (72.7) does not benefit and is actively being tuned.
|
||||
|
||||
### LongMemEval
|
||||
|
||||
[LongMemEval](https://github.com/xiaowu0162/LongMemEval) evaluates memory across single-session and multi-session contexts, including knowledge updates and temporal reasoning.
|
||||
|
||||
| Category | Old Algorithm | New Algorithm | Delta |
|
||||
|---|---|---|---|
|
||||
| **Overall** | **67.8** | **93.4** | **+25.6** |
|
||||
| Single-session (user) | 94.3 | 97.1 | +2.8 |
|
||||
| Single-session (assistant) | 46.4 | 100.0 | +53.6 |
|
||||
| Single-session (preference) | 76.7 | 96.7 | +20.0 |
|
||||
| Knowledge update | 79.5 | 96.2 | +16.7 |
|
||||
| Temporal reasoning | 51.1 | 93.2 | +42.1 |
|
||||
| Multi-session | 70.7 | 86.5 | +15.8 |
|
||||
| Category | Score |
|
||||
|---|---|
|
||||
| **Overall** | **94.4** |
|
||||
| Single-session (user) | 98.6 |
|
||||
| Single-session (assistant) | 98.2 |
|
||||
| Single-session (preference) | 96.7 |
|
||||
| Knowledge update | 93.6 |
|
||||
| Temporal reasoning | 97.0 |
|
||||
| Multi-session | 88.0 |
|
||||
|
||||
*Mean tokens: 6,787*
|
||||
*Mean tokens: 6,787.*
|
||||
|
||||
The biggest gain is **single-session assistant (+53.6)** because the previous algorithm had a blind spot for agent-generated facts. The new algorithm treats them as first-class memories.
|
||||
|
||||
The **+42.1 on temporal reasoning** reflects the ADD-only architecture preserving chronological context that the previous UPDATE/DELETE model would destroy.
|
||||
Temporal reasoning is the standout at a top_200 budget, reaching **97.0** on the temporal-reasoning category, with single-session user and assistant both near-saturated (98.6 and 98.2). Knowledge update (93.6) remains the hardest category for an additive, ADD-only architecture: older facts are preserved rather than overwritten, so semantically similar prior facts can still surface alongside newer ones.
|
||||
|
||||
### BEAM
|
||||
|
||||
@@ -124,14 +124,14 @@ The **+42.1 on temporal reasoning** reflects the ADD-only architecture preservin
|
||||
|
||||
### Performance Summary
|
||||
|
||||
All results use a single-pass retrieval setup: one retrieval call, one answer, no agentic loops.
|
||||
All results use a single-pass retrieval setup (one retrieval call, one answer, no agentic loops) at a top_200 retrieval budget.
|
||||
|
||||
| Benchmark | Old Algorithm | New Algorithm | Average tokens / query |
|
||||
|---|---|---|---|
|
||||
| **LoCoMo** | 71.4 | **91.6** | 6,956 |
|
||||
| **LongMemEval** | 67.8 | **93.4** | 6,787 |
|
||||
| **BEAM (1M)** | N/A | **64.1** | 6,719 |
|
||||
| **BEAM (10M)** | N/A | **48.6** | 6,914 |
|
||||
| Benchmark | Score | Average tokens / query |
|
||||
|---|---|---|
|
||||
| **LoCoMo** | **92.5** | 6,956 |
|
||||
| **LongMemEval** | **94.4** | 6,787 |
|
||||
| **BEAM (1M)** | **64.1** | 6,719 |
|
||||
| **BEAM (10M)** | **48.6** | 6,914 |
|
||||
|
||||
<Info>
|
||||
Scores reflect Mem0's managed platform, which includes proprietary optimizations not available in the open-source SDK. Open-source users should expect directionally similar gains but not identical numbers.
|
||||
|
||||
@@ -9,26 +9,19 @@ iconType: "solid"
|
||||
|
||||
Adding memory is how Mem0 captures useful details from a conversation so your agents can reuse them later. Think of it as saving the important sentences from a chat transcript into a structured notebook your agent can search.
|
||||
|
||||
<Info>
|
||||
**Why it matters**
|
||||
- Preserves user preferences, goals, and feedback across sessions.
|
||||
- Powers personalization and decision-making in downstream conversations.
|
||||
- Keeps context consistent between managed Platform and OSS deployments.
|
||||
</Info>
|
||||
|
||||
## Key terms
|
||||
|
||||
- **Messages** – The ordered list of user/assistant turns you send to `add`.
|
||||
- **Infer** – Controls whether Mem0 extracts structured memories (`infer=True`, default) or stores raw messages.
|
||||
- **Metadata** – Optional filters (e.g., `{"category": "movie_recommendations"}`) that improve retrieval later.
|
||||
- **User / Session identifiers** – `user_id`, `agent_id`, `app_id`, or `run_id` that scope the memory for future searches.
|
||||
- **Messages**: The ordered list of user/assistant turns you send to `add`.
|
||||
- **Infer**: Controls whether Mem0 extracts structured memories (`infer=True`, default) or stores raw messages.
|
||||
- **Metadata**: Optional filters (e.g., `{"category": "movie_recommendations"}`) that improve retrieval later.
|
||||
- **User / Session identifiers**: `user_id`, `agent_id`, `app_id`, or `run_id` that scope the memory for future searches.
|
||||
|
||||
## How does it work?
|
||||
|
||||
Mem0 offers two flows:
|
||||
|
||||
- **Mem0 Platform** – Fully managed API with dashboard and scaling.
|
||||
- **Mem0 Open Source** – Local SDK that you run in your own environment.
|
||||
- **Mem0 Platform**: Fully managed API with dashboard and scaling.
|
||||
- **Mem0 Open Source**: Local SDK that you run in your own environment.
|
||||
|
||||
Both flows take the same payload and add memories through an additive pipeline.
|
||||
|
||||
@@ -157,7 +150,6 @@ Add memory whenever your agent learns something useful:
|
||||
|
||||
Storing this context allows the agent to reason better in future interactions.
|
||||
|
||||
|
||||
### More Details
|
||||
|
||||
For full list of supported fields, required formats, and advanced options, see the
|
||||
|
||||
@@ -18,10 +18,10 @@ Deleting memories is how you honor compliance requests, undo bad data, or clean
|
||||
|
||||
## Key terms
|
||||
|
||||
- **memory_id** – Unique ID returned by `add`/`search` identifying the record to delete.
|
||||
- **batch_delete** – API call that removes up to 1000 memories in one request.
|
||||
- **delete_all** – Filter-based deletion by user, agent, run, or metadata.
|
||||
- **immutable** – Flagged memories that cannot be updated; delete + re-add instead.
|
||||
- **memory_id**: Unique ID returned by `add`/`search` identifying the record to delete.
|
||||
- **batch_delete**: API call that removes up to 1000 memories in one request.
|
||||
- **delete_all**: Filter-based deletion by user, agent, run, or metadata.
|
||||
- **immutable**: Flagged memories that cannot be updated; delete + re-add instead.
|
||||
|
||||
## How the delete flow works
|
||||
|
||||
@@ -216,7 +216,7 @@ memory.delete_all(user_id="alice")
|
||||
## Put it into practice
|
||||
|
||||
- Review the <Link href="/api-reference/memory/delete-memory">Delete Memory API reference</Link>, plus <Link href="/api-reference/memory/batch-delete">Batch Delete</Link> and <Link href="/api-reference/memory/delete-memories">Filtered Delete</Link>.
|
||||
- Pair deletes with <Link href="/platform/features/platform-overview">Expiration Policies</Link> to automate retention.
|
||||
- Pair deletes with the <Link href="/api-reference/memory/update-memory">expiration date field</Link> to automate retention.
|
||||
|
||||
## See it live
|
||||
|
||||
@@ -233,9 +233,9 @@ memory.delete_all(user_id="alice")
|
||||
href="/core-concepts/memory-operations/add"
|
||||
/>
|
||||
<Card
|
||||
title="Enable Expiration Policies"
|
||||
description="Automate retention with the platform’s expiration feature."
|
||||
title="Set an Expiration Date"
|
||||
description="Automate retention with the expiration date field on update."
|
||||
icon="clock"
|
||||
href="/platform/features/platform-overview"
|
||||
href="/api-reference/memory/update-memory"
|
||||
/>
|
||||
</CardGroup>
|
||||
|
||||
@@ -9,19 +9,12 @@ iconType: "solid"
|
||||
|
||||
Mem0's search operation lets agents ask natural-language questions and get back the memories that matter most. Like a smart librarian, it finds exactly what you need from everything you've stored.
|
||||
|
||||
<Info>
|
||||
**Why it matters**
|
||||
- Retrieves the right facts without rebuilding prompts from scratch.
|
||||
- Supports both managed Platform and OSS so you can test locally and deploy at scale.
|
||||
- Keeps results relevant with filters, rerankers, and thresholds.
|
||||
</Info>
|
||||
|
||||
## Key terms
|
||||
|
||||
- **Query** – Natural-language question or statement you pass to `search`.
|
||||
- **Filters** – JSON logic (AND/OR, comparison operators) that narrows results by user, categories, dates, etc.
|
||||
- **top_k / threshold** – Controls how many memories return and the minimum similarity score.
|
||||
- **Rerank** – Optional second pass that boosts precision when a reranker is configured.
|
||||
- **Query**: Natural-language question or statement you pass to `search`.
|
||||
- **Filters**: JSON logic (AND/OR, comparison operators) that narrows results by user, categories, dates, etc.
|
||||
- **top_k / threshold**: Controls how many memories return and the minimum similarity score.
|
||||
- **Rerank**: Optional second pass that boosts precision when a reranker is configured.
|
||||
|
||||
## Architecture
|
||||
|
||||
|
||||
@@ -9,21 +9,14 @@ iconType: "solid"
|
||||
|
||||
Mem0’s update operation lets you fix or enrich an existing memory without deleting it. When a user changes their preference or clarifies a fact, use update to keep the knowledge base fresh.
|
||||
|
||||
<Info>
|
||||
**Why it matters**
|
||||
- Corrects outdated or incorrect memories immediately.
|
||||
- Adds new metadata so filters and rerankers stay sharp.
|
||||
- Works for both one-off edits and large batches (up to 1000 memories).
|
||||
</Info>
|
||||
|
||||
## Key terms
|
||||
|
||||
- **memory_id** – Unique identifier returned by `add` or `search` results.
|
||||
- **text** / **data** – New content that replaces the stored memory value.
|
||||
- **metadata** – Optional key-value pairs you update alongside the text.
|
||||
- **timestamp** – Unix epoch (int/float) or ISO 8601 string to override the memory's timestamp.
|
||||
- **batch_update** – Platform API that edits multiple memories in a single request.
|
||||
- **immutable** – Flagged memories that must be deleted and re-added instead of updated.
|
||||
- **memory_id**: Unique identifier returned by `add` or `search` results.
|
||||
- **text** / **data**: New content that replaces the stored memory value.
|
||||
- **metadata**: Optional key-value pairs you update alongside the text.
|
||||
- **timestamp**: Unix epoch (int/float) or ISO 8601 string to override the memory's timestamp.
|
||||
- **batch_update**: Platform API that edits multiple memories in a single request.
|
||||
- **immutable**: Flagged memories that must be deleted and re-added instead of updated.
|
||||
|
||||
## How the update flow works
|
||||
|
||||
|
||||
@@ -9,19 +9,12 @@ iconType: "solid"
|
||||
|
||||
Mem0 separates memory into layers so agents remember the right detail at the right time. Think of it like a notebook: a sticky note for the current task, a daily journal for the session, and an archive for everything a user has shared.
|
||||
|
||||
<Info>
|
||||
**Why it matters**
|
||||
- Keeps conversations coherent without repeating instructions.
|
||||
- Lets agents personalize responses based on long-term preferences.
|
||||
- Avoids over-fetching data by scoping memory to the correct layer.
|
||||
</Info>
|
||||
|
||||
## Key terms
|
||||
|
||||
- **Conversation memory** – In-flight messages inside a single turn (what was just said).
|
||||
- **Session memory** – Short-lived facts that apply for the current task or channel.
|
||||
- **User memory** – Long-lived knowledge tied to a person, account, or workspace.
|
||||
- **Organizational memory** – Shared context available to multiple agents or teams.
|
||||
- **Conversation memory**: In-flight messages inside a single turn (what was just said).
|
||||
- **Session memory**: Short-lived facts that apply for the current task or channel.
|
||||
- **User memory**: Long-lived knowledge tied to a person, account, or workspace.
|
||||
- **Organizational memory**: Shared context available to multiple agents or teams.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
@@ -35,15 +28,15 @@ graph LR
|
||||
|
||||
Short-term memory keeps the current conversation coherent. It includes:
|
||||
|
||||
- **Conversation history** – recent turns in order so the agent remembers what was just said.
|
||||
- **Working memory** – temporary state such as tool outputs or intermediate calculations.
|
||||
- **Attention context** – the immediate focus of the assistant, similar to what a person holds in mind mid-sentence.
|
||||
- **Conversation history**: recent turns in order so the agent remembers what was just said.
|
||||
- **Working memory**: temporary state such as tool outputs or intermediate calculations.
|
||||
- **Attention context**: the immediate focus of the assistant, similar to what a person holds in mind mid-sentence.
|
||||
|
||||
Long-term memory preserves knowledge across sessions. It captures:
|
||||
|
||||
- **Factual memory** – user preferences, account details, and domain facts.
|
||||
- **Episodic memory** – summaries of past interactions or completed tasks.
|
||||
- **Semantic memory** – relationships between concepts so agents can reason about them later.
|
||||
- **Factual memory**: user preferences, account details, and domain facts.
|
||||
- **Episodic memory**: summaries of past interactions or completed tasks.
|
||||
- **Semantic memory**: relationships between concepts so agents can reason about them later.
|
||||
|
||||
Mem0 maps these classic categories onto its layered storage so you can decide what should fade quickly versus what should last for months.
|
||||
|
||||
@@ -51,9 +44,9 @@ Mem0 maps these classic categories onto its layered storage so you can decide wh
|
||||
|
||||
Mem0 stores each layer separately and merges them when you query:
|
||||
|
||||
1. **Capture** – Messages enter the conversation layer while the turn is active.
|
||||
2. **Promote** – Relevant details persist to session or user memory based on your `user_id`, `run_id`, and metadata.
|
||||
3. **Retrieve** – The search pipeline pulls from all layers, ranking user memories first, then session notes, then raw history.
|
||||
1. **Capture**: Messages enter the conversation layer while the turn is active.
|
||||
2. **Promote**: Relevant details persist to session or user memory based on your `user_id`, `run_id`, and metadata.
|
||||
3. **Retrieve**: The search pipeline pulls from all layers, ranking user memories first, then session notes, then raw history.
|
||||
|
||||
```python
|
||||
import os
|
||||
@@ -82,10 +75,10 @@ results = memory.search(
|
||||
|
||||
## When should you use each layer?
|
||||
|
||||
- **Conversation memory** – Tool calls or chain-of-thought that only matter within the current turn.
|
||||
- **Session memory** – Multi-step tasks (onboarding flows, debugging sessions) that should reset once complete.
|
||||
- **User memory** – Personal preferences, account state, or compliance details that must persist across interactions.
|
||||
- **Organizational memory** – Shared FAQs, product catalogs, or policies that every agent should recall.
|
||||
- **Conversation memory**: Tool calls or chain-of-thought that only matter within the current turn.
|
||||
- **Session memory**: Multi-step tasks (onboarding flows, debugging sessions) that should reset once complete.
|
||||
- **User memory**: Personal preferences, account state, or compliance details that must persist across interactions.
|
||||
- **Organizational memory**: Shared FAQs, product catalogs, or policies that every agent should recall.
|
||||
|
||||
## How it compares
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"light": "#8F74E0",
|
||||
"dark": "#8F74E0"
|
||||
},
|
||||
"favicon": "/logo/favicon.png",
|
||||
"favicon": "/logo/favicon.svg",
|
||||
"logo": {
|
||||
"light": "/logo/light.svg",
|
||||
"dark": "/logo/dark.svg",
|
||||
@@ -21,7 +21,7 @@
|
||||
"icon": "book-open",
|
||||
"tabs": [
|
||||
{
|
||||
"tab": "Welcome",
|
||||
"tab": "Get Started",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Start Here",
|
||||
@@ -39,19 +39,20 @@
|
||||
"group": "Getting Started",
|
||||
"icon": "rocket",
|
||||
"pages": [
|
||||
"platform/quickstart",
|
||||
"platform/overview",
|
||||
"platform/agent-signup",
|
||||
"vibecoding",
|
||||
"platform/mem0-mcp",
|
||||
"platform/cli",
|
||||
"platform/platform-vs-oss",
|
||||
"platform/quickstart"
|
||||
"platform/mem0-mcp",
|
||||
"platform/platform-vs-oss"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Core Concepts",
|
||||
"icon": "brain",
|
||||
"pages": [
|
||||
"core-concepts/how-it-works",
|
||||
"core-concepts/memory-types",
|
||||
"core-concepts/memory-operations/add",
|
||||
"core-concepts/memory-operations/search",
|
||||
@@ -61,12 +62,11 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Platform Features",
|
||||
"group": "Features",
|
||||
"icon": "star",
|
||||
"pages": [
|
||||
"platform/features/platform-overview",
|
||||
{
|
||||
"group": "Essential Features",
|
||||
"group": "Essentials",
|
||||
"icon": "circle-check",
|
||||
"pages": [
|
||||
"platform/features/v2-memory-filters",
|
||||
@@ -79,7 +79,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Advanced Features",
|
||||
"group": "Advanced",
|
||||
"icon": "bolt",
|
||||
"pages": [
|
||||
"platform/features/advanced-retrieval",
|
||||
@@ -100,38 +100,30 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Integration Features",
|
||||
"group": "Integrations",
|
||||
"icon": "plug",
|
||||
"pages": [
|
||||
"platform/features/webhooks",
|
||||
"platform/features/feedback-mechanism",
|
||||
"platform/features/group-chat",
|
||||
"platform/features/mcp-integration"
|
||||
"platform/features/group-chat"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Support & Troubleshooting",
|
||||
"group": "Support",
|
||||
"icon": "life-buoy",
|
||||
"pages": [
|
||||
"platform/faqs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Migration Guide",
|
||||
"group": "Migration",
|
||||
"icon": "arrow-right",
|
||||
"pages": [
|
||||
"migration/platform-v2-to-v3",
|
||||
"migration/oss-to-platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Contribute",
|
||||
"icon": "clipboard-list",
|
||||
"pages": [
|
||||
"platform/contribute"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -143,14 +135,14 @@
|
||||
"icon": "rocket",
|
||||
"pages": [
|
||||
"open-source/overview",
|
||||
"open-source/setup",
|
||||
"vibecoding",
|
||||
"open-source/python-quickstart",
|
||||
"open-source/node-quickstart"
|
||||
"open-source/node-quickstart",
|
||||
"open-source/setup",
|
||||
"vibecoding"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Self-Hosting Features",
|
||||
"group": "Features",
|
||||
"icon": "server",
|
||||
"pages": [
|
||||
"open-source/features/overview",
|
||||
@@ -300,77 +292,8 @@
|
||||
"icon": "users",
|
||||
"pages": [
|
||||
"contributing/development",
|
||||
"contributing/documentation"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Cookbooks",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Getting Started",
|
||||
"icon": "lightbulb",
|
||||
"pages": [
|
||||
"cookbooks/overview"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Essentials",
|
||||
"icon": "flag",
|
||||
"pages": [
|
||||
"cookbooks/essentials/building-ai-companion",
|
||||
"cookbooks/essentials/entity-partitioning-playbook",
|
||||
"cookbooks/essentials/controlling-memory-ingestion",
|
||||
"cookbooks/essentials/tagging-and-organizing-memories",
|
||||
"cookbooks/essentials/exporting-memories"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Companion Playbooks",
|
||||
"icon": "users",
|
||||
"pages": [
|
||||
"cookbooks/companions/quickstart-demo",
|
||||
"cookbooks/companions/nodejs-companion",
|
||||
"cookbooks/companions/ai-tutor",
|
||||
"cookbooks/companions/travel-assistant",
|
||||
"cookbooks/companions/youtube-research",
|
||||
"cookbooks/companions/voice-companion-openai",
|
||||
"cookbooks/companions/local-companion-ollama"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Ops & Automations",
|
||||
"icon": "briefcase",
|
||||
"pages": [
|
||||
"cookbooks/operations/support-inbox",
|
||||
"cookbooks/operations/email-automation",
|
||||
"cookbooks/operations/content-writing",
|
||||
"cookbooks/operations/deep-research",
|
||||
"cookbooks/operations/team-task-agent"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Integrations & Platforms",
|
||||
"icon": "plug",
|
||||
"pages": [
|
||||
"cookbooks/integrations/agents-sdk-tool",
|
||||
"cookbooks/integrations/openai-tool-calls",
|
||||
"cookbooks/integrations/mastra-agent",
|
||||
"cookbooks/integrations/healthcare-google-adk",
|
||||
"cookbooks/integrations/aws-bedrock",
|
||||
"cookbooks/integrations/tavily-search"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Frameworks & Multimodal",
|
||||
"icon": "layers",
|
||||
"pages": [
|
||||
"cookbooks/frameworks/llamaindex-react",
|
||||
"cookbooks/frameworks/llamaindex-multiagent",
|
||||
"cookbooks/frameworks/multimodal-retrieval",
|
||||
"cookbooks/frameworks/eliza-os-character",
|
||||
"cookbooks/frameworks/gemini-3-with-mem0-mcp"
|
||||
"contributing/documentation",
|
||||
"platform/contribute"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -458,6 +381,76 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Cookbooks",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Getting Started",
|
||||
"icon": "lightbulb",
|
||||
"pages": [
|
||||
"cookbooks/overview"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Essentials",
|
||||
"icon": "flag",
|
||||
"pages": [
|
||||
"cookbooks/essentials/building-ai-companion",
|
||||
"cookbooks/essentials/entity-partitioning-playbook",
|
||||
"cookbooks/essentials/controlling-memory-ingestion",
|
||||
"cookbooks/essentials/tagging-and-organizing-memories",
|
||||
"cookbooks/essentials/exporting-memories"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Companion Playbooks",
|
||||
"icon": "users",
|
||||
"pages": [
|
||||
"cookbooks/companions/quickstart-demo",
|
||||
"cookbooks/companions/nodejs-companion",
|
||||
"cookbooks/companions/ai-tutor",
|
||||
"cookbooks/companions/travel-assistant",
|
||||
"cookbooks/companions/youtube-research",
|
||||
"cookbooks/companions/voice-companion-openai",
|
||||
"cookbooks/companions/local-companion-ollama"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Ops & Automations",
|
||||
"icon": "briefcase",
|
||||
"pages": [
|
||||
"cookbooks/operations/support-inbox",
|
||||
"cookbooks/operations/email-automation",
|
||||
"cookbooks/operations/content-writing",
|
||||
"cookbooks/operations/deep-research",
|
||||
"cookbooks/operations/team-task-agent"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Integrations & Platforms",
|
||||
"icon": "plug",
|
||||
"pages": [
|
||||
"cookbooks/integrations/agents-sdk-tool",
|
||||
"cookbooks/integrations/openai-tool-calls",
|
||||
"cookbooks/integrations/mastra-agent",
|
||||
"cookbooks/integrations/healthcare-google-adk",
|
||||
"cookbooks/integrations/aws-bedrock",
|
||||
"cookbooks/integrations/tavily-search"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Frameworks & Multimodal",
|
||||
"icon": "layers",
|
||||
"pages": [
|
||||
"cookbooks/frameworks/llamaindex-react",
|
||||
"cookbooks/frameworks/llamaindex-multiagent",
|
||||
"cookbooks/frameworks/multimodal-retrieval",
|
||||
"cookbooks/frameworks/eliza-os-character",
|
||||
"cookbooks/frameworks/gemini-3-with-mem0-mcp"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "API Reference",
|
||||
"groups": [
|
||||
@@ -481,7 +474,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Memory APIs",
|
||||
"group": "Memory Management",
|
||||
"icon": "sparkles",
|
||||
"pages": [
|
||||
"api-reference/memory/create-memory-export",
|
||||
@@ -495,7 +488,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Events APIs",
|
||||
"group": "Events",
|
||||
"icon": "clock",
|
||||
"pages": [
|
||||
"api-reference/events/get-events",
|
||||
@@ -503,7 +496,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Entities APIs",
|
||||
"group": "Entities",
|
||||
"icon": "users",
|
||||
"pages": [
|
||||
"api-reference/entities/get-users",
|
||||
@@ -511,7 +504,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Organizations APIs",
|
||||
"group": "Organizations",
|
||||
"icon": "building",
|
||||
"pages": [
|
||||
"api-reference/organization/create-org",
|
||||
@@ -525,7 +518,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Project APIs",
|
||||
"group": "Projects",
|
||||
"icon": "folder",
|
||||
"pages": [
|
||||
"api-reference/project/create-project",
|
||||
@@ -540,7 +533,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Webhook APIs",
|
||||
"group": "Webhooks",
|
||||
"icon": "webhook",
|
||||
"pages": [
|
||||
"api-reference/webhook/create-webhook",
|
||||
@@ -970,17 +963,25 @@
|
||||
"source": "/v0x/introduction",
|
||||
"destination": "/introduction"
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/mcp-integration",
|
||||
"destination": "/platform/mem0-mcp"
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/platform-overview",
|
||||
"destination": "/platform/features/v2-memory-filters"
|
||||
},
|
||||
{
|
||||
"source": "/features/async-client",
|
||||
"destination": "/platform/features/async-client"
|
||||
},
|
||||
{
|
||||
"source": "/features/custom-prompts",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/platform/features/custom-instructions"
|
||||
},
|
||||
{
|
||||
"source": "/features/selective-memory",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/platform/features/custom-instructions"
|
||||
},
|
||||
{
|
||||
"source": "/features/custom-categories",
|
||||
@@ -1012,7 +1013,7 @@
|
||||
},
|
||||
{
|
||||
"source": "/features/online-memory",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/platform/features/async-client"
|
||||
},
|
||||
{
|
||||
"source": "/features/multimodal",
|
||||
@@ -1020,7 +1021,7 @@
|
||||
},
|
||||
{
|
||||
"source": "/features/inferences",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/core-concepts/how-it-works"
|
||||
},
|
||||
{
|
||||
"source": "/features/graph-memory",
|
||||
@@ -1032,7 +1033,7 @@
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/online-memory",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/platform/features/async-client"
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/multimodal",
|
||||
@@ -1040,7 +1041,7 @@
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/inferences",
|
||||
"destination": "/platform/features/platform-overview"
|
||||
"destination": "/core-concepts/how-it-works"
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/custom-prompts",
|
||||
@@ -1149,6 +1150,82 @@
|
||||
{
|
||||
"source": "/openmemory/integrations",
|
||||
"destination": "/introduction"
|
||||
},
|
||||
{
|
||||
"source": "/self-hosting",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/self-hosting/:slug",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/self-hosted",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/self-hosted/:slug",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started",
|
||||
"destination": "/platform/quickstart"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/:slug",
|
||||
"destination": "/platform/quickstart"
|
||||
},
|
||||
{
|
||||
"source": "/deployment",
|
||||
"destination": "/open-source/setup"
|
||||
},
|
||||
{
|
||||
"source": "/deployment/:slug",
|
||||
"destination": "/open-source/setup"
|
||||
},
|
||||
{
|
||||
"source": "/configuration",
|
||||
"destination": "/open-source/configuration"
|
||||
},
|
||||
{
|
||||
"source": "/oss",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/oss/:slug",
|
||||
"destination": "/open-source/overview"
|
||||
},
|
||||
{
|
||||
"source": "/concepts/:slug",
|
||||
"destination": "/core-concepts/:slug"
|
||||
},
|
||||
{
|
||||
"source": "/pricing",
|
||||
"destination": "/platform/overview"
|
||||
},
|
||||
{
|
||||
"source": "/get-started/installation",
|
||||
"destination": "/platform/quickstart"
|
||||
},
|
||||
{
|
||||
"source": "/api-reference/add-memory",
|
||||
"destination": "/api-reference/memory/add-memories"
|
||||
},
|
||||
{
|
||||
"source": "/components/graph_memory/overview",
|
||||
"destination": "/migration/oss-v2-to-v3"
|
||||
},
|
||||
{
|
||||
"source": "/platform/features/mcp-quickstart",
|
||||
"destination": "/platform/mem0-mcp"
|
||||
},
|
||||
{
|
||||
"source": "/open-source/features/supported-vector-dbs",
|
||||
"destination": "/components/vectordbs/overview"
|
||||
},
|
||||
{
|
||||
"source": "/open-source/multimodal-support",
|
||||
"destination": "/open-source/features/multimodal-support"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 383 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 419 KiB |
|
Before Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 343 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 349 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 196 KiB |
@@ -0,0 +1,7 @@
|
||||
<svg width="195" height="75" viewBox="0 0 195 75" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.9802 0.200195H16.5703V10.1702H38.0442L56.3442 58.8102H68.1658L44.9802 0.200195Z" fill="#8F74E0"/>
|
||||
<path d="M29.59 48.8403H0.5V58.8103H29.59V48.8403Z" fill="#8F74E0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M106.781 57.3271L106.748 57.2946C106.538 62.7046 104.862 66.8535 101.651 69.6754C99.5756 71.5114 96.5827 72.8283 93.2745 73.5576C89.9605 74.288 86.2923 74.4374 82.8361 73.9058C75.9469 72.8462 69.7197 69.0281 69.1124 61.5207L69.0687 60.9803H78.6597L78.725 61.4043C79.2382 64.7375 82.2366 66.4244 85.7803 66.7766C87.5364 66.9511 89.3766 66.7868 91.0038 66.3457C92.6378 65.9028 94.0152 65.1926 94.8845 64.3096L94.8981 64.2958L94.9127 64.2831C95.4723 63.7965 95.9123 63.0704 96.2494 62.1504C96.5856 61.2328 96.8086 60.152 96.9526 58.9907C97.2411 56.6652 97.2058 54.0891 97.1761 51.9777L97.176 51.9732L97.1725 51.7158C94.7704 55.4822 91.6364 57.5831 88.3259 58.402C84.6598 59.3088 80.8264 58.6317 77.5991 56.9885C73.8994 55.2095 71.4248 51.9689 69.8863 48.249C68.3481 44.5298 67.7308 40.2996 67.7608 36.4697C67.7213 29.0048 71.2243 20.2031 78.2871 16.8883C81.4568 15.376 85.3623 14.7771 88.9867 15.6312C92.1761 16.3827 95.1358 18.258 97.1608 21.5917V16.3104H106.781V57.3271ZM94.6816 46.608C92.9795 49.2165 90.4738 50.8999 87.1583 50.8504L87.1487 50.8504C83.8825 50.8645 81.4259 49.1844 79.7641 46.5957C78.0929 43.9925 77.2408 40.4841 77.2408 36.9466C77.2408 33.4091 78.0929 29.9014 79.764 27.2995C81.4258 24.7121 83.8822 23.0339 87.1483 23.0504L87.1567 23.0504L87.1652 23.0502C90.5349 22.9535 93.0495 24.6029 94.7414 27.1812C96.4443 29.7765 97.3024 33.306 97.2896 36.8736C97.2767 40.4407 96.3932 43.9852 94.6816 46.608Z" fill="#8F74E0"/>
|
||||
<path d="M122.38 21.817V16.29H113.24V58.84H122.83V32.77C122.83 31.4259 123.051 30.1528 123.481 28.9482C123.912 27.743 124.51 26.7201 125.264 25.8723L125.272 25.8624C126.034 24.9601 126.941 24.2776 128.028 23.8091L128.036 23.8056L128.044 23.8018C129.13 23.2869 130.356 23.02 131.75 23.02C134.224 23.02 135.948 23.6948 137.019 24.9541L137.027 24.9623C138.12 26.1911 138.761 28.2555 138.86 31.2684V58.84H148.45V29C148.45 24.4884 147.192 21.012 144.594 18.678C142.019 16.364 138.517 15.23 134.16 15.23C131.517 15.23 129.089 15.8709 126.898 17.1784C125.084 18.2196 123.584 20.0156 122.38 21.817Z" fill="#8F74E0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M189.43 21.9877C186.048 17.7695 180.97 15.0322 174.236 15.2401C167.503 15.0322 162.425 17.7695 159.043 21.9877C155.669 26.1945 153.999 31.8497 154 37.4791C154.001 43.1085 155.672 48.7631 159.045 52.9686C162.428 57.1855 167.505 59.9209 174.236 59.7106C180.967 59.9209 186.044 57.1855 189.427 52.9686C192.801 48.7631 194.472 43.1085 194.473 37.4791C194.473 31.8497 192.803 26.1945 189.43 21.9877ZM182.196 47.4833C180.409 50.1702 177.762 51.9245 174.238 51.9103H174.234C170.71 51.9245 168.064 50.1702 166.277 47.4833C164.481 44.7816 163.564 41.1431 163.561 37.4762C163.559 33.8093 164.471 30.1718 166.266 27.4716C168.051 24.7867 170.699 23.0337 174.234 23.0503L174.239 23.0503C177.773 23.0337 180.422 24.7867 182.207 27.4716C184.002 30.1718 184.914 33.8093 184.911 37.4762C184.909 41.1431 183.992 44.7816 182.196 47.4833Z" fill="#8F74E0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1 @@
|
||||
<svg fill="#8F74E0" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Anthropic</title><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>
|
||||
|
After Width: | Height: | Size: 363 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="#8F74E0" d="M121.666 121.666H0V0h121.666z"/><path fill="#8F74E0" d="M256 121.666H134.335V0H256z"/><path fill="#8F74E0" d="M121.663 256.002H0V134.336h121.663z"/><path fill="#8F74E0" d="M256 256.002H134.335V134.336H256z"/></svg>
|
||||
|
After Width: | Height: | Size: 325 B |
@@ -0,0 +1 @@
|
||||
<svg fill="#8F74E0" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>AWS</title><path d="M6.763 11.212c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 01-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 01-.287-.375 6.18 6.18 0 01-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.39-.384-.59-.894-.59-1.533 0-.678.24-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.4 2.4 0 01-.28.104.488.488 0 01-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 01.224-.167 4.577 4.577 0 011.005-.36 4.84 4.84 0 011.246-.151c.95 0 1.644.216 2.091.647.44.43.662 1.085.662 1.963v2.586h.016zm-3.24 1.214c.263 0 .534-.048.822-.144a1.78 1.78 0 00.758-.51 1.27 1.27 0 00.272-.512c.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 00-.735-.136 6.02 6.02 0 00-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 6.726a1.398 1.398 0 01-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 01.32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 01.311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 01-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 01-.303.08h-.687c-.15 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32L12.32 7.747l-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08l-.686.001zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 01-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.32.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 00.415-.758.777.777 0 00-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 01-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .36.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 01.24.2.43.43 0 01.071.263v.375c0 .168-.064.256-.184.256a.83.83 0 01-.303-.096 3.652 3.652 0 00-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.16.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926a2.157 2.157 0 01-.583.703c-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z"></path><path d="M.378 15.475c3.384 1.963 7.56 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.44-.2.814.287.383.607-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351zm23.531-.2c.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151l.175-.439c.343-.88.802-2.198.52-2.555-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399z" fill="#8F74E0"></path></svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1 @@
|
||||
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Azure</title><path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#lobe-icons-azure-0-_R_0_)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#8F74E0"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#lobe-icons-azure-1-_R_0_)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#lobe-icons-azure-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-0-_R_0_" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#8F74E0"></stop><stop offset="1" stop-color="#8F74E0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-1-_R_0_" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-2-_R_0_" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#8F74E0"></stop><stop offset="1" stop-color="#8F74E0"></stop></linearGradient></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
||||
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Bedrock</title><defs><linearGradient id="lobe-icons-bedrock-_R_0_" x1="80%" x2="20%" y1="20%" y2="80%"><stop offset="0%" stop-color="#8F74E0"></stop><stop offset="50%" stop-color="#8F74E0"></stop><stop offset="100%" stop-color="#8F74E0"></stop></linearGradient></defs><path d="M13.05 15.513h3.08c.214 0 .389.177.389.394v1.82a1.704 1.704 0 011.296 1.661c0 .943-.755 1.708-1.685 1.708-.931 0-1.686-.765-1.686-1.708 0-.807.554-1.484 1.297-1.662v-1.425h-2.69v4.663a.395.395 0 01-.188.338l-2.69 1.641a.385.385 0 01-.405-.002l-4.926-3.086a.395.395 0 01-.185-.336V16.3L2.196 14.87A.395.395 0 012 14.555L2 14.528V9.406c0-.14.073-.27.192-.34l2.465-1.462V4.448c0-.129.062-.249.165-.322l.021-.014L9.77 1.058a.385.385 0 01.407 0l2.69 1.675a.395.395 0 01.185.336V7.6h3.856V5.683a1.704 1.704 0 01-1.296-1.662c0-.943.755-1.708 1.685-1.708.931 0 1.685.765 1.685 1.708 0 .807-.553 1.484-1.296 1.662v2.311a.391.391 0 01-.389.394h-4.245v1.806h6.624a1.69 1.69 0 011.64-1.313c.93 0 1.685.764 1.685 1.707 0 .943-.754 1.708-1.685 1.708a1.69 1.69 0 01-1.64-1.314H13.05v1.937h4.953l.915 1.18a1.66 1.66 0 01.84-.227c.931 0 1.685.764 1.685 1.707 0 .943-.754 1.708-1.685 1.708-.93 0-1.685-.765-1.685-1.708 0-.346.102-.668.276-.937l-.724-.935H13.05v1.806zM9.973 1.856L7.93 3.122V6.09h-.778V3.604L5.435 4.669v2.945l2.11 1.36L9.712 7.61V5.334h.778V7.83c0 .136-.07.263-.184.335L7.963 9.638v2.081l1.422 1.009-.446.646-1.406-.998-1.53 1.005-.423-.66 1.605-1.055v-1.99L5.038 8.29l-2.26 1.34v1.676l1.972-1.189.398.677-2.37 1.429V14.3l2.166 1.258 2.27-1.368.397.677-2.176 1.311V19.3l1.876 1.175 2.365-1.426.398.678-2.017 1.216 1.918 1.201 2.298-1.403v-5.78l-4.758 2.893-.4-.675 5.158-3.136V3.289L9.972 1.856zM16.13 18.47a.913.913 0 00-.908.92c0 .507.406.918.908.918a.913.913 0 00.907-.919.913.913 0 00-.907-.92zm3.63-3.81a.913.913 0 00-.908.92c0 .508.406.92.907.92a.913.913 0 00.908-.92.913.913 0 00-.908-.92zm1.555-4.99a.913.913 0 00-.908.92c0 .507.407.918.908.918a.913.913 0 00.907-.919.913.913 0 00-.907-.92zM17.296 3.1a.913.913 0 00-.907.92c0 .508.406.92.907.92a.913.913 0 00.908-.92.913.913 0 00-.908-.92z" fill="url(#lobe-icons-bedrock-_R_0_)" fill-rule="nonzero"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,19 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.06145 23.1079C5.26816 22.3769 -3.39077 20.6274 1.4173 5.06384C9.6344 6.09939 16.9728 14.0644 9.06145 23.1079Z" fill="url(#paint0_linear_17557_2021)"/>
|
||||
<path d="M8.91928 23.0939C5.27642 21.2223 0.78371 4.20891 17.0071 0C20.7569 7.19341 19.6212 16.5452 8.91928 23.0939Z" fill="url(#paint1_linear_17557_2021)"/>
|
||||
<path d="M8.91388 23.0788C8.73534 19.8817 10.1585 9.08525 23.5699 13.1107C23.1812 20.1229 18.984 26.4182 8.91388 23.0788Z" fill="url(#paint2_linear_17557_2021)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_17557_2021" x1="3.77557" y1="5.91571" x2="5.23185" y2="21.5589" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#8F74E0"/>
|
||||
<stop offset="1" stop-color="#8F74E0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_17557_2021" x1="12.1711" y1="-0.718425" x2="10.1897" y2="22.9832" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#8F74E0"/>
|
||||
<stop offset="1" stop-color="#8F74E0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_17557_2021" x1="23.1327" y1="15.353" x2="9.33841" y2="18.5196" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#8F74E0"/>
|
||||
<stop offset="1" stop-color="#8F74E0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |