The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
Refactoring from gemini to google ai (#3244)
Parshva Daftari89b67e08340e
diff --git a/docs/components/embedders/models/gemini.mdx b/docs/components/embedders/models/google_AI.mdxsimilarity index 83%rename from docs/components/embedders/models/gemini.mdxrename to docs/components/embedders/models/google_AI.mdxindex 90ee55536..7ce9024d3 100644--- a/docs/components/embedders/models/gemini.mdx+++ b/docs/components/embedders/models/google_AI.mdx@@ -1,8 +1,8 @@----title: Gemini+title: Google AI----To use Gemini embedding models, set the `GOOGLE_API_KEY` environment variables. You can obtain the Gemini API key from [here](https://aistudio.google.com/app/apikey).+To use Google AI embedding models, set the `GOOGLE_API_KEY` environment variables. You can obtain the Gemini API key from [here](https://aistudio.google.com/app/apikey).### Usage@@ -40,4 +40,4 @@ Here are the parameters available for configuring Gemini embedder:| --- | --- | --- || `model` | The name of the embedding model to use | `models/text-embedding-004` || `embedding_dims` | Dimensions of the embedding model (output_dimensionality will be considered as embedding_dims, so please set embedding_dims accordingly) | `768` |-| `api_key` | The Gemini API key | `None` |+| `api_key` | The Google API key | `None` |diff --git a/docs/components/embedders/overview.mdx b/docs/components/embedders/overview.mdxindex 6777bed2e..21afcfd08 100644--- a/docs/components/embedders/overview.mdx+++ b/docs/components/embedders/overview.mdx@@ -21,7 +21,7 @@ See the list of supported embedders below.<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="Gemini" href="/components/embedders/models/gemini"></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>diff --git a/docs/components/llms/models/gemini.mdx b/docs/components/llms/models/gemini.mdxdeleted file mode 100644index 182b25de6..000000000--- a/docs/components/llms/models/gemini.mdx+++ /dev/null@@ -1,76 +0,0 @@-----title: Gemini------<Snippet file="blank-notif.mdx" />--To use the Gemini model, set the `GEMINI_API_KEY` environment variable. You can obtain the Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey).--> **Note:** As of the latest release, Mem0 uses the new `google.genai` SDK instead of the deprecated `google.generativeai`. All message formatting and model interaction now use the updated `types` module from `google.genai`.--> **Note:** Some Gemini models are being deprecated and will retire soon. It is recommended to migrate to the latest stable models like `"gemini-2.0-flash-001"` or `"gemini-2.0-flash-lite-001"` to ensure ongoing support and improvements.--## Usage--<CodeGroup>-```python Python-import os-from mem0 import Memory--os.environ["OPENAI_API_KEY"] = "your-openai-api-key" # Used for embedding model-os.environ["GEMINI_API_KEY"] = "your-gemini-api-key"--config = {- "llm": {- "provider": "gemini",- "config": {- "model": "gemini-2.0-flash-001",- "temperature": 0.2,- "max_tokens": 2000,- "top_p": 1.0- }- }-}--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 thrillers, but I love sci-fi movies."},- {"role": "assistant", "content": "Got it! I'll avoid thrillers and suggest sci-fi movies instead."}-]--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--All available parameters for the `Gemini` config are present in [Master List of All Params in Config](../config).\ No newline at end of filediff --git a/docs/components/llms/models/google_AI.mdx b/docs/components/llms/models/google_AI.mdxindex f853e82f6..03ca7230c 100644--- a/docs/components/llms/models/google_AI.mdx+++ b/docs/components/llms/models/google_AI.mdx@@ -4,38 +4,73 @@ title: Google AI<Snippet file="blank-notif.mdx" />-To use Google AI model, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)+To use the Gemini model, set the `GOOGLE_API_KEY` environment variable. You can obtain the Google/Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey).++> **Note:** As of the latest release, Mem0 uses the new `google.genai` SDK instead of the deprecated `google.generativeai`. All message formatting and model interaction now use the updated `types` module from `google.genai`.++> **Note:** Some Gemini models are being deprecated and will retire soon. It is recommended to migrate to the latest stable models like `"gemini-2.0-flash-001"` or `"gemini-2.0-flash-lite-001"` to ensure ongoing support and improvements.## Usage-```python+<CodeGroup>+```python Pythonimport osfrom mem0 import Memory-os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model-os.environ["GEMINI_API_KEY"] = "your-api-key"+os.environ["OPENAI_API_KEY"] = "your-openai-api-key" # Used for embedding model+os.environ["GOOGLE_API_KEY"] = "your-gemini-api-key"config = {"llm": {- "provider": "litellm",+ "provider": "gemini","config": {- "model": "gemini/gemini-pro",+ "model": "gemini-2.0-flash-001","temperature": 0.2,"max_tokens": 2000,+ "top_p": 1.0}}}m = Memory.from_config(config)+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."}+ {"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."}]+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-All available parameters for the `litellm` config are present in [Master List of All Params in Config](../config).\ No newline at end of file+All available parameters for the `Gemini` config are present in [Master List of All Params in Config](../config).\ No newline at end of filediff --git a/docs/components/llms/overview.mdx b/docs/components/llms/overview.mdxindex 743b98b53..6f875f28f 100644--- a/docs/components/llms/overview.mdx+++ b/docs/components/llms/overview.mdx@@ -33,7 +33,6 @@ See the list of supported LLMs below.<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="Gemini" href="/components/llms/models/gemini" /><Card title="DeepSeek" href="/components/llms/models/deepseek" /><Card title="xAI" href="/components/llms/models/xAI" /><Card title="Sarvam AI" href="/components/llms/models/sarvam" />diff --git a/docs/components/vectordbs/dbs/vertex_ai.mdx b/docs/components/vectordbs/dbs/vertex_ai.mdxindex 80c868953..637b4d98f 100644--- a/docs/components/vectordbs/dbs/vertex_ai.mdx+++ b/docs/components/vectordbs/dbs/vertex_ai.mdx@@ -12,7 +12,7 @@ To use Google Cloud Vertex AI Vector Search with `mem0`, you need to configure timport osfrom mem0 import Memory-os.environ["GEMINI_API_KEY"] = = "sk-xx"+os.environ["GOOGLE_API_KEY"] = "sk-xx"config = {"vector_store": {diff --git a/docs/docs.json b/docs/docs.jsonindex 7ccb80db4..0b41e0b53 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -121,7 +121,6 @@"components/llms/models/mistral_AI","components/llms/models/google_AI","components/llms/models/aws_bedrock",- "components/llms/models/gemini","components/llms/models/deepseek","components/llms/models/xAI","components/llms/models/sarvam",@@ -177,7 +176,7 @@"components/embedders/models/ollama","components/embedders/models/huggingface","components/embedders/models/vertexai",- "components/embedders/models/gemini",+ "components/embedders/models/google_AI","components/embedders/models/lmstudio","components/embedders/models/together","components/embedders/models/langchain",diff --git a/docs/llms.txt b/docs/llms.txtindex 4770b3e95..2cadb8b8b 100644--- a/docs/llms.txt+++ b/docs/llms.txt@@ -84,7 +84,7 @@[OpenAI](https://docs.mem0.ai/components/llms/models/openai): Integrate OpenAI LLM models by setting OPENAI_API_KEY and configuring the Memory client with provider settings - supports both standard models (like gpt-4) and structured-outputs, with options for temperature, max tokens and Openrouter integration.[Anthropic](https://docs.mem0.ai/components/llms/models/anthropic): Integrate Anthropic LLM models by setting ANTHROPIC_API_KEY from your Account Settings Page and configuring the Memory client with provider settings - supports models like claude-3-7-sonnet-latest with customizable temperature and max_tokens parameters.-[Google AI](https://docs.mem0.ai/components/llms/models/google_AI): Integrate Gemini LLM models by setting GEMINI_API_KEY from Google Maker Suite and configuring the Memory client with litellm provider - supports models like gemini-pro with customizable temperature and max_tokens parameters.+[Google AI](https://docs.mem0.ai/components/llms/models/google_AI): Integrate Gemini LLM models by setting GOOGLE_API_KEY from Google Maker Suite and configuring the Memory client with litellm provider - supports models like gemini-pro with customizable temperature and max_tokens parameters.[Groq](https://docs.mem0.ai/components/llms/models/groq): Integrate Groq's Language Processing Unit (LPU) optimized models by setting GROQ_API_KEY and configuring the Memory client with provider settings - supports models like mixtral-8x7b-32768 with customizable temperature and max_tokens parameters for high-performance AI inference.[Together](https://docs.mem0.ai/components/llms/models/together): Integrate Together LLM models by setting TOGETHER_API_KEY and configuring the Memory client with provider settings - supports both standard models (like together-llama-3-8b-instant) and structured-outputs, with options for temperature, max tokens and Openrouter integration.[Deepseek](https://docs.mem0.ai/components/llms/models/deepseek): Integrate Deepseek LLM models by setting DEEPSEEK_API_KEY and configuring the Memory client with provider settings - supports both standard models (like deepseek-chat) and structured-outputs, with options for temperature, max tokens and Openrouter integration.