[Update] Default LLM (#3587)
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -20,7 +20,7 @@ import os
|
||||
from llama_index.llms.openai import OpenAI
|
||||
|
||||
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).
|
||||
|
||||
@@ -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"}
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
```
|
||||
|
||||
@@ -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],
|
||||
)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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}`,
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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."
|
||||
)
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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()
|
||||
```
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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"] = "<your-openai-api-key>"
|
||||
llm = OpenAI(model="gpt-4o-mini")
|
||||
llm = OpenAI(model="gpt-4.1-nano-2025-04-14")
|
||||
```
|
||||
|
||||
### SimpleChatEngine
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ import os
|
||||
from llama_index.llms.openai import OpenAI
|
||||
|
||||
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).
|
||||
|
||||
@@ -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"}
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
```
|
||||
|
||||
@@ -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],
|
||||
)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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}`,
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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."
|
||||
)
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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()
|
||||
```
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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"] = "<your-openai-api-key>"
|
||||
llm = OpenAI(model="gpt-4o-mini")
|
||||
llm = OpenAI(model="gpt-4.1-nano-2025-04-14"2025-04-14")
|
||||
```
|
||||
|
||||
### SimpleChatEngine
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user