From 41cfb3ab1aa9c551bc22077d308d0d48011db080 Mon Sep 17 00:00:00 2001 From: Parshva Daftari <89991302+parshvadaftari@users.noreply.github.com> Date: Wed, 15 Oct 2025 23:49:52 +0530 Subject: [PATCH] [Update] Default LLM (#3587) --- LLM.md | 6 ++--- README.md | 4 ++-- docs/components/llms/models/langchain.mdx | 2 +- docs/components/llms/models/litellm.mdx | 2 +- docs/components/llms/models/openai.mdx | 4 ++-- docs/examples/ai_companion_js.mdx | 2 +- docs/examples/collaborative-task-agent.mdx | 2 +- docs/examples/eliza_os.mdx | 2 +- docs/examples/llama-index-mem0.mdx | 2 +- .../llamaindex-multiagent-learning-system.mdx | 2 +- docs/examples/mem0-mastra.mdx | 2 +- docs/examples/mem0-openai-voice-demo.mdx | 6 ++--- .../memory-guided-content-writing.mdx | 2 +- docs/examples/openai-inbuilt-tools.mdx | 6 ++--- docs/examples/personal-ai-tutor.mdx | 2 +- docs/examples/personal-travel-assistant.mdx | 8 +++---- docs/integrations/agentops.mdx | 2 +- docs/integrations/agno.mdx | 2 +- docs/integrations/keywords.mdx | 4 ++-- docs/integrations/langchain.mdx | 2 +- docs/integrations/livekit.mdx | 2 +- docs/integrations/llama-index.mdx | 4 ++-- docs/integrations/mastra.mdx | 2 +- docs/integrations/openai-agents-sdk.mdx | 8 +++---- docs/open-source/features/async-memory.mdx | 4 ++-- .../custom-fact-extraction-prompt.mdx | 2 +- .../features/openai_compatibility.mdx | 6 ++--- docs/open-source/graph_memory/overview.mdx | 16 +++++++------- docs/open-source/python-quickstart.mdx | 2 +- docs/v0x/components/llms/models/langchain.mdx | 2 +- docs/v0x/components/llms/models/litellm.mdx | 2 +- docs/v0x/components/llms/models/openai.mdx | 4 ++-- docs/v0x/examples/ai_companion_js.mdx | 2 +- .../v0x/examples/collaborative-task-agent.mdx | 2 +- docs/v0x/examples/eliza_os.mdx | 2 +- docs/v0x/examples/llama-index-mem0.mdx | 2 +- .../llamaindex-multiagent-learning-system.mdx | 2 +- docs/v0x/examples/mem0-mastra.mdx | 2 +- docs/v0x/examples/mem0-openai-voice-demo.mdx | 6 ++--- .../memory-guided-content-writing.mdx | 2 +- docs/v0x/examples/openai-inbuilt-tools.mdx | 6 ++--- docs/v0x/examples/personal-ai-tutor.mdx | 2 +- .../examples/personal-travel-assistant.mdx | 8 +++---- docs/v0x/integrations/agentops.mdx | 2 +- docs/v0x/integrations/agno.mdx | 2 +- docs/v0x/integrations/keywords.mdx | 4 ++-- docs/v0x/integrations/langchain.mdx | 2 +- docs/v0x/integrations/livekit.mdx | 2 +- docs/v0x/integrations/llama-index.mdx | 4 ++-- docs/v0x/integrations/mastra.mdx | 2 +- docs/v0x/integrations/openai-agents-sdk.mdx | 8 +++---- docs/v0x/open-source/python-quickstart.mdx | 2 +- examples/graph-db-demo/kuzu-example.ipynb | 4 ++-- .../misc/diet_assistant_voice_cartesia.py | 2 +- examples/misc/fitness_checker.py | 4 ++-- examples/misc/multillm_memory.py | 4 ++-- examples/misc/personal_assistant_agno.py | 2 +- examples/misc/personalized_search.py | 2 +- examples/misc/test.py | 6 ++--- .../multiagents/llamaindex_learning_system.py | 2 +- examples/multimodal-demo/src/hooks/useChat.ts | 2 +- examples/multimodal-demo/useChat.ts | 2 +- mem0-ts/src/oss/src/llms/openai.ts | 2 +- mem0/configs/llms/base.py | 2 +- mem0/llms/azure_openai.py | 2 +- mem0/llms/azure_openai_structured.py | 2 +- mem0/llms/litellm.py | 2 +- mem0/llms/openai.py | 2 +- server/main.py | 2 +- tests/llms/test_azure_openai.py | 6 ++--- tests/llms/test_azure_openai_structured.py | 4 ++-- tests/llms/test_litellm.py | 8 +++---- tests/llms/test_openai.py | 22 +++++++++---------- tests/test_proxy.py | 6 ++--- 74 files changed, 136 insertions(+), 136 deletions(-) diff --git a/LLM.md b/LLM.md index baa0db241..69c08cccc 100644 --- a/LLM.md +++ b/LLM.md @@ -103,7 +103,7 @@ memory = Memory() # With custom configuration config = MemoryConfig( vector_store={"provider": "qdrant", "config": {"host": "localhost"}}, - llm={"provider": "openai", "config": {"model": "gpt-4o-mini"}}, + llm={"provider": "openai", "config": {"model": "gpt-4.1-nano-2025-04-14"}}, embedder={"provider": "openai", "config": {"model": "text-embedding-3-small"}} ) memory = Memory(config) @@ -339,7 +339,7 @@ config = MemoryConfig( llm={ "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.1, "max_tokens": 1000 } @@ -527,7 +527,7 @@ const memory = new Memory({ }, llm: { provider: 'openai', - config: { model: 'gpt-4o-mini' } + config: { model: 'gpt-4.1-nano' } } }); diff --git a/README.md b/README.md index 0149738ec..421c1f6dc 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ npm install mem0ai ### Basic Usage -Mem0 requires an LLM to function, with `gpt-4o-mini` from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our [Supported LLMs documentation](https://docs.mem0.ai/components/llms/overview). +Mem0 requires an LLM to function, with `gpt-4.1-nano-2025-04-14 from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our [Supported LLMs documentation](https://docs.mem0.ai/components/llms/overview). First step is to instantiate the memory: @@ -114,7 +114,7 @@ def chat_with_memories(message: str, user_id: str = "default_user") -> str: # Generate Assistant response system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}" messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}] - response = openai_client.chat.completions.create(model="gpt-4o-mini", messages=messages) + response = openai_client.chat.completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages) assistant_response = response.choices[0].message.content # Create new memories from the conversation diff --git a/docs/components/llms/models/langchain.mdx b/docs/components/llms/models/langchain.mdx index 4de3ba58e..a440f61a3 100644 --- a/docs/components/llms/models/langchain.mdx +++ b/docs/components/llms/models/langchain.mdx @@ -20,7 +20,7 @@ os.environ["OPENAI_API_KEY"] = "your-api-key" # Initialize a LangChain model directly openai_model = ChatOpenAI( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", temperature=0.2, max_tokens=2000 ) diff --git a/docs/components/llms/models/litellm.mdx b/docs/components/llms/models/litellm.mdx index cd3061a3d..f2a041c68 100644 --- a/docs/components/llms/models/litellm.mdx +++ b/docs/components/llms/models/litellm.mdx @@ -12,7 +12,7 @@ config = { "llm": { "provider": "litellm", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } diff --git a/docs/components/llms/models/openai.mdx b/docs/components/llms/models/openai.mdx index 50fa707f4..4a2468d6d 100644 --- a/docs/components/llms/models/openai.mdx +++ b/docs/components/llms/models/openai.mdx @@ -19,7 +19,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } @@ -85,7 +85,7 @@ config = { "llm": { "provider": "openai_structured", "config": { - "model": "gpt-4o-2024-08-06", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.0, } } diff --git a/docs/examples/ai_companion_js.mdx b/docs/examples/ai_companion_js.mdx index ca820df7d..8222ecfa5 100644 --- a/docs/examples/ai_companion_js.mdx +++ b/docs/examples/ai_companion_js.mdx @@ -45,7 +45,7 @@ ${memoriesStr}`; ]; const response = await openaiClient.chat.completions.create({ - model: "gpt-4o-mini", + model: "gpt-4.1-nano-2025-04-14", messages: messages }); diff --git a/docs/examples/collaborative-task-agent.mdx b/docs/examples/collaborative-task-agent.mdx index c46e8881f..1b18f32d2 100644 --- a/docs/examples/collaborative-task-agent.mdx +++ b/docs/examples/collaborative-task-agent.mdx @@ -51,7 +51,7 @@ class CollaborativeAgent: {"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"} ] reply = client.chat.completions.create( - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", messages=messages ).choices[0].message.content.strip() self.add_message("assistant", "assistant", reply) diff --git a/docs/examples/eliza_os.mdx b/docs/examples/eliza_os.mdx index 498ea9ad7..b60c9e745 100644 --- a/docs/examples/eliza_os.mdx +++ b/docs/examples/eliza_os.mdx @@ -44,7 +44,7 @@ MEM0_API_KEY= # Mem0 API Key (get from https://app.mem0.ai/dashboard/api-keys) MEM0_USER_ID= # Default: eliza-os-user MEM0_PROVIDER= # Default: openai MEM0_PROVIDER_API_KEY= # API Key for the provider (OpenAI, Anthropic, etc.) -SMALL_MEM0_MODEL= # Default: gpt-4o-mini +SMALL_MEM0_MODEL= # Default: gpt-4.1-nano MEDIUM_MEM0_MODEL= # Default: gpt-4o LARGE_MEM0_MODEL= # Default: gpt-4o ``` diff --git a/docs/examples/llama-index-mem0.mdx b/docs/examples/llama-index-mem0.mdx index fcdc078a0..d2621197c 100644 --- a/docs/examples/llama-index-mem0.mdx +++ b/docs/examples/llama-index-mem0.mdx @@ -20,7 +20,7 @@ import os from llama_index.llms.openai import OpenAI os.environ["OPENAI_API_KEY"] = "" -llm = OpenAI(model="gpt-4o") +llm = OpenAI(model="gpt-4.1-nano-2025-04-14") ``` Initialize the Mem0 client. You can find your API key [here](https://app.mem0.ai/dashboard/api-keys). Read about Mem0 [Open Source](https://docs.mem0.ai/open-source/overview). diff --git a/docs/examples/llamaindex-multiagent-learning-system.mdx b/docs/examples/llamaindex-multiagent-learning-system.mdx index 146fddd98..b7c95d740 100644 --- a/docs/examples/llamaindex-multiagent-learning-system.mdx +++ b/docs/examples/llamaindex-multiagent-learning-system.mdx @@ -81,7 +81,7 @@ class MultiAgentLearningSystem: def __init__(self, student_id: str): self.student_id = student_id - self.llm = OpenAI(model="gpt-4o", temperature=0.2) + self.llm = OpenAI(model="gpt-4.1-nano-2025-04-14", temperature=0.2) # Memory context for this student self.memory_context = {"user_id": student_id, "app": "learning_assistant"} diff --git a/docs/examples/mem0-mastra.mdx b/docs/examples/mem0-mastra.mdx index 181a414ed..950897fec 100644 --- a/docs/examples/mem0-mastra.mdx +++ b/docs/examples/mem0-mastra.mdx @@ -97,7 +97,7 @@ export const mem0Agent = new Agent({ instructions: ` You are a helpful assistant that has the ability to memorize and remember facts using Mem0. `, - model: openai('gpt-4o'), + model: openai('gpt-4.1-nano'), tools: { mem0RememberTool, mem0MemorizeTool }, }); ``` diff --git a/docs/examples/mem0-openai-voice-demo.mdx b/docs/examples/mem0-openai-voice-demo.mdx index 1a9e97771..73d0000d7 100644 --- a/docs/examples/mem0-openai-voice-demo.mdx +++ b/docs/examples/mem0-openai-voice-demo.mdx @@ -162,7 +162,7 @@ def create_memory_voice_agent(): Use the search_memories tool when you need context from past conversations or user asks you to recall something. """, ), - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) @@ -171,7 +171,7 @@ def create_memory_voice_agent(): This function: - Creates an OpenAI Agent with specific instructions -- Configures it to use gpt-4o (you can use other models) +- Configures it to use gpt-4.1-nano (you can use other models) - Registers the memory-related tools with the agent - Uses `prompt_with_handoff_instructions` to include standard voice agent behaviors @@ -369,7 +369,7 @@ def create_memory_voice_agent(): Use the search_memories tool when you need context from past conversations or user asks you to recall something. """, ), - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) diff --git a/docs/examples/memory-guided-content-writing.mdx b/docs/examples/memory-guided-content-writing.mdx index 2986cb37c..d5b7ff08e 100644 --- a/docs/examples/memory-guided-content-writing.mdx +++ b/docs/examples/memory-guided-content-writing.mdx @@ -103,7 +103,7 @@ Preferences: ] response = openai.chat.completions.create( - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", messages=messages ) clean_response = response.choices[0].message.content.strip() diff --git a/docs/examples/openai-inbuilt-tools.mdx b/docs/examples/openai-inbuilt-tools.mdx index edecca381..e0bcdeec3 100644 --- a/docs/examples/openai-inbuilt-tools.mdx +++ b/docs/examples/openai-inbuilt-tools.mdx @@ -119,7 +119,7 @@ const carRecommendationTool = zodResponsesFunction({ // Use the tool in your OpenAI request const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, carRecommendationTool], input: `${getMemoryString(relevantMemories)}\n${userInput}`, }); @@ -131,7 +131,7 @@ Combine memory with web search for up-to-date recommendations: ```javascript const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, carRecommendationTool], input: `${getMemoryString(relevantMemories)}\n${userInput}`, }); @@ -202,7 +202,7 @@ async function main(memory = false) { } const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, tool], input: `${getMemoryString(relevantMemories)}\n${input}`, }); diff --git a/docs/examples/personal-ai-tutor.mdx b/docs/examples/personal-ai-tutor.mdx index f432137fb..4e0663bec 100644 --- a/docs/examples/personal-ai-tutor.mdx +++ b/docs/examples/personal-ai-tutor.mdx @@ -58,7 +58,7 @@ class PersonalAITutor: """ # Start a streaming response request to the AI response = self.client.responses.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", instructions="You are a personal AI Tutor.", input=question, stream=True diff --git a/docs/examples/personal-travel-assistant.mdx b/docs/examples/personal-travel-assistant.mdx index 81fb753db..640538be9 100644 --- a/docs/examples/personal-travel-assistant.mdx +++ b/docs/examples/personal-travel-assistant.mdx @@ -35,7 +35,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.1, "max_tokens": 2000, } @@ -76,7 +76,7 @@ class PersonalTravelAssistant: # Generate response using Responses API response = self.client.responses.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", input=prompt ) @@ -140,9 +140,9 @@ class PersonalTravelAssistant: prompt = f"User input: {question}\n Previous memories: {previous_memories}" self.messages.append({"role": "user", "content": prompt}) - # Generate response using GPT-4o + # Generate response using gpt-4.1-nano response = self.client.chat.completions.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14"2025-04-14", messages=self.messages ) answer = response.choices[0].message.content diff --git a/docs/integrations/agentops.mdx b/docs/integrations/agentops.mdx index 3791423f7..cd89aa839 100644 --- a/docs/integrations/agentops.mdx +++ b/docs/integrations/agentops.mdx @@ -49,7 +49,7 @@ local_config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.1, "max_tokens": 2000, }, diff --git a/docs/integrations/agno.mdx b/docs/integrations/agno.mdx index 8cd91bd8a..aa71e9f43 100644 --- a/docs/integrations/agno.mdx +++ b/docs/integrations/agno.mdx @@ -36,7 +36,7 @@ from agno.tools.mem0 import Mem0Tools agent = Agent( name="Memory Agent", - model=OpenAIChat(id="gpt-4o-mini"), + model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"), tools=[Mem0Tools()], description="An assistant that remembers and personalizes using Mem0 memory." ) diff --git a/docs/integrations/keywords.mdx b/docs/integrations/keywords.mdx index c9783ef02..d5c681761 100644 --- a/docs/integrations/keywords.mdx +++ b/docs/integrations/keywords.mdx @@ -55,7 +55,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.0, "api_key": keywordsai_api_key, "openai_base_url": base_url, @@ -101,7 +101,7 @@ messages = [ # Add memory and generate a response response = client.chat.completions.create( - model="openai/gpt-4o", + model="openai/gpt-4.1-nano", messages=messages, extra_body={ "mem0_params": { diff --git a/docs/integrations/langchain.mdx b/docs/integrations/langchain.mdx index 23da9c220..5d89494b3 100644 --- a/docs/integrations/langchain.mdx +++ b/docs/integrations/langchain.mdx @@ -39,7 +39,7 @@ load_dotenv() # os.environ["MEM0_API_KEY"] = "your-mem0-api-key" # Initialize LangChain and Mem0 -llm = ChatOpenAI(model="gpt-4o-mini") +llm = ChatOpenAI(model="gpt-4.1-nano-2025-04-14") mem0 = MemoryClient() ``` diff --git a/docs/integrations/livekit.mdx b/docs/integrations/livekit.mdx index 2e5961585..3b77b7209 100644 --- a/docs/integrations/livekit.mdx +++ b/docs/integrations/livekit.mdx @@ -147,7 +147,7 @@ async def entrypoint(ctx: JobContext): session = AgentSession( stt=deepgram.STT(), - llm=openai.LLM(model="gpt-4o-mini"), + llm=openai.LLM(model="gpt-4.1-nano-2025-04-14"), tts=openai.TTS(voice="ash",), turn_detection=EnglishModel(), vad=silero.VAD.load(), diff --git a/docs/integrations/llama-index.mdx b/docs/integrations/llama-index.mdx index ec20a3b83..7d6e3142a 100644 --- a/docs/integrations/llama-index.mdx +++ b/docs/integrations/llama-index.mdx @@ -83,7 +83,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, }, @@ -116,7 +116,7 @@ from dotenv import load_dotenv load_dotenv() # os.environ["OPENAI_API_KEY"] = "" -llm = OpenAI(model="gpt-4o-mini") +llm = OpenAI(model="gpt-4.1-nano-2025-04-14") ``` ### SimpleChatEngine diff --git a/docs/integrations/mastra.mdx b/docs/integrations/mastra.mdx index bcb480088..bf36eb3ba 100644 --- a/docs/integrations/mastra.mdx +++ b/docs/integrations/mastra.mdx @@ -106,7 +106,7 @@ const mem0Agent = new Agent({ Use the Mem0-memorize tool to save important information that might be useful later. Use the Mem0-remember tool to recall previously saved information when answering questions. `, - model: openai('gpt-4o'), + model: openai('gpt-4.1-nano'), tools: { mem0RememberTool, mem0MemorizeTool }, }); ``` diff --git a/docs/integrations/openai-agents-sdk.mdx b/docs/integrations/openai-agents-sdk.mdx index 0bfa129c0..81cf3889b 100644 --- a/docs/integrations/openai-agents-sdk.mdx +++ b/docs/integrations/openai-agents-sdk.mdx @@ -63,7 +63,7 @@ agent = Agent( Use the save_memory tool to store important information about the user. Always personalize your responses based on available memory.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) def chat_with_agent(user_input: str, user_id: str) -> str: @@ -114,7 +114,7 @@ travel_agent = Agent( understand the user's travel preferences and history before making recommendations. After providing your response, use store_conversation to save important details.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) health_agent = Agent( @@ -123,7 +123,7 @@ health_agent = Agent( understand the user's health goals and dietary preferences. After providing advice, use store_conversation to save relevant information.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) # Triage agent with handoffs @@ -134,7 +134,7 @@ triage_agent = Agent( For health-related questions (fitness, diet, wellness, exercise), hand off to the Health Advisor. For general questions, handle them directly using available tools.""", handoffs=[travel_agent, health_agent], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) def chat_with_handoffs(user_input: str, user_id: str) -> str: diff --git a/docs/open-source/features/async-memory.mdx b/docs/open-source/features/async-memory.mdx index 2534413d9..59b9f12a7 100644 --- a/docs/open-source/features/async-memory.mdx +++ b/docs/open-source/features/async-memory.mdx @@ -202,7 +202,7 @@ async def chat_with_memories(message: str, user_id: str = "default_user") -> str # Generate assistant response system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}" messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}] - response = await async_openai_client.chat.completions.create(model="gpt-4o-mini", messages=messages) + response = await async_openai_client.chat.completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages) assistant_response = response.choices[0].message.content # Create new memories from the conversation @@ -249,7 +249,7 @@ async def handle_initialization_errors(): # Initialize with custom config config = MemoryConfig( vector_store={"provider": "chroma", "config": {"path": "./chroma_db"}}, - llm={"provider": "openai", "config": {"model": "gpt-4o-mini"}} + llm={"provider": "openai", "config": {"model": "gpt-4.1-nano-2025-04-14"}} ) memory = AsyncMemory(config=config) print("AsyncMemory initialized successfully") diff --git a/docs/open-source/features/custom-fact-extraction-prompt.mdx b/docs/open-source/features/custom-fact-extraction-prompt.mdx index 8c3bd75f5..e9ebb6036 100644 --- a/docs/open-source/features/custom-fact-extraction-prompt.mdx +++ b/docs/open-source/features/custom-fact-extraction-prompt.mdx @@ -76,7 +76,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } diff --git a/docs/open-source/features/openai_compatibility.mdx b/docs/open-source/features/openai_compatibility.mdx index ccb758e8f..d8cc45b39 100644 --- a/docs/open-source/features/openai_compatibility.mdx +++ b/docs/open-source/features/openai_compatibility.mdx @@ -27,7 +27,7 @@ messages = [ user_id = "alice" chat_completion = client.chat.completions.create( messages=messages, - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", user_id=user_id ) # Memory saved after this will look like: "Loves Indian food. Allergic to cheese and cannot eat pizza." @@ -42,7 +42,7 @@ messages = [ chat_completion = client.chat.completions.create( messages=messages, - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", user_id=user_id ) print(chat_completion.choices[0].message.content) @@ -73,7 +73,7 @@ chat_completion = client.chat.completions.create( "content": "What's the capital of France?", } ], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) ``` diff --git a/docs/open-source/graph_memory/overview.mdx b/docs/open-source/graph_memory/overview.mdx index b43682366..3b21382cb 100644 --- a/docs/open-source/graph_memory/overview.mdx +++ b/docs/open-source/graph_memory/overview.mdx @@ -54,7 +54,7 @@ You can also customize the LLM for Graph Memory from the [Supported LLM list](ht 1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations. 2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations. -3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations. +3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4.1-nano-2025-04-14) will be used for all graph operations. Here's how you can do it: @@ -100,7 +100,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } @@ -115,7 +115,7 @@ config = { "llm" : { "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.0, } } @@ -130,7 +130,7 @@ const config = { llm: { provider: "openai", config: { - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", temperature: 0.2, max_tokens: 2000, } @@ -146,7 +146,7 @@ const config = { llm: { provider: "openai", config: { - model: "gpt-4o-mini", + model: "gpt-4.1-nano-2025-04-14", temperature: 0.0, } } @@ -177,7 +177,7 @@ You can also customize the LLM for Graph Memory from the [Supported LLM list](ht 1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations. 2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations. -3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations. +3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4.1-nano-2025-04-142025-04-14) will be used for all graph operations. Here's how you can do it: @@ -241,7 +241,7 @@ User can also customize the LLM for Graph Memory from the [Supported LLM list](h 1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations. 2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations. -3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations. +3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4.1-nano-2025-04-14) will be used for all graph operations. Here's how you can do it: @@ -290,7 +290,7 @@ User can also customize the LLM for Graph Memory from the [Supported LLM list](h 1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations. 2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations. -3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations. +3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4.1-nano-2025-04-14) will be used for all graph operations. Here's how you can do it: diff --git a/docs/open-source/python-quickstart.mdx b/docs/open-source/python-quickstart.mdx index cf6cb41d3..79aebc1ca 100644 --- a/docs/open-source/python-quickstart.mdx +++ b/docs/open-source/python-quickstart.mdx @@ -504,7 +504,7 @@ chat_completion = client.chat.completions.create( "content": "What's the capital of France?", } ], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) ``` diff --git a/docs/v0x/components/llms/models/langchain.mdx b/docs/v0x/components/llms/models/langchain.mdx index 624d86425..43bea471a 100644 --- a/docs/v0x/components/llms/models/langchain.mdx +++ b/docs/v0x/components/llms/models/langchain.mdx @@ -20,7 +20,7 @@ os.environ["OPENAI_API_KEY"] = "your-api-key" # Initialize a LangChain model directly openai_model = ChatOpenAI( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", temperature=0.2, max_tokens=2000 ) diff --git a/docs/v0x/components/llms/models/litellm.mdx b/docs/v0x/components/llms/models/litellm.mdx index d66669f86..9b38fcb01 100644 --- a/docs/v0x/components/llms/models/litellm.mdx +++ b/docs/v0x/components/llms/models/litellm.mdx @@ -12,7 +12,7 @@ config = { "llm": { "provider": "litellm", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } diff --git a/docs/v0x/components/llms/models/openai.mdx b/docs/v0x/components/llms/models/openai.mdx index d31723838..e54ff2ddc 100644 --- a/docs/v0x/components/llms/models/openai.mdx +++ b/docs/v0x/components/llms/models/openai.mdx @@ -19,7 +19,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, } @@ -85,7 +85,7 @@ config = { "llm": { "provider": "openai_structured", "config": { - "model": "gpt-4o-2024-08-06", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.0, } } diff --git a/docs/v0x/examples/ai_companion_js.mdx b/docs/v0x/examples/ai_companion_js.mdx index d170d12bd..a02c2f596 100644 --- a/docs/v0x/examples/ai_companion_js.mdx +++ b/docs/v0x/examples/ai_companion_js.mdx @@ -45,7 +45,7 @@ ${memoriesStr}`; ]; const response = await openaiClient.chat.completions.create({ - model: "gpt-4o-mini", + model: "gpt-4.1-nano-2025-04-14", messages: messages }); diff --git a/docs/v0x/examples/collaborative-task-agent.mdx b/docs/v0x/examples/collaborative-task-agent.mdx index c46e8881f..1b18f32d2 100644 --- a/docs/v0x/examples/collaborative-task-agent.mdx +++ b/docs/v0x/examples/collaborative-task-agent.mdx @@ -51,7 +51,7 @@ class CollaborativeAgent: {"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"} ] reply = client.chat.completions.create( - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", messages=messages ).choices[0].message.content.strip() self.add_message("assistant", "assistant", reply) diff --git a/docs/v0x/examples/eliza_os.mdx b/docs/v0x/examples/eliza_os.mdx index 8d0178008..c46120ac4 100644 --- a/docs/v0x/examples/eliza_os.mdx +++ b/docs/v0x/examples/eliza_os.mdx @@ -43,7 +43,7 @@ MEM0_API_KEY= # Mem0 API Key ( Get from https://app.mem0.ai/dashboard/api-keys ) MEM0_USER_ID= # Default: eliza-os-user MEM0_PROVIDER= # Default: openai MEM0_PROVIDER_API_KEY= # API Key for the provider (openai, anthropic, etc.) -SMALL_MEM0_MODEL= # Default: gpt-4o-mini +SMALL_MEM0_MODEL= # Default: gpt-4.1-nano MEDIUM_MEM0_MODEL= # Default: gpt-4o LARGE_MEM0_MODEL= # Default: gpt-4o ``` diff --git a/docs/v0x/examples/llama-index-mem0.mdx b/docs/v0x/examples/llama-index-mem0.mdx index d7d57715b..8dba93c31 100644 --- a/docs/v0x/examples/llama-index-mem0.mdx +++ b/docs/v0x/examples/llama-index-mem0.mdx @@ -18,7 +18,7 @@ import os from llama_index.llms.openai import OpenAI os.environ["OPENAI_API_KEY"] = "" -llm = OpenAI(model="gpt-4o") +llm = OpenAI(model="gpt-4.1-nano-2025-04-14") ``` Initialize the Mem0 client. You can find your API key [here](https://app.mem0.ai/dashboard/api-keys). Read about Mem0 [Open Source](https://docs.mem0.ai/open-source/overview). diff --git a/docs/v0x/examples/llamaindex-multiagent-learning-system.mdx b/docs/v0x/examples/llamaindex-multiagent-learning-system.mdx index 149a503a6..f5897ab55 100644 --- a/docs/v0x/examples/llamaindex-multiagent-learning-system.mdx +++ b/docs/v0x/examples/llamaindex-multiagent-learning-system.mdx @@ -81,7 +81,7 @@ class MultiAgentLearningSystem: def __init__(self, student_id: str): self.student_id = student_id - self.llm = OpenAI(model="gpt-4o", temperature=0.2) + self.llm = OpenAI(model="gpt-4.1-nano-2025-04-14", temperature=0.2) # Memory context for this student self.memory_context = {"user_id": student_id, "app": "learning_assistant"} diff --git a/docs/v0x/examples/mem0-mastra.mdx b/docs/v0x/examples/mem0-mastra.mdx index 8c8f58650..c4ae1491c 100644 --- a/docs/v0x/examples/mem0-mastra.mdx +++ b/docs/v0x/examples/mem0-mastra.mdx @@ -98,7 +98,7 @@ export const mem0Agent = new Agent({ instructions: ` You are a helpful assistant that has the ability to memorize and remember facts using Mem0. `, - model: openai('gpt-4o'), + model: openai('gpt-4.1-nano'), tools: { mem0RememberTool, mem0MemorizeTool }, }); ``` diff --git a/docs/v0x/examples/mem0-openai-voice-demo.mdx b/docs/v0x/examples/mem0-openai-voice-demo.mdx index 42013d45a..d61d40868 100644 --- a/docs/v0x/examples/mem0-openai-voice-demo.mdx +++ b/docs/v0x/examples/mem0-openai-voice-demo.mdx @@ -162,7 +162,7 @@ def create_memory_voice_agent(): Use the search_memories tool when you need context from past conversations or user asks you to recall something. """, ), - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) @@ -171,7 +171,7 @@ def create_memory_voice_agent(): This function: - Creates an OpenAI Agent with specific instructions -- Configures it to use gpt-4o (you can use other models) +- Configures it to use gpt-4.1-nano (you can use other models) - Registers the memory-related tools with the agent - Uses `prompt_with_handoff_instructions` to include standard voice agent behaviors @@ -369,7 +369,7 @@ def create_memory_voice_agent(): Use the search_memories tool when you need context from past conversations or user asks you to recall something. """, ), - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", tools=[save_memories, search_memories], ) diff --git a/docs/v0x/examples/memory-guided-content-writing.mdx b/docs/v0x/examples/memory-guided-content-writing.mdx index 1f8b4f195..bc17ac5ca 100644 --- a/docs/v0x/examples/memory-guided-content-writing.mdx +++ b/docs/v0x/examples/memory-guided-content-writing.mdx @@ -103,7 +103,7 @@ Preferences: ] response = openai.chat.completions.create( - model="gpt-4o-mini", + model="gpt-4.1-nano-2025-04-14", messages=messages ) clean_response = response.choices[0].message.content.strip() diff --git a/docs/v0x/examples/openai-inbuilt-tools.mdx b/docs/v0x/examples/openai-inbuilt-tools.mdx index e1afa6b90..f870ec839 100644 --- a/docs/v0x/examples/openai-inbuilt-tools.mdx +++ b/docs/v0x/examples/openai-inbuilt-tools.mdx @@ -119,7 +119,7 @@ const carRecommendationTool = zodResponsesFunction({ // Use the tool in your OpenAI request const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, carRecommendationTool], input: `${getMemoryString(relevantMemories)}\n${userInput}`, }); @@ -131,7 +131,7 @@ Combine memory with web search for up-to-date recommendations: ```javascript const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, carRecommendationTool], input: `${getMemoryString(relevantMemories)}\n${userInput}`, }); @@ -202,7 +202,7 @@ async function main(memory = false) { } const response = await openAIClient.responses.create({ - model: "gpt-4o", + model: "gpt-4.1-nano-2025-04-14", tools: [{ type: "web_search_preview" }, tool], input: `${getMemoryString(relevantMemories)}\n${input}`, }); diff --git a/docs/v0x/examples/personal-ai-tutor.mdx b/docs/v0x/examples/personal-ai-tutor.mdx index 220577aa7..e7d8a1519 100644 --- a/docs/v0x/examples/personal-ai-tutor.mdx +++ b/docs/v0x/examples/personal-ai-tutor.mdx @@ -57,7 +57,7 @@ class PersonalAITutor: """ # Start a streaming response request to the AI response = self.client.responses.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", instructions="You are a personal AI Tutor.", input=question, stream=True diff --git a/docs/v0x/examples/personal-travel-assistant.mdx b/docs/v0x/examples/personal-travel-assistant.mdx index 81fb753db..640538be9 100644 --- a/docs/v0x/examples/personal-travel-assistant.mdx +++ b/docs/v0x/examples/personal-travel-assistant.mdx @@ -35,7 +35,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.1, "max_tokens": 2000, } @@ -76,7 +76,7 @@ class PersonalTravelAssistant: # Generate response using Responses API response = self.client.responses.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", input=prompt ) @@ -140,9 +140,9 @@ class PersonalTravelAssistant: prompt = f"User input: {question}\n Previous memories: {previous_memories}" self.messages.append({"role": "user", "content": prompt}) - # Generate response using GPT-4o + # Generate response using gpt-4.1-nano response = self.client.chat.completions.create( - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14"2025-04-14", messages=self.messages ) answer = response.choices[0].message.content diff --git a/docs/v0x/integrations/agentops.mdx b/docs/v0x/integrations/agentops.mdx index ba25c4057..3fb04dc42 100644 --- a/docs/v0x/integrations/agentops.mdx +++ b/docs/v0x/integrations/agentops.mdx @@ -49,7 +49,7 @@ local_config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.1, "max_tokens": 2000, }, diff --git a/docs/v0x/integrations/agno.mdx b/docs/v0x/integrations/agno.mdx index f04c69aa4..99584fa79 100644 --- a/docs/v0x/integrations/agno.mdx +++ b/docs/v0x/integrations/agno.mdx @@ -36,7 +36,7 @@ from agno.tools.mem0 import Mem0Tools agent = Agent( name="Memory Agent", - model=OpenAIChat(id="gpt-4o-mini"), + model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"2025-04-14"), tools=[Mem0Tools()], description="An assistant that remembers and personalizes using Mem0 memory." ) diff --git a/docs/v0x/integrations/keywords.mdx b/docs/v0x/integrations/keywords.mdx index fff71f1ec..f8df09ae1 100644 --- a/docs/v0x/integrations/keywords.mdx +++ b/docs/v0x/integrations/keywords.mdx @@ -55,7 +55,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.0, "api_key": keywordsai_api_key, "openai_base_url": base_url, @@ -101,7 +101,7 @@ messages = [ # Add memory and generate a response response = client.chat.completions.create( - model="openai/gpt-4o", + model="openai/gpt-4.1-nano", messages=messages, extra_body={ "mem0_params": { diff --git a/docs/v0x/integrations/langchain.mdx b/docs/v0x/integrations/langchain.mdx index f79499e7a..67509be28 100644 --- a/docs/v0x/integrations/langchain.mdx +++ b/docs/v0x/integrations/langchain.mdx @@ -39,7 +39,7 @@ load_dotenv() # os.environ["MEM0_API_KEY"] = "your-mem0-api-key" # Initialize LangChain and Mem0 -llm = ChatOpenAI(model="gpt-4o-mini") +llm = ChatOpenAI(model="gpt-4.1-nano-2025-04-14") mem0 = MemoryClient() ``` diff --git a/docs/v0x/integrations/livekit.mdx b/docs/v0x/integrations/livekit.mdx index ad44235e5..46947fefa 100644 --- a/docs/v0x/integrations/livekit.mdx +++ b/docs/v0x/integrations/livekit.mdx @@ -147,7 +147,7 @@ async def entrypoint(ctx: JobContext): session = AgentSession( stt=deepgram.STT(), - llm=openai.LLM(model="gpt-4o-mini"), + llm=openai.LLM(model="gpt-4.1-nano-2025-04-14"2025-04-14"), tts=openai.TTS(voice="ash",), turn_detection=EnglishModel(), vad=silero.VAD.load(), diff --git a/docs/v0x/integrations/llama-index.mdx b/docs/v0x/integrations/llama-index.mdx index 8316a449d..cc7546615 100644 --- a/docs/v0x/integrations/llama-index.mdx +++ b/docs/v0x/integrations/llama-index.mdx @@ -83,7 +83,7 @@ config = { "llm": { "provider": "openai", "config": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "temperature": 0.2, "max_tokens": 2000, }, @@ -116,7 +116,7 @@ from dotenv import load_dotenv load_dotenv() # os.environ["OPENAI_API_KEY"] = "" -llm = OpenAI(model="gpt-4o-mini") +llm = OpenAI(model="gpt-4.1-nano-2025-04-14"2025-04-14") ``` ### SimpleChatEngine diff --git a/docs/v0x/integrations/mastra.mdx b/docs/v0x/integrations/mastra.mdx index 9b126a44a..0f490e119 100644 --- a/docs/v0x/integrations/mastra.mdx +++ b/docs/v0x/integrations/mastra.mdx @@ -106,7 +106,7 @@ const mem0Agent = new Agent({ Use the Mem0-memorize tool to save important information that might be useful later. Use the Mem0-remember tool to recall previously saved information when answering questions. `, - model: openai('gpt-4o'), + model: openai('gpt-4.1-nano'), tools: { mem0RememberTool, mem0MemorizeTool }, }); ``` diff --git a/docs/v0x/integrations/openai-agents-sdk.mdx b/docs/v0x/integrations/openai-agents-sdk.mdx index 084a89607..f8ab3bd47 100644 --- a/docs/v0x/integrations/openai-agents-sdk.mdx +++ b/docs/v0x/integrations/openai-agents-sdk.mdx @@ -63,7 +63,7 @@ agent = Agent( Use the save_memory tool to store important information about the user. Always personalize your responses based on available memory.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) def chat_with_agent(user_input: str, user_id: str) -> str: @@ -114,7 +114,7 @@ travel_agent = Agent( understand the user's travel preferences and history before making recommendations. After providing your response, use store_conversation to save important details.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) health_agent = Agent( @@ -123,7 +123,7 @@ health_agent = Agent( understand the user's health goals and dietary preferences. After providing advice, use store_conversation to save relevant information.""", tools=[search_memory, save_memory], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) # Triage agent with handoffs @@ -134,7 +134,7 @@ triage_agent = Agent( For health-related questions (fitness, diet, wellness, exercise), hand off to Health Advisor. For general questions, you can handle them directly using available tools.""", handoffs=[travel_agent, health_agent], - model="gpt-4o" + model="gpt-4.1-nano-2025-04-14" ) def chat_with_handoffs(user_input: str, user_id: str) -> str: diff --git a/docs/v0x/open-source/python-quickstart.mdx b/docs/v0x/open-source/python-quickstart.mdx index 622310ef7..eeeb0c456 100644 --- a/docs/v0x/open-source/python-quickstart.mdx +++ b/docs/v0x/open-source/python-quickstart.mdx @@ -504,7 +504,7 @@ chat_completion = client.chat.completions.create( "content": "What's the capital of France?", } ], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) ``` diff --git a/examples/graph-db-demo/kuzu-example.ipynb b/examples/graph-db-demo/kuzu-example.ipynb index f1922d67e..1838be632 100644 --- a/examples/graph-db-demo/kuzu-example.ipynb +++ b/examples/graph-db-demo/kuzu-example.ipynb @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -239,7 +239,7 @@ " # Generate Assistant response\n", " system_prompt = f\"You are a helpful AI. Answer the question based on query and memories.\\nUser Memories:\\n{memories_str}\"\n", " messages = [{\"role\": \"system\", \"content\": system_prompt}, {\"role\": \"user\", \"content\": message}]\n", - " response = openai_client.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", + " response = openai_client.chat.completions.create(model=\"gpt-4.1-nano-2025-04-14\", messages=messages)\n", " assistant_response = response.choices[0].message.content\n", "\n", " # Create new memories from the conversation\n", diff --git a/examples/misc/diet_assistant_voice_cartesia.py b/examples/misc/diet_assistant_voice_cartesia.py index 2fb2f6c1a..2d4a83473 100644 --- a/examples/misc/diet_assistant_voice_cartesia.py +++ b/examples/misc/diet_assistant_voice_cartesia.py @@ -37,7 +37,7 @@ food_agent = Agent( name="Personal Food Assistant", description="Provides personalized food recommendations with memory and generates voice responses using Cartesia TTS tools.", instructions=agent_instructions, - model=OpenAIChat(id="gpt-4o"), + model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"), tools=[CartesiaTools(voice_localize_enabled=True)], show_tool_calls=True, ) diff --git a/examples/misc/fitness_checker.py b/examples/misc/fitness_checker.py index bbd50bcec..5bd92ec01 100644 --- a/examples/misc/fitness_checker.py +++ b/examples/misc/fitness_checker.py @@ -1,6 +1,6 @@ """ Simple Fitness Memory Tracker that tracks your fitness progress and knows your health priorities. -Uses Mem0 for memory and GPT-4o for image understanding. +Uses Mem0 for memory and gpt-4.1-nano for image understanding. In order to run this file, you need to set up your Mem0 API at Mem0 platform and also need an OpenAI API key. export OPENAI_API_KEY="your_openai_api_key" @@ -18,7 +18,7 @@ USER_ID = "Anish" agent = Agent( name="Fitness Agent", - model=OpenAIChat(id="gpt-4o"), + model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"), description="You are a helpful fitness assistant who remembers past logs and gives personalized suggestions for Anish's training and diet.", markdown=True, ) diff --git a/examples/misc/multillm_memory.py b/examples/misc/multillm_memory.py index ab024b171..a30290c94 100644 --- a/examples/misc/multillm_memory.py +++ b/examples/misc/multillm_memory.py @@ -34,7 +34,7 @@ memory = MemoryClient() # Research team models with specialized roles RESEARCH_TEAM = { "tech_analyst": { - "model": "gpt-4o", + "model": "gpt-4.1-nano-2025-04-14", "role": "Technical Analyst - Code review, architecture, and technical decisions", }, "writer": { @@ -42,7 +42,7 @@ RESEARCH_TEAM = { "role": "Documentation Writer - Clear explanations and user guides", }, "data_analyst": { - "model": "gpt-4o-mini", + "model": "gpt-4.1-nano-2025-04-14", "role": "Data Analyst - Insights, trends, and data-driven recommendations", }, } diff --git a/examples/misc/personal_assistant_agno.py b/examples/misc/personal_assistant_agno.py index bd2f04c91..5a770a522 100644 --- a/examples/misc/personal_assistant_agno.py +++ b/examples/misc/personal_assistant_agno.py @@ -21,7 +21,7 @@ client = MemoryClient() # Define the agent agent = Agent( name="Personal Agent", - model=OpenAIChat(id="gpt-4o"), + model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"), description="You are a helpful personal agent that helps me with day to day activities." "You can process both text and images.", markdown=True, diff --git a/examples/misc/personalized_search.py b/examples/misc/personalized_search.py index 34939fbbd..0c8d0e890 100644 --- a/examples/misc/personalized_search.py +++ b/examples/misc/personalized_search.py @@ -35,7 +35,7 @@ BE IT TIME, LOCATION, USER'S PERSONAL LIFE, CHOICES, USER'S PREFERENCES, we need ''' ) -llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.2) +llm = ChatOpenAI(model="gpt-4.1-nano-2025-04-14", temperature=0.2) def setup_user_history(user_id): diff --git a/examples/misc/test.py b/examples/misc/test.py index ec21f6ac6..39c4ae57f 100644 --- a/examples/misc/test.py +++ b/examples/misc/test.py @@ -35,7 +35,7 @@ travel_agent = Agent( understand the user's travel preferences and history before making recommendations. After providing your response, use store_conversation to save important details.""", tools=[search_memory, save_memory], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) health_agent = Agent( @@ -44,7 +44,7 @@ health_agent = Agent( understand the user's health goals and dietary preferences. After providing advice, use store_conversation to save relevant information.""", tools=[search_memory, save_memory], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) # Triage agent with handoffs @@ -55,7 +55,7 @@ triage_agent = Agent( For health-related questions (fitness, diet, wellness, exercise), hand off to Health Advisor. For general questions, you can handle them directly using available tools.""", handoffs=[travel_agent, health_agent], - model="gpt-4o", + model="gpt-4.1-nano-2025-04-14", ) diff --git a/examples/multiagents/llamaindex_learning_system.py b/examples/multiagents/llamaindex_learning_system.py index 2896c4676..b568a1981 100644 --- a/examples/multiagents/llamaindex_learning_system.py +++ b/examples/multiagents/llamaindex_learning_system.py @@ -42,7 +42,7 @@ class MultiAgentLearningSystem: def __init__(self, student_id: str): self.student_id = student_id - self.llm = OpenAI(model="gpt-4o", temperature=0.2) + self.llm = OpenAI(model="gpt-4.1-nano-2025-04-14", temperature=0.2) # Memory context for this student self.memory_context = {"user_id": student_id, "app": "learning_assistant"} diff --git a/examples/multimodal-demo/src/hooks/useChat.ts b/examples/multimodal-demo/src/hooks/useChat.ts index 4f3f37c17..59f0cc864 100644 --- a/examples/multimodal-demo/src/hooks/useChat.ts +++ b/examples/multimodal-demo/src/hooks/useChat.ts @@ -172,7 +172,7 @@ export const useChat = ({ user, mem0ApiKey, openaiApiKey }: UseChatProps): UseCh } const completion = await openai.chat.completions.create({ - model: "gpt-4o-mini", + model: "gpt-4.1-nano-2025-04-14", // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error messages: messagesForLLM.map(msg => ({ diff --git a/examples/multimodal-demo/useChat.ts b/examples/multimodal-demo/useChat.ts index 4f3f37c17..59f0cc864 100644 --- a/examples/multimodal-demo/useChat.ts +++ b/examples/multimodal-demo/useChat.ts @@ -172,7 +172,7 @@ export const useChat = ({ user, mem0ApiKey, openaiApiKey }: UseChatProps): UseCh } const completion = await openai.chat.completions.create({ - model: "gpt-4o-mini", + model: "gpt-4.1-nano-2025-04-14", // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error messages: messagesForLLM.map(msg => ({ diff --git a/mem0-ts/src/oss/src/llms/openai.ts b/mem0-ts/src/oss/src/llms/openai.ts index bc995f7b8..96a36f971 100644 --- a/mem0-ts/src/oss/src/llms/openai.ts +++ b/mem0-ts/src/oss/src/llms/openai.ts @@ -11,7 +11,7 @@ export class OpenAILLM implements LLM { apiKey: config.apiKey, baseURL: config.baseURL, }); - this.model = config.model || "gpt-4o-mini"; + this.model = config.model || "gpt-4.1-nano-2025-04-14"; } async generateResponse( diff --git a/mem0/configs/llms/base.py b/mem0/configs/llms/base.py index 55561c632..93d5052d0 100644 --- a/mem0/configs/llms/base.py +++ b/mem0/configs/llms/base.py @@ -29,7 +29,7 @@ class BaseLlmConfig(ABC): Initialize a base configuration class instance for the LLM. Args: - model: The model identifier to use (e.g., "gpt-4o-mini", "claude-3-5-sonnet-20240620") + model: The model identifier to use (e.g., "gpt-4.1-nano-2025-04-14", "claude-3-5-sonnet-20240620") Defaults to None (will be set by provider-specific configs) temperature: Controls the randomness of the model's output. Higher values (closer to 1) make output more random, lower values make it more deterministic. diff --git a/mem0/llms/azure_openai.py b/mem0/llms/azure_openai.py index 6ddb50b66..76ed83f8f 100644 --- a/mem0/llms/azure_openai.py +++ b/mem0/llms/azure_openai.py @@ -38,7 +38,7 @@ class AzureOpenAILLM(LLMBase): # Model name should match the custom deployment name chosen for it. if not self.config.model: - self.config.model = "gpt-4o" + self.config.model = "gpt-4.1-nano-2025-04-14" api_key = self.config.azure_kwargs.api_key or os.getenv("LLM_AZURE_OPENAI_API_KEY") azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT") diff --git a/mem0/llms/azure_openai_structured.py b/mem0/llms/azure_openai_structured.py index fd2bae023..3b97b492f 100644 --- a/mem0/llms/azure_openai_structured.py +++ b/mem0/llms/azure_openai_structured.py @@ -16,7 +16,7 @@ class AzureOpenAIStructuredLLM(LLMBase): # Model name should match the custom deployment name chosen for it. if not self.config.model: - self.config.model = "gpt-4o-2024-08-06" + self.config.model = "gpt-4.1-nano-2025-04-14" api_key = self.config.azure_kwargs.api_key or os.getenv("LLM_AZURE_OPENAI_API_KEY") azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT") diff --git a/mem0/llms/litellm.py b/mem0/llms/litellm.py index 3a5ef60c6..d04aa43d0 100644 --- a/mem0/llms/litellm.py +++ b/mem0/llms/litellm.py @@ -16,7 +16,7 @@ class LiteLLM(LLMBase): super().__init__(config) if not self.config.model: - self.config.model = "gpt-4o-mini" + self.config.model = "gpt-4.1-nano-2025-04-14" def _parse_response(self, response, tools): """ diff --git a/mem0/llms/openai.py b/mem0/llms/openai.py index b6ad538d0..a486ff86b 100644 --- a/mem0/llms/openai.py +++ b/mem0/llms/openai.py @@ -35,7 +35,7 @@ class OpenAILLM(LLMBase): super().__init__(config) if not self.config.model: - self.config.model = "gpt-4o-mini" + self.config.model = "gpt-4.1-nano-2025-04-14" if os.environ.get("OPENROUTER_API_KEY"): # Use OpenRouter self.client = OpenAI( diff --git a/server/main.py b/server/main.py index a9f4dfdc1..85c7cc7ea 100644 --- a/server/main.py +++ b/server/main.py @@ -50,7 +50,7 @@ DEFAULT_CONFIG = { "provider": "neo4j", "config": {"url": NEO4J_URI, "username": NEO4J_USERNAME, "password": NEO4J_PASSWORD}, }, - "llm": {"provider": "openai", "config": {"api_key": OPENAI_API_KEY, "temperature": 0.2, "model": "gpt-4o"}}, + "llm": {"provider": "openai", "config": {"api_key": OPENAI_API_KEY, "temperature": 0.2, "model": "gpt-4.1-nano-2025-04-14"}}, "embedder": {"provider": "openai", "config": {"api_key": OPENAI_API_KEY, "model": "text-embedding-3-small"}}, "history_db_path": HISTORY_DB_PATH, } diff --git a/tests/llms/test_azure_openai.py b/tests/llms/test_azure_openai.py index f9bfbe4c4..8febe386c 100644 --- a/tests/llms/test_azure_openai.py +++ b/tests/llms/test_azure_openai.py @@ -5,7 +5,7 @@ import pytest from mem0.configs.llms.azure import AzureOpenAIConfig from mem0.llms.azure_openai import AzureOpenAILLM -MODEL = "gpt-4o" # or your custom deployment name +MODEL = "gpt-4.1-nano-2025-04-14" # or your custom deployment name TEMPERATURE = 0.7 MAX_TOKENS = 100 TOP_P = 1.0 @@ -191,8 +191,8 @@ def test_init_with_env_vars(monkeypatch): http_client=None, default_headers=None, ) - # Should default to "gpt-4o" if model is None - assert llm.config.model == "gpt-4o" + # Should default to "gpt-4.1-nano-2025-04-14" if model is None + assert llm.config.model == "gpt-4.1-nano-2025-04-14" def test_init_with_default_azure_credential(monkeypatch): diff --git a/tests/llms/test_azure_openai_structured.py b/tests/llms/test_azure_openai_structured.py index d8655d136..4098bed88 100644 --- a/tests/llms/test_azure_openai_structured.py +++ b/tests/llms/test_azure_openai_structured.py @@ -56,7 +56,7 @@ def test_init_with_default_credential(mock_credential, mock_token_provider, mock mock_token_provider.return_value = "token-provider" llm = AzureOpenAIStructuredLLM(config) # Should set default model if not provided - assert llm.config.model == "gpt-4o-2024-08-06" + assert llm.config.model == "gpt-4.1-nano-2025-04-14" mock_credential.assert_called_once() mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE) mock_azure_openai.assert_called_once() @@ -91,7 +91,7 @@ def test_init_with_placeholder_api_key_uses_default_credential( config = DummyConfig(model=None, azure_kwargs=DummyAzureKwargs(api_key="your-api-key")) mock_token_provider.return_value = "token-provider" llm = AzureOpenAIStructuredLLM(config) - assert llm.config.model == "gpt-4o-2024-08-06" + assert llm.config.model == "gpt-4.1-nano-2025-04-14" mock_credential.assert_called_once() mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE) mock_azure_openai.assert_called_once() diff --git a/tests/llms/test_litellm.py b/tests/llms/test_litellm.py index d7be93c9f..db4d174f2 100644 --- a/tests/llms/test_litellm.py +++ b/tests/llms/test_litellm.py @@ -24,7 +24,7 @@ def test_generate_response_with_unsupported_model(mock_litellm): def test_generate_response_without_tools(mock_litellm): - config = BaseLlmConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1) + config = BaseLlmConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1) llm = litellm.LiteLLM(config) messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -39,13 +39,13 @@ def test_generate_response_without_tools(mock_litellm): response = llm.generate_response(messages) mock_litellm.completion.assert_called_once_with( - model="gpt-4o", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0 + model="gpt-4.1-nano-2025-04-14", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0 ) assert response == "I'm doing well, thank you for asking!" def test_generate_response_with_tools(mock_litellm): - config = BaseLlmConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1) + config = BaseLlmConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1) llm = litellm.LiteLLM(config) messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -82,7 +82,7 @@ def test_generate_response_with_tools(mock_litellm): response = llm.generate_response(messages, tools=tools) mock_litellm.completion.assert_called_once_with( - model="gpt-4o", messages=messages, temperature=0.7, max_tokens=100, top_p=1, tools=tools, tool_choice="auto" + model="gpt-4.1-nano-2025-04-14", messages=messages, temperature=0.7, max_tokens=100, top_p=1, tools=tools, tool_choice="auto" ) assert response["content"] == "I've added the memory for you." diff --git a/tests/llms/test_openai.py b/tests/llms/test_openai.py index a98feb07d..700698ba1 100644 --- a/tests/llms/test_openai.py +++ b/tests/llms/test_openai.py @@ -17,7 +17,7 @@ def mock_openai_client(): def test_openai_llm_base_url(): # case1: default config: with openai official base url - config = OpenAIConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key") + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key") llm = OpenAILLM(config) # Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash assert str(llm.client.base_url) == "https://api.openai.com/v1/" @@ -25,7 +25,7 @@ def test_openai_llm_base_url(): # case2: with env variable OPENAI_API_BASE provider_base_url = "https://api.provider.com/v1" os.environ["OPENAI_BASE_URL"] = provider_base_url - config = OpenAIConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key") + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key") llm = OpenAILLM(config) # Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash assert str(llm.client.base_url) == provider_base_url + "/" @@ -33,7 +33,7 @@ def test_openai_llm_base_url(): # case3: with config.openai_base_url config_base_url = "https://api.config.com/v1" config = OpenAIConfig( - model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key", openai_base_url=config_base_url + model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1.0, api_key="api_key", openai_base_url=config_base_url ) llm = OpenAILLM(config) # Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash @@ -41,7 +41,7 @@ def test_openai_llm_base_url(): def test_generate_response_without_tools(mock_openai_client): - config = OpenAIConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1.0) + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1.0) llm = OpenAILLM(config) messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -55,13 +55,13 @@ def test_generate_response_without_tools(mock_openai_client): response = llm.generate_response(messages) mock_openai_client.chat.completions.create.assert_called_once_with( - model="gpt-4o", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0, store=False + model="gpt-4.1-nano-2025-04-14", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0, store=False ) assert response == "I'm doing well, thank you for asking!" def test_generate_response_with_tools(mock_openai_client): - config = OpenAIConfig(model="gpt-4o", temperature=0.7, max_tokens=100, top_p=1.0) + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", temperature=0.7, max_tokens=100, top_p=1.0) llm = OpenAILLM(config) messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -97,7 +97,7 @@ def test_generate_response_with_tools(mock_openai_client): response = llm.generate_response(messages, tools=tools) mock_openai_client.chat.completions.create.assert_called_once_with( - model="gpt-4o", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0, tools=tools, tool_choice="auto", store=False + model="gpt-4.1-nano-2025-04-14", messages=messages, temperature=0.7, max_tokens=100, top_p=1.0, tools=tools, tool_choice="auto", store=False ) assert response["content"] == "I've added the memory for you." @@ -110,7 +110,7 @@ def test_response_callback_invocation(mock_openai_client): # Setup mock callback mock_callback = Mock() - config = OpenAIConfig(model="gpt-4o", response_callback=mock_callback) + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", response_callback=mock_callback) llm = OpenAILLM(config) messages = [{"role": "user", "content": "Test callback"}] @@ -131,7 +131,7 @@ def test_response_callback_invocation(mock_openai_client): def test_no_response_callback(mock_openai_client): - config = OpenAIConfig(model="gpt-4o") + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14") llm = OpenAILLM(config) messages = [{"role": "user", "content": "Test no callback"}] @@ -153,7 +153,7 @@ def test_callback_exception_handling(mock_openai_client): def faulty_callback(*args): raise ValueError("Callback error") - config = OpenAIConfig(model="gpt-4o", response_callback=faulty_callback) + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", response_callback=faulty_callback) llm = OpenAILLM(config) messages = [{"role": "user", "content": "Test exception"}] @@ -172,7 +172,7 @@ def test_callback_exception_handling(mock_openai_client): def test_callback_with_tools(mock_openai_client): mock_callback = Mock() - config = OpenAIConfig(model="gpt-4o", response_callback=mock_callback) + config = OpenAIConfig(model="gpt-4.1-nano-2025-04-14", response_callback=mock_callback) llm = OpenAILLM(config) messages = [{"role": "user", "content": "Test tools"}] tools = [ diff --git a/tests/test_proxy.py b/tests/test_proxy.py index ba3188421..b19ca70a9 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -68,14 +68,14 @@ def test_completions_create(mock_memory_client, mock_litellm): mock_litellm.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]} mock_litellm.supports_function_calling.return_value = True - response = completions.create(model="gpt-4o-mini", messages=messages, user_id="test_user", temperature=0.7) + response = completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages, user_id="test_user", temperature=0.7) mock_memory_client.add.assert_called_once() mock_memory_client.search.assert_called_once() mock_litellm.completion.assert_called_once() call_args = mock_litellm.completion.call_args[1] - assert call_args["model"] == "gpt-4o-mini" + assert call_args["model"] == "gpt-4.1-nano-2025-04-14" assert len(call_args["messages"]) == 2 assert call_args["temperature"] == 0.7 @@ -93,7 +93,7 @@ def test_completions_create_with_system_message(mock_memory_client, mock_litellm mock_litellm.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]} mock_litellm.supports_function_calling.return_value = True - completions.create(model="gpt-4o-mini", messages=messages, user_id="test_user") + completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages, user_id="test_user") call_args = mock_litellm.completion.call_args[1] assert call_args["messages"][0]["role"] == "system"