Skip to content

Building AI agents, atomically

Modify examples

KennyVaneetvelde818862dd8361
diff --git a/examples/basic_custom_chatbot.py b/examples/basic_custom_chatbot.py
index 10f4c23..ade8e71 100644
--- a/examples/basic_custom_chatbot.py
+++ b/examples/basic_custom_chatbot.py
@@ -6,12 +6,12 @@ import os
from rich.console import Console
from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig
-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
+from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
import instructor
import openai
# Define system prompt information including background, steps, and output instructions
-system_prompt = SystemPromptInfo(
+system_prompt_generator = SystemPromptGenerator(
background=[
'This assistant is a general-purpose AI designed to be helpful and friendly.',
],
@@ -25,8 +25,6 @@ system_prompt = SystemPromptInfo(
'Always answer in rhyming verse.'
]
)
-# Initialize the system prompt generator with the defined system prompt and dynamic info providers
-system_prompt_generator = SystemPromptGenerator(system_prompt)
# Initialize chat memory to store conversation history
memory = AgentMemory()
diff --git a/examples/conversing_agents.py b/examples/conversing_agents.py
index f6b76e8..97b5974 100644
--- a/examples/conversing_agents.py
+++ b/examples/conversing_agents.py
@@ -6,16 +6,16 @@ import instructor
import openai
from rich.console import Console
from atomic_agents.agents.base_agent import BaseAgentConfig, BaseAgent, BaseAgentInputSchema, BaseAgentOutputSchema
-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
+from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
# Initialize the system prompts. For simplicity, we use the same system prompt for both agents.
-agent1_system_prompt_info = SystemPromptInfo(
+agent1_system_prompt_generator = SystemPromptGenerator(
background=['You are an agent that adds 1 to the number said by the previous person in the conversation.'],
steps=['If the previous message contains a number, add 1 to it.'],
output_instructions=['Respond with only the resulting added number and never anything else. Do not include any additional text.']
)
-agent2_system_prompt_info = SystemPromptInfo(
+agent2_system_prompt_generator = SystemPromptGenerator(
background=['You are an agent that adds 1 to the number said by the previous person in the conversation.'],
steps=['If the previous message contains a number, add 1 to it.'],
output_instructions=['Respond with only the resulting added number and never anything else. Do not include any additional text.']
@@ -27,15 +27,15 @@ agent1 = BaseAgent(
config=BaseAgentConfig(
client=instructor.from_groq(groq.Groq(api_key=os.getenv('GROQ_API_KEY'))),
model=os.getenv('GROQ_CHAT_MODEL'),
- system_prompt_generator=SystemPromptGenerator(system_prompt_info=agent1_system_prompt_info)
+ system_prompt_generator=agent1_system_prompt_generator
)
)
agent2 = BaseAgent(
config=BaseAgentConfig(
client=instructor.from_openai(openai.OpenAI()),
- model='gpt-3.5-turbo',
- system_prompt_generator=SystemPromptGenerator(system_prompt_info=agent2_system_prompt_info)
+ model='gpt-4o-mini',
+ system_prompt_generator=agent2_system_prompt_generator
)
)
diff --git a/examples/mesop_example.py b/examples/mesop_example.py
index ce9a3bb..f096d1c 100644
--- a/examples/mesop_example.py
+++ b/examples/mesop_example.py
@@ -32,7 +32,7 @@ searxng_tool = initialize_searxng_tool()
def initialize_agent(client, searxng_tool):
agent_config = ToolInterfaceAgentConfig(
client=client,
- model='gpt-3.5-turbo',
+ model='gpt-4o-mini',
tool_instance=searxng_tool,
return_raw_output=False
)
@@ -56,7 +56,7 @@ def transform(input: str, history: list[mel.ChatMessage]):
# Mesop page
@me.page(
- path="/chat",
+ path="/",
title="ToolInterfaceAgent Chat"
)
def page():