Building AI agents, atomically
For consistent naming, Changed BaseChatResponseSchema to BaseChatInputSchema Changed ResponseSchema to OutputSchema
w3bwizar60578cfd88f0
diff --git a/atomic_agents/agents/base_chat_agent.py b/atomic_agents/agents/base_chat_agent.pyindex a3ad659..fee1f66 100644--- a/atomic_agents/agents/base_chat_agent.py+++ b/atomic_agents/agents/base_chat_agent.py@@ -33,7 +33,7 @@ class BaseChatAgentInputSchema(BaseAgentIO):"description": description,}-class BaseChatAgentResponseSchema(BaseAgentIO):+class BaseChatAgentOutputSchema(BaseAgentIO):chat_message: str = Field(...,description='The chat message exchanged between the user and the chat agent. '@@ -41,7 +41,7 @@ class BaseChatAgentResponseSchema(BaseAgentIO):)class Config:- title = 'BaseChatAgentResponseSchema'+ title = 'BaseChatAgentOutputSchema'description = 'This schema represents the response message exchanged between the user and the chat agent.'json_schema_extra = {"title": title,@@ -76,7 +76,7 @@ class BaseChatAgent:initial_memory (ChatMemory): Initial state of the memory."""input_schema = BaseChatAgentInputSchema- output_schema = BaseChatAgentResponseSchema+ output_schema = BaseChatAgentOutputSchemadef __init__(self, config: BaseChatAgentConfig = BaseChatAgentConfig(client=instructor.from_openai(openai.OpenAI()))):"""diff --git a/docs/api/atomic_agents/agents/base_chat_agent.md b/docs/api/atomic_agents/agents/base_chat_agent.mdindex 0822823..f0cc0fd 100644--- a/docs/api/atomic_agents/agents/base_chat_agent.md+++ b/docs/api/atomic_agents/agents/base_chat_agent.md@@ -20,7 +20,7 @@- [BaseChatAgent().unregister_context_provider](#basechatagent()unregister_context_provider)- [BaseChatAgentConfig](#basechatagentconfig)- [BaseChatAgentInputSchema](#basechatagentinputschema)- - [BaseChatAgentResponseSchema](#basechatagentresponseschema)+ - [BaseChatAgentOutputSchema](#basechatagentoutputschema)## BaseAgentIO@@ -306,14 +306,14 @@ class BaseChatAgentInputSchema(BaseAgentIO): ...-## BaseChatAgentResponseSchema+## BaseChatAgentOutputSchema[Show source in base_chat_agent.py:36](../../../../atomic_agents/agents/base_chat_agent.py#L36)#### Signature```python-class BaseChatAgentResponseSchema(BaseAgentIO): ...+class BaseChatAgentOutputSchema(BaseAgentIO): ...```#### See alsodiff --git a/examples/conversing_agents.py b/examples/conversing_agents.pyindex 61a7856..3040461 100644--- a/examples/conversing_agents.py+++ b/examples/conversing_agents.py@@ -5,7 +5,7 @@ import groqimport instructorimport openaifrom rich.console import Console-from atomic_agents.agents.base_chat_agent import BaseChatAgentConfig, BaseChatAgent, BaseChatAgentInputSchema, BaseChatAgentResponseSchema+from atomic_agents.agents.base_chat_agent import BaseChatAgentConfig, BaseChatAgent, BaseChatAgentInputSchema, BaseChatAgentOutputSchemafrom atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo# Initialize the system prompts. For simplicity, we use the same system prompt for both agents.diff --git a/examples/notebooks/what_is_atomic_agents.ipynb b/examples/notebooks/what_is_atomic_agents.ipynbindex 443e92d..a3f44f3 100644--- a/examples/notebooks/what_is_atomic_agents.ipynb+++ b/examples/notebooks/what_is_atomic_agents.ipynb@@ -324,7 +324,7 @@" \"description\": description,\n"," }\n","\n",- "class BaseChatAgentResponseSchema(BaseAgentIO):\n",+ "class BaseChatAgentOutputSchema(BaseAgentIO):\n"," chat_message: str = Field(\n"," ...,\n"," description='The chat message exchanged between the user and the chat agent. '\n",@@ -332,7 +332,7 @@" )\n","\n"," class Config:\n",- " title = 'BaseChatAgentResponseSchema'\n",+ " title = 'BaseChatAgentOutputSchema'\n"," description = 'This schema represents the response message exchanged between the user and the chat agent.'\n"," json_schema_extra = {\n"," \"title\": title,\n",@@ -360,7 +360,7 @@"source": ["import json\n","\n",- "print(json.dumps(BaseChatAgentResponseSchema.model_json_schema(), indent=2))"+ "print(json.dumps(BaseChatAgentOutputSchema.model_json_schema(), indent=2))"]},{@@ -382,7 +382,7 @@" \"required\": [\n"," \"chat_message\"\n"," ],\n",- " \"title\": \"BaseChatAgentResponseSchema\",\n",+ " \"title\": \"BaseChatAgentOutputSchema\",\n"," \"type\": \"object\"\n","}\n","```\n",diff --git a/examples/notebooks/yelp_agent.ipynb b/examples/notebooks/yelp_agent.ipynbindex 186f90a..6c22891 100644--- a/examples/notebooks/yelp_agent.ipynb+++ b/examples/notebooks/yelp_agent.ipynb@@ -69,7 +69,7 @@"\n","from atomic_agents.lib.components.chat_memory import ChatMemory\n","from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo\n",- "from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentResponseSchema, BaseChatAgentConfig\n",+ "from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfig\n","from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema"]},@@ -194,10 +194,10 @@"source": ["# Define a custom response schema that can handle both chat responses and Yelp search tool responses\n","class ResponseSchema(BaseModel):\n",- " chosen_schema: Union[BaseChatAgentResponseSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')\n",+ " chosen_schema: Union[BaseChatAgentOutputSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')\n","\n"," class Config:\n",- " title = 'ResponseSchema'\n",+ " title = 'OutputSchema'\n"," description = 'The response schema for the chat agent.'\n"," json_schema_extra = {\n"," 'title': title,\n",@@ -227,7 +227,7 @@" system_prompt_generator=system_prompt_generator,\n"," model='gpt-3.5-turbo',\n"," memory=memory,\n",- " output_schema=ResponseSchema\n",+ " output_schema=OutputSchema\n"," )\n",")\n","\n",diff --git a/examples/product_finder.py b/examples/product_finder.pyindex 9509324..0570ee9 100644--- a/examples/product_finder.py+++ b/examples/product_finder.py@@ -8,7 +8,7 @@ from rich.console import Consolefrom atomic_agents.lib.components.chat_memory import ChatMemoryfrom atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo-from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentResponseSchema, BaseChatAgentConfig+from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfigfrom atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig, SearxNGSearchToolSchema# Configure logging@@ -53,11 +53,11 @@ client = instructor.from_openai(openai.OpenAI())searx_tool = SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=5))# Define a custom response schema-class ResponseSchema(BaseModel):- chosen_schema: Union[BaseChatAgentResponseSchema, SearxNGSearchToolSchema] = Field(..., description='The response from the chat agent.')+class OutputSchema(BaseModel):+ chosen_schema: Union[BaseChatAgentOutputSchema, SearxNGSearchToolSchema] = Field(..., description='The response from the chat agent.')class Config:- title = 'ResponseSchema'+ title = 'OutputSchema'description = 'The response schema for the chat agent.'# Create a config for the chat agent@@ -66,7 +66,7 @@ agent_config = BaseChatAgentConfig(system_prompt_generator=system_prompt_generator,model='gpt-3.5-turbo',memory=memory,- output_schema=ResponseSchema+ output_schema=OutputSchema)# Create a chat agentdiff --git a/examples/yelp_restaurant_finder.py b/examples/yelp_restaurant_finder.pyindex e273a55..96a4206 100644--- a/examples/yelp_restaurant_finder.py+++ b/examples/yelp_restaurant_finder.py@@ -8,7 +8,7 @@ from rich.console import Consolefrom atomic_agents.lib.components.chat_memory import ChatMemoryfrom atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo-from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentResponseSchema, BaseChatAgentConfig+from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfigfrom atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema# Configure logging@@ -56,11 +56,11 @@ client = instructor.from_openai(openai.OpenAI())yelp_tool = YelpSearchTool(YelpSearchToolConfig(api_key=os.getenv('YELP_API_KEY'), max_results=10))# Define a custom response schema that can handle both chat responses and Yelp search tool responses-class ResponseSchema(BaseModel):- chosen_schema: Union[BaseChatAgentResponseSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')+class OutputSchema(BaseModel):+ chosen_schema: Union[BaseChatAgentOutputSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')class Config:- title = 'ResponseSchema'+ title = 'OutputSchema'description = 'The response schema for the chat agent.'json_schema_extra = {'title': title,@@ -73,7 +73,7 @@ agent_config = BaseChatAgentConfig(system_prompt_generator=system_prompt_generator,model='gpt-3.5-turbo',memory=memory,- output_schema=ResponseSchema+ output_schema=OutputSchema)# Create a chat agent with the specified config