[Update] Default LLM (#3587)

This commit is contained in:
Parshva Daftari
2025-10-15 11:19:52 -07:00
committed by GitHub
parent a40314c971
commit 41cfb3ab1a
74 changed files with 136 additions and 136 deletions
+3 -3
View File
@@ -103,7 +103,7 @@ memory = Memory()
# With custom configuration # With custom configuration
config = MemoryConfig( config = MemoryConfig(
vector_store={"provider": "qdrant", "config": {"host": "localhost"}}, 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"}} embedder={"provider": "openai", "config": {"model": "text-embedding-3-small"}}
) )
memory = Memory(config) memory = Memory(config)
@@ -339,7 +339,7 @@ config = MemoryConfig(
llm={ llm={
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.1, "temperature": 0.1,
"max_tokens": 1000 "max_tokens": 1000
} }
@@ -527,7 +527,7 @@ const memory = new Memory({
}, },
llm: { llm: {
provider: 'openai', provider: 'openai',
config: { model: 'gpt-4o-mini' } config: { model: 'gpt-4.1-nano' }
} }
}); });
+2 -2
View File
@@ -95,7 +95,7 @@ npm install mem0ai
### Basic Usage ### 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: 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 # Generate Assistant response
system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}" 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}] 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 assistant_response = response.choices[0].message.content
# Create new memories from the conversation # Create new memories from the conversation
+1 -1
View File
@@ -20,7 +20,7 @@ os.environ["OPENAI_API_KEY"] = "your-api-key"
# Initialize a LangChain model directly # Initialize a LangChain model directly
openai_model = ChatOpenAI( openai_model = ChatOpenAI(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
temperature=0.2, temperature=0.2,
max_tokens=2000 max_tokens=2000
) )
+1 -1
View File
@@ -12,7 +12,7 @@ config = {
"llm": { "llm": {
"provider": "litellm", "provider": "litellm",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
+2 -2
View File
@@ -19,7 +19,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -85,7 +85,7 @@ config = {
"llm": { "llm": {
"provider": "openai_structured", "provider": "openai_structured",
"config": { "config": {
"model": "gpt-4o-2024-08-06", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.0, "temperature": 0.0,
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ ${memoriesStr}`;
]; ];
const response = await openaiClient.chat.completions.create({ const response = await openaiClient.chat.completions.create({
model: "gpt-4o-mini", model: "gpt-4.1-nano-2025-04-14",
messages: messages messages: messages
}); });
+1 -1
View File
@@ -51,7 +51,7 @@ class CollaborativeAgent:
{"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"} {"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"}
] ]
reply = client.chat.completions.create( reply = client.chat.completions.create(
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
messages=messages messages=messages
).choices[0].message.content.strip() ).choices[0].message.content.strip()
self.add_message("assistant", "assistant", reply) self.add_message("assistant", "assistant", reply)
+1 -1
View File
@@ -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_USER_ID= # Default: eliza-os-user
MEM0_PROVIDER= # Default: openai MEM0_PROVIDER= # Default: openai
MEM0_PROVIDER_API_KEY= # API Key for the provider (OpenAI, Anthropic, etc.) 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 MEDIUM_MEM0_MODEL= # Default: gpt-4o
LARGE_MEM0_MODEL= # Default: gpt-4o LARGE_MEM0_MODEL= # Default: gpt-4o
``` ```
+1 -1
View File
@@ -20,7 +20,7 @@ import os
from llama_index.llms.openai import OpenAI from llama_index.llms.openai import OpenAI
os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>" os.environ["OPENAI_API_KEY"] = "<your-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). 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).
@@ -81,7 +81,7 @@ class MultiAgentLearningSystem:
def __init__(self, student_id: str): def __init__(self, student_id: str):
self.student_id = student_id 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 # Memory context for this student
self.memory_context = {"user_id": student_id, "app": "learning_assistant"} self.memory_context = {"user_id": student_id, "app": "learning_assistant"}
+1 -1
View File
@@ -97,7 +97,7 @@ export const mem0Agent = new Agent({
instructions: ` instructions: `
You are a helpful assistant that has the ability to memorize and remember facts using Mem0. 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 }, tools: { mem0RememberTool, mem0MemorizeTool },
}); });
``` ```
+3 -3
View File
@@ -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. 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], tools=[save_memories, search_memories],
) )
@@ -171,7 +171,7 @@ def create_memory_voice_agent():
This function: This function:
- Creates an OpenAI Agent with specific instructions - 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 - Registers the memory-related tools with the agent
- Uses `prompt_with_handoff_instructions` to include standard voice agent behaviors - 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. 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], tools=[save_memories, search_memories],
) )
@@ -103,7 +103,7 @@ Preferences:
] ]
response = openai.chat.completions.create( response = openai.chat.completions.create(
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
messages=messages messages=messages
) )
clean_response = response.choices[0].message.content.strip() clean_response = response.choices[0].message.content.strip()
+3 -3
View File
@@ -119,7 +119,7 @@ const carRecommendationTool = zodResponsesFunction({
// Use the tool in your OpenAI request // Use the tool in your OpenAI request
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, carRecommendationTool], tools: [{ type: "web_search_preview" }, carRecommendationTool],
input: `${getMemoryString(relevantMemories)}\n${userInput}`, input: `${getMemoryString(relevantMemories)}\n${userInput}`,
}); });
@@ -131,7 +131,7 @@ Combine memory with web search for up-to-date recommendations:
```javascript ```javascript
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, carRecommendationTool], tools: [{ type: "web_search_preview" }, carRecommendationTool],
input: `${getMemoryString(relevantMemories)}\n${userInput}`, input: `${getMemoryString(relevantMemories)}\n${userInput}`,
}); });
@@ -202,7 +202,7 @@ async function main(memory = false) {
} }
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, tool], tools: [{ type: "web_search_preview" }, tool],
input: `${getMemoryString(relevantMemories)}\n${input}`, input: `${getMemoryString(relevantMemories)}\n${input}`,
}); });
+1 -1
View File
@@ -58,7 +58,7 @@ class PersonalAITutor:
""" """
# Start a streaming response request to the AI # Start a streaming response request to the AI
response = self.client.responses.create( response = self.client.responses.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
instructions="You are a personal AI Tutor.", instructions="You are a personal AI Tutor.",
input=question, input=question,
stream=True stream=True
+4 -4
View File
@@ -35,7 +35,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.1, "temperature": 0.1,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -76,7 +76,7 @@ class PersonalTravelAssistant:
# Generate response using Responses API # Generate response using Responses API
response = self.client.responses.create( response = self.client.responses.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
input=prompt input=prompt
) )
@@ -140,9 +140,9 @@ class PersonalTravelAssistant:
prompt = f"User input: {question}\n Previous memories: {previous_memories}" prompt = f"User input: {question}\n Previous memories: {previous_memories}"
self.messages.append({"role": "user", "content": prompt}) 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( response = self.client.chat.completions.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14"2025-04-14",
messages=self.messages messages=self.messages
) )
answer = response.choices[0].message.content answer = response.choices[0].message.content
+1 -1
View File
@@ -49,7 +49,7 @@ local_config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.1, "temperature": 0.1,
"max_tokens": 2000, "max_tokens": 2000,
}, },
+1 -1
View File
@@ -36,7 +36,7 @@ from agno.tools.mem0 import Mem0Tools
agent = Agent( agent = Agent(
name="Memory Agent", name="Memory Agent",
model=OpenAIChat(id="gpt-4o-mini"), model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"),
tools=[Mem0Tools()], tools=[Mem0Tools()],
description="An assistant that remembers and personalizes using Mem0 memory." description="An assistant that remembers and personalizes using Mem0 memory."
) )
+2 -2
View File
@@ -55,7 +55,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.0, "temperature": 0.0,
"api_key": keywordsai_api_key, "api_key": keywordsai_api_key,
"openai_base_url": base_url, "openai_base_url": base_url,
@@ -101,7 +101,7 @@ messages = [
# Add memory and generate a response # Add memory and generate a response
response = client.chat.completions.create( response = client.chat.completions.create(
model="openai/gpt-4o", model="openai/gpt-4.1-nano",
messages=messages, messages=messages,
extra_body={ extra_body={
"mem0_params": { "mem0_params": {
+1 -1
View File
@@ -39,7 +39,7 @@ load_dotenv()
# os.environ["MEM0_API_KEY"] = "your-mem0-api-key" # os.environ["MEM0_API_KEY"] = "your-mem0-api-key"
# Initialize LangChain and Mem0 # Initialize LangChain and Mem0
llm = ChatOpenAI(model="gpt-4o-mini") llm = ChatOpenAI(model="gpt-4.1-nano-2025-04-14")
mem0 = MemoryClient() mem0 = MemoryClient()
``` ```
+1 -1
View File
@@ -147,7 +147,7 @@ async def entrypoint(ctx: JobContext):
session = AgentSession( session = AgentSession(
stt=deepgram.STT(), 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",), tts=openai.TTS(voice="ash",),
turn_detection=EnglishModel(), turn_detection=EnglishModel(),
vad=silero.VAD.load(), vad=silero.VAD.load(),
+2 -2
View File
@@ -83,7 +83,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
}, },
@@ -116,7 +116,7 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
# os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>" # os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>"
llm = OpenAI(model="gpt-4o-mini") llm = OpenAI(model="gpt-4.1-nano-2025-04-14")
``` ```
### SimpleChatEngine ### SimpleChatEngine
+1 -1
View File
@@ -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-memorize tool to save important information that might be useful later.
Use the Mem0-remember tool to recall previously saved information when answering questions. 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 }, tools: { mem0RememberTool, mem0MemorizeTool },
}); });
``` ```
+4 -4
View File
@@ -63,7 +63,7 @@ agent = Agent(
Use the save_memory tool to store important information about the user. Use the save_memory tool to store important information about the user.
Always personalize your responses based on available memory.""", Always personalize your responses based on available memory.""",
tools=[search_memory, save_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: 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. understand the user's travel preferences and history before making recommendations.
After providing your response, use store_conversation to save important details.""", After providing your response, use store_conversation to save important details.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o" model="gpt-4.1-nano-2025-04-14"
) )
health_agent = Agent( health_agent = Agent(
@@ -123,7 +123,7 @@ health_agent = Agent(
understand the user's health goals and dietary preferences. understand the user's health goals and dietary preferences.
After providing advice, use store_conversation to save relevant information.""", After providing advice, use store_conversation to save relevant information.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o" model="gpt-4.1-nano-2025-04-14"
) )
# Triage agent with handoffs # 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 health-related questions (fitness, diet, wellness, exercise), hand off to the Health Advisor.
For general questions, handle them directly using available tools.""", For general questions, handle them directly using available tools.""",
handoffs=[travel_agent, health_agent], 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: def chat_with_handoffs(user_input: str, user_id: str) -> str:
+2 -2
View File
@@ -202,7 +202,7 @@ async def chat_with_memories(message: str, user_id: str = "default_user") -> str
# Generate assistant response # Generate assistant response
system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}" 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}] 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 assistant_response = response.choices[0].message.content
# Create new memories from the conversation # Create new memories from the conversation
@@ -249,7 +249,7 @@ async def handle_initialization_errors():
# Initialize with custom config # Initialize with custom config
config = MemoryConfig( config = MemoryConfig(
vector_store={"provider": "chroma", "config": {"path": "./chroma_db"}}, 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) memory = AsyncMemory(config=config)
print("AsyncMemory initialized successfully") print("AsyncMemory initialized successfully")
@@ -76,7 +76,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -27,7 +27,7 @@ messages = [
user_id = "alice" user_id = "alice"
chat_completion = client.chat.completions.create( chat_completion = client.chat.completions.create(
messages=messages, messages=messages,
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
user_id=user_id user_id=user_id
) )
# Memory saved after this will look like: "Loves Indian food. Allergic to cheese and cannot eat pizza." # 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( chat_completion = client.chat.completions.create(
messages=messages, messages=messages,
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
user_id=user_id user_id=user_id
) )
print(chat_completion.choices[0].message.content) print(chat_completion.choices[0].message.content)
@@ -73,7 +73,7 @@ chat_completion = client.chat.completions.create(
"content": "What's the capital of France?", "content": "What's the capital of France?",
} }
], ],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
``` ```
+8 -8
View File
@@ -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. 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. 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: Here's how you can do it:
@@ -100,7 +100,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -115,7 +115,7 @@ config = {
"llm" : { "llm" : {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.0, "temperature": 0.0,
} }
} }
@@ -130,7 +130,7 @@ const config = {
llm: { llm: {
provider: "openai", provider: "openai",
config: { config: {
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
temperature: 0.2, temperature: 0.2,
max_tokens: 2000, max_tokens: 2000,
} }
@@ -146,7 +146,7 @@ const config = {
llm: { llm: {
provider: "openai", provider: "openai",
config: { config: {
model: "gpt-4o-mini", model: "gpt-4.1-nano-2025-04-14",
temperature: 0.0, 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. 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. 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: 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. 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. 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: 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. 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. 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: Here's how you can do it:
+1 -1
View File
@@ -504,7 +504,7 @@ chat_completion = client.chat.completions.create(
"content": "What's the capital of France?", "content": "What's the capital of France?",
} }
], ],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
``` ```
@@ -20,7 +20,7 @@ os.environ["OPENAI_API_KEY"] = "your-api-key"
# Initialize a LangChain model directly # Initialize a LangChain model directly
openai_model = ChatOpenAI( openai_model = ChatOpenAI(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
temperature=0.2, temperature=0.2,
max_tokens=2000 max_tokens=2000
) )
+1 -1
View File
@@ -12,7 +12,7 @@ config = {
"llm": { "llm": {
"provider": "litellm", "provider": "litellm",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
+2 -2
View File
@@ -19,7 +19,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -85,7 +85,7 @@ config = {
"llm": { "llm": {
"provider": "openai_structured", "provider": "openai_structured",
"config": { "config": {
"model": "gpt-4o-2024-08-06", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.0, "temperature": 0.0,
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ ${memoriesStr}`;
]; ];
const response = await openaiClient.chat.completions.create({ const response = await openaiClient.chat.completions.create({
model: "gpt-4o-mini", model: "gpt-4.1-nano-2025-04-14",
messages: messages messages: messages
}); });
@@ -51,7 +51,7 @@ class CollaborativeAgent:
{"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"} {"role": "user", "content": f"Prompt: {prompt}\nContext:\n{context}"}
] ]
reply = client.chat.completions.create( reply = client.chat.completions.create(
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
messages=messages messages=messages
).choices[0].message.content.strip() ).choices[0].message.content.strip()
self.add_message("assistant", "assistant", reply) self.add_message("assistant", "assistant", reply)
+1 -1
View File
@@ -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_USER_ID= # Default: eliza-os-user
MEM0_PROVIDER= # Default: openai MEM0_PROVIDER= # Default: openai
MEM0_PROVIDER_API_KEY= # API Key for the provider (openai, anthropic, etc.) 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 MEDIUM_MEM0_MODEL= # Default: gpt-4o
LARGE_MEM0_MODEL= # Default: gpt-4o LARGE_MEM0_MODEL= # Default: gpt-4o
``` ```
+1 -1
View File
@@ -18,7 +18,7 @@ import os
from llama_index.llms.openai import OpenAI from llama_index.llms.openai import OpenAI
os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>" os.environ["OPENAI_API_KEY"] = "<your-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). 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).
@@ -81,7 +81,7 @@ class MultiAgentLearningSystem:
def __init__(self, student_id: str): def __init__(self, student_id: str):
self.student_id = student_id 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 # Memory context for this student
self.memory_context = {"user_id": student_id, "app": "learning_assistant"} self.memory_context = {"user_id": student_id, "app": "learning_assistant"}
+1 -1
View File
@@ -98,7 +98,7 @@ export const mem0Agent = new Agent({
instructions: ` instructions: `
You are a helpful assistant that has the ability to memorize and remember facts using Mem0. 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 }, tools: { mem0RememberTool, mem0MemorizeTool },
}); });
``` ```
+3 -3
View File
@@ -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. 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], tools=[save_memories, search_memories],
) )
@@ -171,7 +171,7 @@ def create_memory_voice_agent():
This function: This function:
- Creates an OpenAI Agent with specific instructions - 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 - Registers the memory-related tools with the agent
- Uses `prompt_with_handoff_instructions` to include standard voice agent behaviors - 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. 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], tools=[save_memories, search_memories],
) )
@@ -103,7 +103,7 @@ Preferences:
] ]
response = openai.chat.completions.create( response = openai.chat.completions.create(
model="gpt-4o-mini", model="gpt-4.1-nano-2025-04-14",
messages=messages messages=messages
) )
clean_response = response.choices[0].message.content.strip() clean_response = response.choices[0].message.content.strip()
+3 -3
View File
@@ -119,7 +119,7 @@ const carRecommendationTool = zodResponsesFunction({
// Use the tool in your OpenAI request // Use the tool in your OpenAI request
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, carRecommendationTool], tools: [{ type: "web_search_preview" }, carRecommendationTool],
input: `${getMemoryString(relevantMemories)}\n${userInput}`, input: `${getMemoryString(relevantMemories)}\n${userInput}`,
}); });
@@ -131,7 +131,7 @@ Combine memory with web search for up-to-date recommendations:
```javascript ```javascript
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, carRecommendationTool], tools: [{ type: "web_search_preview" }, carRecommendationTool],
input: `${getMemoryString(relevantMemories)}\n${userInput}`, input: `${getMemoryString(relevantMemories)}\n${userInput}`,
}); });
@@ -202,7 +202,7 @@ async function main(memory = false) {
} }
const response = await openAIClient.responses.create({ const response = await openAIClient.responses.create({
model: "gpt-4o", model: "gpt-4.1-nano-2025-04-14",
tools: [{ type: "web_search_preview" }, tool], tools: [{ type: "web_search_preview" }, tool],
input: `${getMemoryString(relevantMemories)}\n${input}`, input: `${getMemoryString(relevantMemories)}\n${input}`,
}); });
+1 -1
View File
@@ -57,7 +57,7 @@ class PersonalAITutor:
""" """
# Start a streaming response request to the AI # Start a streaming response request to the AI
response = self.client.responses.create( response = self.client.responses.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
instructions="You are a personal AI Tutor.", instructions="You are a personal AI Tutor.",
input=question, input=question,
stream=True stream=True
@@ -35,7 +35,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.1, "temperature": 0.1,
"max_tokens": 2000, "max_tokens": 2000,
} }
@@ -76,7 +76,7 @@ class PersonalTravelAssistant:
# Generate response using Responses API # Generate response using Responses API
response = self.client.responses.create( response = self.client.responses.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
input=prompt input=prompt
) )
@@ -140,9 +140,9 @@ class PersonalTravelAssistant:
prompt = f"User input: {question}\n Previous memories: {previous_memories}" prompt = f"User input: {question}\n Previous memories: {previous_memories}"
self.messages.append({"role": "user", "content": prompt}) 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( response = self.client.chat.completions.create(
model="gpt-4o", model="gpt-4.1-nano-2025-04-14"2025-04-14",
messages=self.messages messages=self.messages
) )
answer = response.choices[0].message.content answer = response.choices[0].message.content
+1 -1
View File
@@ -49,7 +49,7 @@ local_config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.1, "temperature": 0.1,
"max_tokens": 2000, "max_tokens": 2000,
}, },
+1 -1
View File
@@ -36,7 +36,7 @@ from agno.tools.mem0 import Mem0Tools
agent = Agent( agent = Agent(
name="Memory 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()], tools=[Mem0Tools()],
description="An assistant that remembers and personalizes using Mem0 memory." description="An assistant that remembers and personalizes using Mem0 memory."
) )
+2 -2
View File
@@ -55,7 +55,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.0, "temperature": 0.0,
"api_key": keywordsai_api_key, "api_key": keywordsai_api_key,
"openai_base_url": base_url, "openai_base_url": base_url,
@@ -101,7 +101,7 @@ messages = [
# Add memory and generate a response # Add memory and generate a response
response = client.chat.completions.create( response = client.chat.completions.create(
model="openai/gpt-4o", model="openai/gpt-4.1-nano",
messages=messages, messages=messages,
extra_body={ extra_body={
"mem0_params": { "mem0_params": {
+1 -1
View File
@@ -39,7 +39,7 @@ load_dotenv()
# os.environ["MEM0_API_KEY"] = "your-mem0-api-key" # os.environ["MEM0_API_KEY"] = "your-mem0-api-key"
# Initialize LangChain and Mem0 # Initialize LangChain and Mem0
llm = ChatOpenAI(model="gpt-4o-mini") llm = ChatOpenAI(model="gpt-4.1-nano-2025-04-14")
mem0 = MemoryClient() mem0 = MemoryClient()
``` ```
+1 -1
View File
@@ -147,7 +147,7 @@ async def entrypoint(ctx: JobContext):
session = AgentSession( session = AgentSession(
stt=deepgram.STT(), 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",), tts=openai.TTS(voice="ash",),
turn_detection=EnglishModel(), turn_detection=EnglishModel(),
vad=silero.VAD.load(), vad=silero.VAD.load(),
+2 -2
View File
@@ -83,7 +83,7 @@ config = {
"llm": { "llm": {
"provider": "openai", "provider": "openai",
"config": { "config": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"temperature": 0.2, "temperature": 0.2,
"max_tokens": 2000, "max_tokens": 2000,
}, },
@@ -116,7 +116,7 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
# os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>" # os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>"
llm = OpenAI(model="gpt-4o-mini") llm = OpenAI(model="gpt-4.1-nano-2025-04-14"2025-04-14")
``` ```
### SimpleChatEngine ### SimpleChatEngine
+1 -1
View File
@@ -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-memorize tool to save important information that might be useful later.
Use the Mem0-remember tool to recall previously saved information when answering questions. 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 }, tools: { mem0RememberTool, mem0MemorizeTool },
}); });
``` ```
+4 -4
View File
@@ -63,7 +63,7 @@ agent = Agent(
Use the save_memory tool to store important information about the user. Use the save_memory tool to store important information about the user.
Always personalize your responses based on available memory.""", Always personalize your responses based on available memory.""",
tools=[search_memory, save_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: 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. understand the user's travel preferences and history before making recommendations.
After providing your response, use store_conversation to save important details.""", After providing your response, use store_conversation to save important details.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o" model="gpt-4.1-nano-2025-04-14"
) )
health_agent = Agent( health_agent = Agent(
@@ -123,7 +123,7 @@ health_agent = Agent(
understand the user's health goals and dietary preferences. understand the user's health goals and dietary preferences.
After providing advice, use store_conversation to save relevant information.""", After providing advice, use store_conversation to save relevant information.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o" model="gpt-4.1-nano-2025-04-14"
) )
# Triage agent with handoffs # 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 health-related questions (fitness, diet, wellness, exercise), hand off to Health Advisor.
For general questions, you can handle them directly using available tools.""", For general questions, you can handle them directly using available tools.""",
handoffs=[travel_agent, health_agent], 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: def chat_with_handoffs(user_input: str, user_id: str) -> str:
+1 -1
View File
@@ -504,7 +504,7 @@ chat_completion = client.chat.completions.create(
"content": "What's the capital of France?", "content": "What's the capital of France?",
} }
], ],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
``` ```
+2 -2
View File
@@ -225,7 +225,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -239,7 +239,7 @@
" # Generate Assistant response\n", " # 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", " 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", " 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", " assistant_response = response.choices[0].message.content\n",
"\n", "\n",
" # Create new memories from the conversation\n", " # Create new memories from the conversation\n",
@@ -37,7 +37,7 @@ food_agent = Agent(
name="Personal Food Assistant", name="Personal Food Assistant",
description="Provides personalized food recommendations with memory and generates voice responses using Cartesia TTS tools.", description="Provides personalized food recommendations with memory and generates voice responses using Cartesia TTS tools.",
instructions=agent_instructions, instructions=agent_instructions,
model=OpenAIChat(id="gpt-4o"), model=OpenAIChat(id="gpt-4.1-nano-2025-04-14"),
tools=[CartesiaTools(voice_localize_enabled=True)], tools=[CartesiaTools(voice_localize_enabled=True)],
show_tool_calls=True, show_tool_calls=True,
) )
+2 -2
View File
@@ -1,6 +1,6 @@
""" """
Simple Fitness Memory Tracker that tracks your fitness progress and knows your health priorities. 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. 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" export OPENAI_API_KEY="your_openai_api_key"
@@ -18,7 +18,7 @@ USER_ID = "Anish"
agent = Agent( agent = Agent(
name="Fitness 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.", description="You are a helpful fitness assistant who remembers past logs and gives personalized suggestions for Anish's training and diet.",
markdown=True, markdown=True,
) )
+2 -2
View File
@@ -34,7 +34,7 @@ memory = MemoryClient()
# Research team models with specialized roles # Research team models with specialized roles
RESEARCH_TEAM = { RESEARCH_TEAM = {
"tech_analyst": { "tech_analyst": {
"model": "gpt-4o", "model": "gpt-4.1-nano-2025-04-14",
"role": "Technical Analyst - Code review, architecture, and technical decisions", "role": "Technical Analyst - Code review, architecture, and technical decisions",
}, },
"writer": { "writer": {
@@ -42,7 +42,7 @@ RESEARCH_TEAM = {
"role": "Documentation Writer - Clear explanations and user guides", "role": "Documentation Writer - Clear explanations and user guides",
}, },
"data_analyst": { "data_analyst": {
"model": "gpt-4o-mini", "model": "gpt-4.1-nano-2025-04-14",
"role": "Data Analyst - Insights, trends, and data-driven recommendations", "role": "Data Analyst - Insights, trends, and data-driven recommendations",
}, },
} }
+1 -1
View File
@@ -21,7 +21,7 @@ client = MemoryClient()
# Define the agent # Define the agent
agent = Agent( agent = Agent(
name="Personal 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." description="You are a helpful personal agent that helps me with day to day activities."
"You can process both text and images.", "You can process both text and images.",
markdown=True, markdown=True,
+1 -1
View File
@@ -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): def setup_user_history(user_id):
+3 -3
View File
@@ -35,7 +35,7 @@ travel_agent = Agent(
understand the user's travel preferences and history before making recommendations. understand the user's travel preferences and history before making recommendations.
After providing your response, use store_conversation to save important details.""", After providing your response, use store_conversation to save important details.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
health_agent = Agent( health_agent = Agent(
@@ -44,7 +44,7 @@ health_agent = Agent(
understand the user's health goals and dietary preferences. understand the user's health goals and dietary preferences.
After providing advice, use store_conversation to save relevant information.""", After providing advice, use store_conversation to save relevant information.""",
tools=[search_memory, save_memory], tools=[search_memory, save_memory],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
# Triage agent with handoffs # 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 health-related questions (fitness, diet, wellness, exercise), hand off to Health Advisor.
For general questions, you can handle them directly using available tools.""", For general questions, you can handle them directly using available tools.""",
handoffs=[travel_agent, health_agent], handoffs=[travel_agent, health_agent],
model="gpt-4o", model="gpt-4.1-nano-2025-04-14",
) )
@@ -42,7 +42,7 @@ class MultiAgentLearningSystem:
def __init__(self, student_id: str): def __init__(self, student_id: str):
self.student_id = student_id 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 # Memory context for this student
self.memory_context = {"user_id": student_id, "app": "learning_assistant"} self.memory_context = {"user_id": student_id, "app": "learning_assistant"}
@@ -172,7 +172,7 @@ export const useChat = ({ user, mem0ApiKey, openaiApiKey }: UseChatProps): UseCh
} }
const completion = await openai.chat.completions.create({ 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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error // @ts-expect-error
messages: messagesForLLM.map(msg => ({ messages: messagesForLLM.map(msg => ({
+1 -1
View File
@@ -172,7 +172,7 @@ export const useChat = ({ user, mem0ApiKey, openaiApiKey }: UseChatProps): UseCh
} }
const completion = await openai.chat.completions.create({ 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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error // @ts-expect-error
messages: messagesForLLM.map(msg => ({ messages: messagesForLLM.map(msg => ({
+1 -1
View File
@@ -11,7 +11,7 @@ export class OpenAILLM implements LLM {
apiKey: config.apiKey, apiKey: config.apiKey,
baseURL: config.baseURL, baseURL: config.baseURL,
}); });
this.model = config.model || "gpt-4o-mini"; this.model = config.model || "gpt-4.1-nano-2025-04-14";
} }
async generateResponse( async generateResponse(
+1 -1
View File
@@ -29,7 +29,7 @@ class BaseLlmConfig(ABC):
Initialize a base configuration class instance for the LLM. Initialize a base configuration class instance for the LLM.
Args: 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) Defaults to None (will be set by provider-specific configs)
temperature: Controls the randomness of the model's output. temperature: Controls the randomness of the model's output.
Higher values (closer to 1) make output more random, lower values make it more deterministic. Higher values (closer to 1) make output more random, lower values make it more deterministic.
+1 -1
View File
@@ -38,7 +38,7 @@ class AzureOpenAILLM(LLMBase):
# Model name should match the custom deployment name chosen for it. # Model name should match the custom deployment name chosen for it.
if not self.config.model: 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") 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") azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT")
+1 -1
View File
@@ -16,7 +16,7 @@ class AzureOpenAIStructuredLLM(LLMBase):
# Model name should match the custom deployment name chosen for it. # Model name should match the custom deployment name chosen for it.
if not self.config.model: 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") 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") azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT")
+1 -1
View File
@@ -16,7 +16,7 @@ class LiteLLM(LLMBase):
super().__init__(config) super().__init__(config)
if not self.config.model: 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): def _parse_response(self, response, tools):
""" """
+1 -1
View File
@@ -35,7 +35,7 @@ class OpenAILLM(LLMBase):
super().__init__(config) super().__init__(config)
if not self.config.model: 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 if os.environ.get("OPENROUTER_API_KEY"): # Use OpenRouter
self.client = OpenAI( self.client = OpenAI(
+1 -1
View File
@@ -50,7 +50,7 @@ DEFAULT_CONFIG = {
"provider": "neo4j", "provider": "neo4j",
"config": {"url": NEO4J_URI, "username": NEO4J_USERNAME, "password": NEO4J_PASSWORD}, "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"}}, "embedder": {"provider": "openai", "config": {"api_key": OPENAI_API_KEY, "model": "text-embedding-3-small"}},
"history_db_path": HISTORY_DB_PATH, "history_db_path": HISTORY_DB_PATH,
} }
+3 -3
View File
@@ -5,7 +5,7 @@ import pytest
from mem0.configs.llms.azure import AzureOpenAIConfig from mem0.configs.llms.azure import AzureOpenAIConfig
from mem0.llms.azure_openai import AzureOpenAILLM 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 TEMPERATURE = 0.7
MAX_TOKENS = 100 MAX_TOKENS = 100
TOP_P = 1.0 TOP_P = 1.0
@@ -191,8 +191,8 @@ def test_init_with_env_vars(monkeypatch):
http_client=None, http_client=None,
default_headers=None, default_headers=None,
) )
# Should default to "gpt-4o" if model is None # Should default to "gpt-4.1-nano-2025-04-14" if model is None
assert llm.config.model == "gpt-4o" assert llm.config.model == "gpt-4.1-nano-2025-04-14"
def test_init_with_default_azure_credential(monkeypatch): def test_init_with_default_azure_credential(monkeypatch):
+2 -2
View File
@@ -56,7 +56,7 @@ def test_init_with_default_credential(mock_credential, mock_token_provider, mock
mock_token_provider.return_value = "token-provider" mock_token_provider.return_value = "token-provider"
llm = AzureOpenAIStructuredLLM(config) llm = AzureOpenAIStructuredLLM(config)
# Should set default model if not provided # 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_credential.assert_called_once()
mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE) mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE)
mock_azure_openai.assert_called_once() 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")) config = DummyConfig(model=None, azure_kwargs=DummyAzureKwargs(api_key="your-api-key"))
mock_token_provider.return_value = "token-provider" mock_token_provider.return_value = "token-provider"
llm = AzureOpenAIStructuredLLM(config) 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_credential.assert_called_once()
mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE) mock_token_provider.assert_called_once_with(mock_credential.return_value, SCOPE)
mock_azure_openai.assert_called_once() mock_azure_openai.assert_called_once()
+4 -4
View File
@@ -24,7 +24,7 @@ def test_generate_response_with_unsupported_model(mock_litellm):
def test_generate_response_without_tools(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) llm = litellm.LiteLLM(config)
messages = [ messages = [
{"role": "system", "content": "You are a helpful assistant."}, {"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) response = llm.generate_response(messages)
mock_litellm.completion.assert_called_once_with( 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!" assert response == "I'm doing well, thank you for asking!"
def test_generate_response_with_tools(mock_litellm): 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) llm = litellm.LiteLLM(config)
messages = [ messages = [
{"role": "system", "content": "You are a helpful assistant."}, {"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) response = llm.generate_response(messages, tools=tools)
mock_litellm.completion.assert_called_once_with( 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." assert response["content"] == "I've added the memory for you."
+11 -11
View File
@@ -17,7 +17,7 @@ def mock_openai_client():
def test_openai_llm_base_url(): def test_openai_llm_base_url():
# case1: default config: with openai official 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) llm = OpenAILLM(config)
# Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash # 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/" 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 # case2: with env variable OPENAI_API_BASE
provider_base_url = "https://api.provider.com/v1" provider_base_url = "https://api.provider.com/v1"
os.environ["OPENAI_BASE_URL"] = provider_base_url 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) llm = OpenAILLM(config)
# Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash # 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 + "/" 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 # case3: with config.openai_base_url
config_base_url = "https://api.config.com/v1" config_base_url = "https://api.config.com/v1"
config = OpenAIConfig( 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) llm = OpenAILLM(config)
# Note: openai client will parse the raw base_url into a URL object, which will have a trailing slash # 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): 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) llm = OpenAILLM(config)
messages = [ messages = [
{"role": "system", "content": "You are a helpful assistant."}, {"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) response = llm.generate_response(messages)
mock_openai_client.chat.completions.create.assert_called_once_with( 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!" assert response == "I'm doing well, thank you for asking!"
def test_generate_response_with_tools(mock_openai_client): 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) llm = OpenAILLM(config)
messages = [ messages = [
{"role": "system", "content": "You are a helpful assistant."}, {"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) response = llm.generate_response(messages, tools=tools)
mock_openai_client.chat.completions.create.assert_called_once_with( 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." 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 # Setup mock callback
mock_callback = Mock() 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) llm = OpenAILLM(config)
messages = [{"role": "user", "content": "Test callback"}] 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): 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) llm = OpenAILLM(config)
messages = [{"role": "user", "content": "Test no callback"}] messages = [{"role": "user", "content": "Test no callback"}]
@@ -153,7 +153,7 @@ def test_callback_exception_handling(mock_openai_client):
def faulty_callback(*args): def faulty_callback(*args):
raise ValueError("Callback error") 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) llm = OpenAILLM(config)
messages = [{"role": "user", "content": "Test exception"}] 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): def test_callback_with_tools(mock_openai_client):
mock_callback = Mock() 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) llm = OpenAILLM(config)
messages = [{"role": "user", "content": "Test tools"}] messages = [{"role": "user", "content": "Test tools"}]
tools = [ tools = [
+3 -3
View File
@@ -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.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]}
mock_litellm.supports_function_calling.return_value = True 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.add.assert_called_once()
mock_memory_client.search.assert_called_once() mock_memory_client.search.assert_called_once()
mock_litellm.completion.assert_called_once() mock_litellm.completion.assert_called_once()
call_args = mock_litellm.completion.call_args[1] 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 len(call_args["messages"]) == 2
assert call_args["temperature"] == 0.7 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.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]}
mock_litellm.supports_function_calling.return_value = True 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] call_args = mock_litellm.completion.call_args[1]
assert call_args["messages"][0]["role"] == "system" assert call_args["messages"][0]["role"] == "system"