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.

feat: Add Gemini support to TypeScript SDK (#3093)

Saket Aryan5b0f1a7cf897
diff --git a/docs/changelog.mdx b/docs/changelog.mdx
index 70cd6d542..8bd1093ca 100644
--- a/docs/changelog.mdx
+++ b/docs/changelog.mdx
@@ -409,6 +409,11 @@ mode: "wide"
<Tab title="TypeScript">
+<Update label="2025-07-03" description="v2.1.34">
+**New Features:**
+- **OSS:** Added Gemini support
+</Update>
+
<Update label="2025-06-24" description="v2.1.33">
**Improvement :**
- **Client:** Added `immutable` param to `add` method.
diff --git a/docs/components/llms/models/gemini.mdx b/docs/components/llms/models/gemini.mdx
index fe45187d1..91fe9383a 100644
--- a/docs/components/llms/models/gemini.mdx
+++ b/docs/components/llms/models/gemini.mdx
@@ -12,7 +12,8 @@ To use the Gemini model, set the `GEMINI_API_KEY` environment variable. You can
## Usage
-```python
+<CodeGroup>
+```python Python
import os
from mem0 import Memory
@@ -43,6 +44,32 @@ messages = [
m.add(messages, user_id="alice", metadata={"category": "movies"})
```
+```typescript TypeScript
+import { Memory } from "mem0ai/oss";
+
+const config = {
+ llm: {
+ // You can also use "google" as provider ( for backward compatibility )
+ provider: "gemini",
+ config: {
+ model: "gemini-2.0-flash-001",
+ temperature: 0.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 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>
## Config
diff --git a/mem0-ts/package.json b/mem0-ts/package.json
index ade32f79e..93a096d00 100644
--- a/mem0-ts/package.json
+++ b/mem0-ts/package.json
@@ -1,6 +1,6 @@
{
"name": "mem0ai",
- "version": "2.1.33",
+ "version": "2.1.34",
"description": "The Memory Layer For Your AI Apps",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/mem0-ts/src/oss/src/utils/factory.ts b/mem0-ts/src/oss/src/utils/factory.ts
index 8556f0575..2ce151bee 100644
--- a/mem0-ts/src/oss/src/utils/factory.ts
+++ b/mem0-ts/src/oss/src/utils/factory.ts
@@ -40,6 +40,7 @@ export class EmbedderFactory {
case "ollama":
return new OllamaEmbedder(config);
case "google":
+ case "gemini":
return new GoogleEmbedder(config);
case "azure_openai":
return new AzureOpenAIEmbedder(config);
@@ -65,6 +66,7 @@ export class LLMFactory {
case "ollama":
return new OllamaLLM(config);
case "google":
+ case "gemini":
return new GoogleLLM(config);
case "azure_openai":
return new AzureOpenAILLM(config);
diff --git a/mem0-ts/src/oss/src/utils/telemetry.ts b/mem0-ts/src/oss/src/utils/telemetry.ts
index 2facbdd64..a2c20e75b 100644
--- a/mem0-ts/src/oss/src/utils/telemetry.ts
+++ b/mem0-ts/src/oss/src/utils/telemetry.ts
@@ -4,7 +4,7 @@ import type {
TelemetryEventData,
} from "./telemetry.types";
-let version = "2.1.26";
+let version = "2.1.34";
// Safely check for process.env in different environments
let MEM0_TELEMETRY = true;