Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Doc: Update examples in LLMs, VectorDBs and Embedding models pages (#2288)

Dev Khant2556c5fe882f
diff --git a/docs/components/embedders/models/azure_openai.mdx b/docs/components/embedders/models/azure_openai.mdx
index 9848562b8..2a6809589 100644
--- a/docs/components/embedders/models/azure_openai.mdx
+++ b/docs/components/embedders/models/azure_openai.mdx
@@ -37,7 +37,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
### Config
diff --git a/docs/components/embedders/models/gemini.mdx b/docs/components/embedders/models/gemini.mdx
index 40e5cad33..077f9ca58 100644
--- a/docs/components/embedders/models/gemini.mdx
+++ b/docs/components/embedders/models/gemini.mdx
@@ -23,7 +23,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
### Config
diff --git a/docs/components/embedders/models/huggingface.mdx b/docs/components/embedders/models/huggingface.mdx
index 4b8d8c7e5..b8b00835e 100644
--- a/docs/components/embedders/models/huggingface.mdx
+++ b/docs/components/embedders/models/huggingface.mdx
@@ -22,7 +22,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
### Config
diff --git a/docs/components/embedders/models/ollama.mdx b/docs/components/embedders/models/ollama.mdx
index 263d82276..d2829a8ee 100644
--- a/docs/components/embedders/models/ollama.mdx
+++ b/docs/components/embedders/models/ollama.mdx
@@ -18,7 +18,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
### Config
diff --git a/docs/components/embedders/models/openai.mdx b/docs/components/embedders/models/openai.mdx
index 47a0e611b..68be78a97 100644
--- a/docs/components/embedders/models/openai.mdx
+++ b/docs/components/embedders/models/openai.mdx
@@ -23,7 +23,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
```typescript TypeScript
diff --git a/docs/components/embedders/models/together.mdx b/docs/components/embedders/models/together.mdx
index 160e47464..9f1695c3c 100644
--- a/docs/components/embedders/models/together.mdx
+++ b/docs/components/embedders/models/together.mdx
@@ -25,7 +25,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
### Config
diff --git a/docs/components/embedders/models/vertexai.mdx b/docs/components/embedders/models/vertexai.mdx
index f2a0a896f..88cc08a3e 100644
--- a/docs/components/embedders/models/vertexai.mdx
+++ b/docs/components/embedders/models/vertexai.mdx
@@ -25,7 +25,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("I'm visiting Paris", user_id="john")
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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="john")
```
The embedding types can be one of the following:
- SEMANTIC_SIMILARITY
diff --git a/docs/components/llms/models/anthropic.mdx b/docs/components/llms/models/anthropic.mdx
index abfdbbd53..84ed10113 100644
--- a/docs/components/llms/models/anthropic.mdx
+++ b/docs/components/llms/models/anthropic.mdx
@@ -26,7 +26,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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
@@ -45,7 +51,13 @@ const config = {
};
const memory = new Memory(config);
-await memory.add("Likes to play cricket on weekends", { userId: "alice", metadata: { category: "hobbies" } });
+const messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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>
diff --git a/docs/components/llms/models/aws_bedrock.mdx b/docs/components/llms/models/aws_bedrock.mdx
index 7578524a5..bd04d99ba 100644
--- a/docs/components/llms/models/aws_bedrock.mdx
+++ b/docs/components/llms/models/aws_bedrock.mdx
@@ -30,7 +30,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/llms/models/azure_openai.mdx b/docs/components/llms/models/azure_openai.mdx
index ea32b6730..bacb82980 100644
--- a/docs/components/llms/models/azure_openai.mdx
+++ b/docs/components/llms/models/azure_openai.mdx
@@ -36,7 +36,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
We also support the new [OpenAI structured-outputs](https://platform.openai.com/docs/guides/structured-outputs/introduction) model.
diff --git a/docs/components/llms/models/deepseek.mdx b/docs/components/llms/models/deepseek.mdx
index 77f226ab7..af1783a1c 100644
--- a/docs/components/llms/models/deepseek.mdx
+++ b/docs/components/llms/models/deepseek.mdx
@@ -26,7 +26,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
You can also configure the API base URL in the config:
diff --git a/docs/components/llms/models/gemini.mdx b/docs/components/llms/models/gemini.mdx
index a40c26503..4c166ea42 100644
--- a/docs/components/llms/models/gemini.mdx
+++ b/docs/components/llms/models/gemini.mdx
@@ -25,7 +25,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/google_AI.mdx b/docs/components/llms/models/google_AI.mdx
index b1c22b1e4..4e08ea744 100644
--- a/docs/components/llms/models/google_AI.mdx
+++ b/docs/components/llms/models/google_AI.mdx
@@ -25,7 +25,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/groq.mdx b/docs/components/llms/models/groq.mdx
index 5f9ab8661..d8f0727ce 100644
--- a/docs/components/llms/models/groq.mdx
+++ b/docs/components/llms/models/groq.mdx
@@ -28,7 +28,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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
@@ -47,7 +53,13 @@ const config = {
};
const memory = new Memory(config);
-await memory.add("Likes to play cricket on weekends", { userId: "alice", metadata: { category: "hobbies" } });
+const messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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>
diff --git a/docs/components/llms/models/litellm.mdx b/docs/components/llms/models/litellm.mdx
index 00b5afb06..d66669f86 100644
--- a/docs/components/llms/models/litellm.mdx
+++ b/docs/components/llms/models/litellm.mdx
@@ -20,7 +20,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/mistral_AI.mdx b/docs/components/llms/models/mistral_AI.mdx
index 3cd7449c5..fdecd625a 100644
--- a/docs/components/llms/models/mistral_AI.mdx
+++ b/docs/components/llms/models/mistral_AI.mdx
@@ -25,7 +25,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/ollama.mdx b/docs/components/llms/models/ollama.mdx
index eac73685a..757fd2cc0 100644
--- a/docs/components/llms/models/ollama.mdx
+++ b/docs/components/llms/models/ollama.mdx
@@ -20,7 +20,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/openai.mdx b/docs/components/llms/models/openai.mdx
index c1e075043..337151eb8 100644
--- a/docs/components/llms/models/openai.mdx
+++ b/docs/components/llms/models/openai.mdx
@@ -36,7 +36,13 @@ config = {
# }
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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
@@ -55,7 +61,13 @@ const config = {
};
const memory = new Memory(config);
-await memory.add("Likes to play cricket on weekends", { userId: "alice", metadata: { category: "hobbies" } });
+const messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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>
diff --git a/docs/components/llms/models/together.mdx b/docs/components/llms/models/together.mdx
index dd685a29f..63182918e 100644
--- a/docs/components/llms/models/together.mdx
+++ b/docs/components/llms/models/together.mdx
@@ -21,7 +21,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/llms/models/xAI.mdx b/docs/components/llms/models/xAI.mdx
index d7a365f5f..0d2ec1c90 100644
--- a/docs/components/llms/models/xAI.mdx
+++ b/docs/components/llms/models/xAI.mdx
@@ -27,7 +27,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
## Config
diff --git a/docs/components/vectordbs/dbs/azure_ai_search.mdx b/docs/components/vectordbs/dbs/azure_ai_search.mdx
index 5bb2a9526..b109759c5 100644
--- a/docs/components/vectordbs/dbs/azure_ai_search.mdx
+++ b/docs/components/vectordbs/dbs/azure_ai_search.mdx
@@ -22,7 +22,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/chroma.mdx b/docs/components/vectordbs/dbs/chroma.mdx
index a5fd527e5..ed798ebbe 100644
--- a/docs/components/vectordbs/dbs/chroma.mdx
+++ b/docs/components/vectordbs/dbs/chroma.mdx
@@ -19,7 +19,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/elasticsearch.mdx b/docs/components/vectordbs/dbs/elasticsearch.mdx
index fa33a9297..e3f19e5d2 100644
--- a/docs/components/vectordbs/dbs/elasticsearch.mdx
+++ b/docs/components/vectordbs/dbs/elasticsearch.mdx
@@ -29,7 +29,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/milvus.mdx b/docs/components/vectordbs/dbs/milvus.mdx
index 12193f462..4e93ba0ab 100644
--- a/docs/components/vectordbs/dbs/milvus.mdx
+++ b/docs/components/vectordbs/dbs/milvus.mdx
@@ -19,7 +19,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/opensearch.mdx b/docs/components/vectordbs/dbs/opensearch.mdx
index 507d08615..e5d8f7de2 100644
--- a/docs/components/vectordbs/dbs/opensearch.mdx
+++ b/docs/components/vectordbs/dbs/opensearch.mdx
@@ -29,7 +29,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/pgvector.mdx b/docs/components/vectordbs/dbs/pgvector.mdx
index 412271df3..011a3f982 100644
--- a/docs/components/vectordbs/dbs/pgvector.mdx
+++ b/docs/components/vectordbs/dbs/pgvector.mdx
@@ -21,7 +21,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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"})
```
### Config
diff --git a/docs/components/vectordbs/dbs/qdrant.mdx b/docs/components/vectordbs/dbs/qdrant.mdx
index 1c6f00763..1fe21c678 100644
--- a/docs/components/vectordbs/dbs/qdrant.mdx
+++ b/docs/components/vectordbs/dbs/qdrant.mdx
@@ -21,7 +21,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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
@@ -40,7 +46,13 @@ const config = {
};
const memory = new Memory(config);
-await memory.add("Likes to play cricket on weekends", { userId: "alice", metadata: { category: "hobbies" } });
+const messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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>
diff --git a/docs/components/vectordbs/dbs/redis.mdx b/docs/components/vectordbs/dbs/redis.mdx
index 039a1aff8..3e1b7cc96 100644
--- a/docs/components/vectordbs/dbs/redis.mdx
+++ b/docs/components/vectordbs/dbs/redis.mdx
@@ -32,7 +32,13 @@ config = {
}
m = Memory.from_config(config)
-m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
+messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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
@@ -52,7 +58,13 @@ const config = {
};
const memory = new Memory(config);
-await memory.add("Likes to play cricket on weekends", { userId: "alice", metadata: { category: "hobbies" } });
+const messages = [
+ {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
+ {"role": "assistant", "content": "How about a 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>