Building AI agents, atomically
Streamlining configs
KennyVaneetvelde8b876feeedea
diff --git a/atomic_agents/agents/base_chat_agent.py b/atomic_agents/agents/base_chat_agent.pyindex d0e633c..822982d 100644--- a/atomic_agents/agents/base_chat_agent.py+++ b/atomic_agents/agents/base_chat_agent.py@@ -2,43 +2,44 @@ from typing import List, Optional, Typeimport instructorimport openaifrom pydantic import BaseModel, Field+from rich.json import JSON+from atomic_agents.lib.components.chat_memory import ChatMemory-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator+from atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGeneratorclass BaseAgentIO(BaseModel):"""Base class for input and output schemas for chat agents."""- def stringify(self):- raise NotImplementedError+ def __str__(self):+ return self.model_dump_json()++ def __rich__(self):+ json_str = self.model_dump_json()+ return JSON(json_str)# Input and Response Schemasclass BaseChatAgentInputSchema(BaseAgentIO):chat_input: str = Field(..., description='The input text for the chat agent.')-- def stringify(self):- return self.chat_input-class BaseChatAgentResponse(BaseAgentIO):+class BaseChatAgentResponseSchema(BaseAgentIO):response: str = Field(..., description='The markdown-enabled response from the chat agent.')class Config:- title = 'BaseChatAgentResponse'+ title = 'BaseChatAgentResponseSchema'description = 'Response from the base chat agent. The response can be in markdown format. This response is the only thing the user will see in the chat interface.'json_schema_extra = {'title': title,'description': description}-- def stringify(self):- return self.responseclass BaseChatAgentConfig(BaseModel):client: instructor.client.Instructor = Field(..., description='Client for interacting with the language model.')model: str = Field("gpt-3.5-turbo", description='The model to use for generating responses.')memory: Optional[ChatMemory] = Field(None, description='Memory component for storing chat history.')system_prompt_generator: Optional[SystemPromptGenerator] = Field(None, description='Component for generating system prompts.')- output_schema: Type[BaseModel] = Field(BaseChatAgentResponse, description='Schema for the output data.')+ input_schema: Optional[Type[BaseModel]] = Field(None, description='The schema for the input data.')+ output_schema: Optional[Type[BaseModel]] = Field(None, description='The schema for the output data.')class Config:arbitrary_types_allowed = True@@ -60,6 +61,7 @@ class BaseChatAgent:initial_memory (ChatMemory): Initial state of the memory."""input_schema = BaseChatAgentInputSchema+ output_schema = BaseChatAgentResponseSchemadef __init__(self, config: BaseChatAgentConfig = BaseChatAgentConfig(client=instructor.from_openai(openai.OpenAI()))):"""@@ -68,7 +70,8 @@ class BaseChatAgent:Args:config (BaseChatAgentConfig): Configuration for the chat agent."""- self.output_schema = config.output_schema+ self.input_schema = config.input_schema or self.input_schema+ self.output_schema = config.output_schema or self.output_schemaself.client = config.clientself.model = config.modelself.memory = config.memory or ChatMemory()@@ -147,7 +150,7 @@ class BaseChatAgent:user_input (str): The input text from the user."""self.current_user_input = user_input- self.memory.add_message('user', user_input.stringify())+ self.memory.add_message('user', str(user_input))def _pre_run(self):"""@@ -162,4 +165,21 @@ class BaseChatAgent:Args:response (Type[BaseModel]): The response from the chat agent."""- self.memory.add_message('assistant', response.model_dump_json())\ No newline at end of file+ self.memory.add_message('assistant', str(response))++ def get_context_provider(self, provider_name: str) -> Type[SystemPromptContextProviderBase]:+ """+ Retrieves a context provider by name.++ Args:+ provider_name (str): The name of the context provider.++ Returns:+ SystemPromptContextProviderBase: The context provider if found.++ Raises:+ KeyError: If the context provider is not found.+ """+ if provider_name not in self.system_prompt_generator.system_prompt_info.context_providers:+ raise KeyError(f"Context provider '{provider_name}' not found.")+ return self.system_prompt_generator.system_prompt_info.context_providers[provider_name]diff --git a/atomic_agents/agents/tool_interface_agent.py b/atomic_agents/agents/tool_interface_agent.pyindex e32371b..7853491 100644--- a/atomic_agents/agents/tool_interface_agent.py+++ b/atomic_agents/agents/tool_interface_agent.py@@ -20,9 +20,6 @@ class ToolInputModel(BaseAgentIO):"description": "Default tool description"}- def stringify(self):- return self.tool_input-class ToolInterfaceAgent(BaseChatAgent):"""A specialized chat agent designed to interact with a specific tool.diff --git a/atomic_agents/lib/components/chat_memory.py b/atomic_agents/lib/components/chat_memory.pyindex 4aadd6a..c0d96ed 100644--- a/atomic_agents/lib/components/chat_memory.py+++ b/atomic_agents/lib/components/chat_memory.py@@ -31,13 +31,13 @@ class ChatMemory:"""self.history: List[Message] = []- def add_message(self, role: str, content: Union[str, Dict], tool_message: Optional[Dict] = None, tool_id: Optional[str] = None) -> None:+ def add_message(self, role: str, content: str, tool_message: Optional[Dict] = None, tool_id: Optional[str] = None) -> None:"""Adds a message to the chat history.Args:role (str): The role of the message sender.- content (Union[str, Dict]): The content of the message.+ content (str): The content of the message.tool_message (Optional[Dict]): Optional tool message to be included.tool_id (Optional[str]): Optional unique identifier for the tool call."""diff --git a/atomic_agents/lib/models/web_document.py b/atomic_agents/lib/models/web_document.pyindex ec1fb98..4fdd606 100644--- a/atomic_agents/lib/models/web_document.py+++ b/atomic_agents/lib/models/web_document.py@@ -1,5 +1,7 @@from pydantic import BaseModel, Field+from atomic_agents.agents.base_chat_agent import BaseAgentIO+class WebDocumentMetadata(BaseModel):url: strtitle: str = Field(default='')@@ -7,7 +9,7 @@ class WebDocumentMetadata(BaseModel):keywords: str = Field(default='')author: str = Field(default='')-class WebDocument(BaseModel):+class WebDocument(BaseAgentIO):content: strmetadata: WebDocumentMetadata = Field(default_factory=WebDocumentMetadata)diff --git a/atomic_agents/lib/tools/calculator_tool.py b/atomic_agents/lib/tools/calculator_tool.pyindex 38edb73..8495078 100644--- a/atomic_agents/lib/tools/calculator_tool.py+++ b/atomic_agents/lib/tools/calculator_tool.py@@ -1,15 +1,14 @@-import os-import openai-from pydantic import BaseModel, Field+from pydantic import Fieldfrom sympy import sympify-import instructor+from rich.console import Console+from atomic_agents.agents.base_chat_agent import BaseAgentIOfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfig################# INPUT SCHEMA #################-class CalculatorToolSchema(BaseModel):+class CalculatorToolSchema(BaseAgentIO):expression: str = Field(..., description="Mathematical expression to evaluate. For example, '2 + 2'.")class Config:@@ -23,9 +22,10 @@ class CalculatorToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class CalculatorToolOutputSchema(BaseModel):+class CalculatorToolOutputSchema(BaseAgentIO):result: str = Field(..., description="Result of the calculation.")+############### TOOL LOGIC ###############@@ -79,4 +79,5 @@ class CalculatorTool(BaseTool):# EXAMPLE USAGE ##################if __name__ == "__main__":- print(CalculatorTool().run(CalculatorToolSchema(expression="2 + 2")))\ No newline at end of file+ rich_console = Console()+ rich_console.print(CalculatorTool().run(CalculatorToolSchema(expression="2 + 2")))diff --git a/atomic_agents/lib/tools/content_scraping_tool.py b/atomic_agents/lib/tools/content_scraping_tool.pyindex 5ded932..79240ea 100644--- a/atomic_agents/lib/tools/content_scraping_tool.py+++ b/atomic_agents/lib/tools/content_scraping_tool.py@@ -6,6 +6,7 @@ import openaiimport instructorimport requests+from atomic_agents.agents.base_chat_agent import BaseAgentIOfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfigfrom atomic_agents.lib.utils.scraping.url_to_markdown import UrlToMarkdownConverterfrom atomic_agents.lib.utils.scraping.pdf_to_markdown import PdfToMarkdownConverter@@ -13,7 +14,7 @@ from atomic_agents.lib.utils.scraping.pdf_to_markdown import PdfToMarkdownConver################# INPUT SCHEMA #################-class ContentScrapingToolSchema(BaseModel):+class ContentScrapingToolSchema(BaseAgentIO):url: str = Field(..., description="URL of the web page or PDF to scrape.")class Config:@@ -27,12 +28,10 @@ class ContentScrapingToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class ContentScrapingResultSchema(BaseModel):+class ContentScrapingToolOutputSchema(BaseAgentIO):content: strmetadata: Optional[dict] = None--class ContentScrapingToolOutputSchema(BaseModel):- result: ContentScrapingResultSchema+############### TOOL LOGIC #@@ -79,8 +78,7 @@ class ContentScrapingTool(BaseTool):else:document = UrlToMarkdownConverter.convert(url=url)- result = ContentScrapingResultSchema(content=document.content, metadata=document.metadata.model_dump())- return ContentScrapingToolOutputSchema(result=result)+ return ContentScrapingToolOutputSchema(content=document.content, metadata=document.metadata.model_dump())################## EXAMPLE USAGE #@@ -105,7 +103,7 @@ if __name__ == "__main__":)output = ContentScrapingTool().run(result)- rich_console.print(f"Content: {output.result.content}, Metadata: {output.result.metadata}")+ rich_console.print(output)################# TEST PDF URL #@@ -117,4 +115,4 @@ if __name__ == "__main__":)output = ContentScrapingTool().run(result)- rich_console.print(f"Content: {output.result.content}, Metadata: {output.result.metadata}")\ No newline at end of file+ rich_console.print(output)\ No newline at end of filediff --git a/atomic_agents/lib/tools/search/searx_tool.py b/atomic_agents/lib/tools/search/searx_tool.pyindex be9285b..5bc9aa8 100644--- a/atomic_agents/lib/tools/search/searx_tool.py+++ b/atomic_agents/lib/tools/search/searx_tool.py@@ -4,12 +4,13 @@ from pydantic import BaseModel, Fieldfrom typing import List, Literal, Optionalfrom rich.console import Console+from atomic_agents.agents.base_chat_agent import BaseAgentIOfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfig################# INPUT SCHEMA #################-class SearxNGSearchToolSchema(BaseModel):+class SearxNGSearchToolSchema(BaseAgentIO):queries: List[str] = Field(..., description="List of search queries.")category: Optional[Literal["general", "news", "social_media"]] = Field(None, description="Category of the search queries.")@@ -24,14 +25,15 @@ class SearxNGSearchToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class SearxNGSearchResultSchema(BaseModel):+class SearxNGSearchResultSchema(BaseAgentIO):url: strtitle: strcontent: Optional[str] = None- category: Optional[str] = None+-class SearxNGSearchToolOutputSchema(BaseModel):+class SearxNGSearchToolOutputSchema(BaseAgentIO):results: List[SearxNGSearchResultSchema]+ category: Optional[str] = None############### TOOL LOGIC #@@ -130,8 +132,7 @@ class SearxNGSearchTool(BaseTool):filtered_results = filtered_results[:max_results or self.max_results]- return SearxNGSearchToolOutputSchema(results=filtered_results)-+ return SearxNGSearchToolOutputSchema(results=filtered_results, category=params.category)################## EXAMPLE USAGE #@@ -143,5 +144,5 @@ if __name__ == "__main__":search_input = SearxNGSearchTool.input_schema(queries=["Python programming", "Machine learning", "Artificial intelligence"], category="news")output = search_tool_instance.run(search_input)- for i, result in enumerate(output.results):- rich_console.print(f"{i}. Title: {result.title}, URL: {result.url}")\ No newline at end of file++ rich_console.print(output)\ No newline at end of filediff --git a/atomic_agents/lib/tools/search/serper_tool.py b/atomic_agents/lib/tools/search/serper_tool.pyindex e2bc1bd..bba050a 100644--- a/atomic_agents/lib/tools/search/serper_tool.py+++ b/atomic_agents/lib/tools/search/serper_tool.py@@ -8,11 +8,12 @@ import openaiimport instructorfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfig+from atomic_agents.agents.base_chat_agent import BaseAgentIO################# INPUT SCHEMA #################-class SerperSearchToolSchema(BaseModel):+class SerperSearchToolSchema(BaseAgentIO):queries: List[str] = Field(..., description="List of search queries.")class Config:@@ -26,13 +27,13 @@ class SerperSearchToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class SerperSearchResultSchema(BaseModel):+class SerperSearchResultSchema(BaseAgentIO):url: strtitle: strcontent: Optional[str] = Noneposition: Optional[int] = None-class SerperSearchToolOutputSchema(BaseModel):+class SerperSearchToolOutputSchema(BaseAgentIO):results: List[SerperSearchResultSchema]##############@@ -139,5 +140,5 @@ if __name__ == "__main__":search_input = SerperSearchTool.input_schema(queries=["Python programming", "Machine learning", "Quantum computing"])output = search_tool_instance.run(search_input)- for i, result in enumerate(output.results):- rich_console.print(f"{i}. Title: {result.title}, URL: {result.url}")\ No newline at end of file++ rich_console.print(output)\ No newline at end of filediff --git a/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py b/atomic_agents/lib/tools/yelp_restaurant_finder_tool.pyindex c0b376c..faf5d4b 100644--- a/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py+++ b/atomic_agents/lib/tools/yelp_restaurant_finder_tool.py@@ -6,6 +6,7 @@ from rich.console import Consolefrom rich.table import Tablefrom enum import Enum+from atomic_agents.agents.base_chat_agent import BaseAgentIOfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfig################@@ -38,7 +39,7 @@ class PriceRange(Enum):THREE = "3"FOUR = "4"-class YelpSearchToolSchema(BaseModel):+class YelpSearchToolSchema(BaseAgentIO):location: str = Field(..., description="Location to search for food.")term: Optional[str] = Field(None, description="Search term (e.g., 'pizza', 'sushi').")categories: Optional[List[YelpCategory]] = Field(None, description="Categories to filter by (e.g., 'italian, mexican').")@@ -58,7 +59,7 @@ class YelpSearchToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class YelpSearchResultSchema(BaseModel):+class YelpSearchResultSchema(BaseAgentIO):name: strurl: strrating: float@@ -67,8 +68,16 @@ class YelpSearchResultSchema(BaseModel):phone: Optional[str] = Nonecategories: List[str]-class YelpSearchToolOutputSchema(BaseModel):+class YelpSearchToolOutputSchema(BaseAgentIO):results: List[YelpSearchResultSchema]++ class Config:+ title = "YelpSearchToolOutput"+ description = "Output schema for the YelpSearchTool, containing a list of search results with details such as name, rating, and address."+ json_schema_extra = {+ "title": title,+ "description": description+ }############### TOOL LOGIC #@@ -175,26 +184,4 @@ if __name__ == "__main__":output = search_tool_instance.run(search_input)- # Create a table to display the results- table = Table(title="Yelp Search Results")-- table.add_column("Name", style="cyan", no_wrap=True)- table.add_column("Rating", style="magenta")- table.add_column("Review Count", style="magenta")- table.add_column("Address", style="green")- table.add_column("URL", style="blue")- table.add_column("Phone", style="yellow")- table.add_column("Categories", style="red")-- for result in output.results:- table.add_row(- result.name,- str(result.rating),- str(result.review_count),- result.address,- result.url,- result.phone or "N/A",- ", ".join(result.categories)- )-- rich_console.print(table)+ rich_console.print(output)\ No newline at end of filediff --git a/atomic_agents/lib/tools/yt_transcript_scraper.py b/atomic_agents/lib/tools/yt_transcript_scraper.pyindex 16386a9..46d8c06 100644--- a/atomic_agents/lib/tools/yt_transcript_scraper.py+++ b/atomic_agents/lib/tools/yt_transcript_scraper.py@@ -3,13 +3,14 @@ from pydantic import BaseModel, Fieldfrom typing import List, Optionalfrom rich.console import Consolefrom youtube_transcript_api import YouTubeTranscriptApi, NoTranscriptFound, TranscriptsDisabled+from atomic_agents.agents.base_chat_agent import BaseAgentIOfrom atomic_agents.lib.tools.base import BaseTool, BaseToolConfigfrom googleapiclient.discovery import build################# INPUT SCHEMA #################-class YouTubeTranscriptToolSchema(BaseModel):+class YouTubeTranscriptToolSchema(BaseAgentIO):video_url: str = Field(..., description="URL of the YouTube video to fetch the transcript for.")language: Optional[str] = Field(None, description="Language code for the transcript (e.g., 'en' for English).")@@ -24,16 +25,20 @@ class YouTubeTranscriptToolSchema(BaseModel):##################### OUTPUT SCHEMA(S) #####################-class YouTubeTranscriptResultSchema(BaseModel):- text: str- start: float- duration: float--class YouTubeTranscriptToolOutputSchema(BaseModel):+class YouTubeTranscriptToolOutputSchema(BaseAgentIO):transcript: strduration: floatcomments: List[str]metadata: dict++ class Config:+ title = "YouTubeTranscriptToolOutput"+ description = "Output schema for the YouTubeTranscriptTool. Contains the transcript text, duration, comments, and metadata."+ json_schema_extra = {+ "title": title,+ "description": description+ }+############### TOOL LOGIC #@@ -143,9 +148,7 @@ if __name__ == "__main__":api_key = os.getenv('YOUTUBE_API_KEY')search_tool_instance = YouTubeTranscriptTool(config=YouTubeTranscriptToolConfig(api_key=api_key))- search_input = YouTubeTranscriptTool.input_schema(video_url="https://www.youtube.com/watch?v=C2w45qRc3aU", language="en")+ search_input = YouTubeTranscriptTool.input_schema(video_url="https://www.youtube.com/watch?v=t1e8gqXLbsU", language="en")output = search_tool_instance.run(search_input)- rich_console.print(f"Transcript: {output.transcript}")- rich_console.print(f"Duration: {output.duration}")- rich_console.print(f"Metadata: {output.metadata}")\ No newline at end of file+ rich_console.print(output)\ No newline at end of filediff --git a/atomic_agents/lib/utils/scraping/pdf_to_markdown.py b/atomic_agents/lib/utils/scraping/pdf_to_markdown.pyindex c47b1cb..b48709b 100644--- a/atomic_agents/lib/utils/scraping/pdf_to_markdown.py+++ b/atomic_agents/lib/utils/scraping/pdf_to_markdown.py@@ -1,3 +1,4 @@+import reimport requestsfrom PyPDF2 import PdfReaderfrom io import BytesIO@@ -23,7 +24,10 @@ class PdfToMarkdownConverter:@staticmethoddef _convert_to_markdown(text):- return markdownify.markdownify(text, heading_style="ATX")+ markdown_text = markdownify.markdownify(text, heading_style="ATX")+ # Replace more than two consecutive newlines with exactly two newlines+ markdown_text = re.sub(r'\n{3,}', '\n\n', markdown_text)+ return markdown_text@staticmethoddef convert(url=None, file_path=None):diff --git a/atomic_agents/lib/utils/scraping/url_to_markdown.py b/atomic_agents/lib/utils/scraping/url_to_markdown.pyindex 88e14b6..7b4467a 100644--- a/atomic_agents/lib/utils/scraping/url_to_markdown.py+++ b/atomic_agents/lib/utils/scraping/url_to_markdown.py@@ -1,4 +1,5 @@import os+import refrom bs4 import BeautifulSoupimport requestsfrom markdownify import MarkdownConverter@@ -50,7 +51,10 @@ class UrlToMarkdownConverter:style.decompose()converter = CustomMarkdownConverter()- return converter.convert(str(html)).strip()+ markdown_text = converter.convert(str(html))+ # Replace more than two consecutive newlines with exactly two newlines+ markdown_text = re.sub(r'\n{3,}', '\n\n', markdown_text)+ return markdown_text@staticmethoddef convert(url):diff --git a/docs/api/atomic_agents/agents/base_chat_agent.md b/docs/api/atomic_agents/agents/base_chat_agent.mdindex cc52cd3..c0bfabf 100644--- a/docs/api/atomic_agents/agents/base_chat_agent.md+++ b/docs/api/atomic_agents/agents/base_chat_agent.md@@ -6,7 +6,6 @@- [BaseChatAgent](#basechatagent)- [BaseAgentIO](#baseagentio)- - [BaseAgentIO().stringify](#baseagentio()stringify)- [BaseChatAgent](#basechatagent-1)- [BaseChatAgent()._get_and_handle_response](#basechatagent()_get_and_handle_response)- [BaseChatAgent()._init_run](#basechatagent()_init_run)@@ -18,13 +17,11 @@- [BaseChatAgent().run](#basechatagent()run)- [BaseChatAgentConfig](#basechatagentconfig)- [BaseChatAgentInputSchema](#basechatagentinputschema)- - [BaseChatAgentInputSchema().stringify](#basechatagentinputschema()stringify)- - [BaseChatAgentResponse](#basechatagentresponse)- - [BaseChatAgentResponse().stringify](#basechatagentresponse()stringify)+ - [BaseChatAgentResponseSchema](#basechatagentresponse)## BaseAgentIO-[Show source in base_chat_agent.py:8](../../../../atomic_agents/agents/base_chat_agent.py#L8)+[Show source in base_chat_agent.py:10](../../../../atomic_agents/agents/base_chat_agent.py#L10)Base class for input and output schemas for chat agents.@@ -34,16 +31,6 @@ Base class for input and output schemas for chat agents.class BaseAgentIO(BaseModel): ...```-### BaseAgentIO().stringify--[Show source in base_chat_agent.py:12](../../../../atomic_agents/agents/base_chat_agent.py#L12)--#### Signature--```python-def stringify(self): ...-```-## BaseChatAgent@@ -83,7 +70,7 @@ class BaseChatAgent:### BaseChatAgent()._get_and_handle_response-[Show source in base_chat_agent.py:131](../../../../atomic_agents/agents/base_chat_agent.py#L131)+[Show source in base_chat_agent.py:132](../../../../atomic_agents/agents/base_chat_agent.py#L132)Handles obtaining and processing the response.@@ -99,7 +86,7 @@ def _get_and_handle_response(self): ...### BaseChatAgent()._init_run-[Show source in base_chat_agent.py:141](../../../../atomic_agents/agents/base_chat_agent.py#L141)+[Show source in base_chat_agent.py:142](../../../../atomic_agents/agents/base_chat_agent.py#L142)Initializes the run with the given user input.@@ -119,7 +106,7 @@ def _init_run(self, user_input: Type[BaseAgentIO]): ...### BaseChatAgent()._post_run-[Show source in base_chat_agent.py:156](../../../../atomic_agents/agents/base_chat_agent.py#L156)+[Show source in base_chat_agent.py:158](../../../../atomic_agents/agents/base_chat_agent.py#L158)Finalizes the run with the given response.@@ -135,7 +122,7 @@ def _post_run(self, response): ...### BaseChatAgent()._pre_run-[Show source in base_chat_agent.py:150](../../../../atomic_agents/agents/base_chat_agent.py#L150)+[Show source in base_chat_agent.py:152](../../../../atomic_agents/agents/base_chat_agent.py#L152)Prepares for the run. This method can be overridden by subclasses to add custom pre-run logic.@@ -147,7 +134,7 @@ def _pre_run(self): ...### BaseChatAgent().get_response-[Show source in base_chat_agent.py:93](../../../../atomic_agents/agents/base_chat_agent.py#L93)+[Show source in base_chat_agent.py:94](../../../../atomic_agents/agents/base_chat_agent.py#L94)Obtains a response from the language model.@@ -167,7 +154,7 @@ def get_response(self, response_model=None) -> Type[BaseModel]: ...### BaseChatAgent().get_system_prompt-[Show source in base_chat_agent.py:84](../../../../atomic_agents/agents/base_chat_agent.py#L84)+[Show source in base_chat_agent.py:85](../../../../atomic_agents/agents/base_chat_agent.py#L85)Generates the system prompt.@@ -183,7 +170,7 @@ def get_system_prompt(self) -> str: ...### BaseChatAgent().reset_memory-[Show source in base_chat_agent.py:78](../../../../atomic_agents/agents/base_chat_agent.py#L78)+[Show source in base_chat_agent.py:79](../../../../atomic_agents/agents/base_chat_agent.py#L79)Resets the memory to its initial state.@@ -195,7 +182,7 @@ def reset_memory(self): ...### BaseChatAgent().run-[Show source in base_chat_agent.py:114](../../../../atomic_agents/agents/base_chat_agent.py#L114)+[Show source in base_chat_agent.py:115](../../../../atomic_agents/agents/base_chat_agent.py#L115)Runs the chat agent with the given user input.@@ -210,7 +197,7 @@ Runs the chat agent with the given user input.#### Signature```python-def run(self, user_input: Optional[Type[BaseAgentIO]] = None) -> str: ...+def run(self, user_input: Optional[Type[BaseAgentIO]] = None) -> Type[BaseAgentIO]: ...```#### See also@@ -233,7 +220,7 @@ class BaseChatAgentConfig(BaseModel): ...## BaseChatAgentInputSchema-[Show source in base_chat_agent.py:16](../../../../atomic_agents/agents/base_chat_agent.py#L16)+[Show source in base_chat_agent.py:22](../../../../atomic_agents/agents/base_chat_agent.py#L22)#### Signature@@ -245,38 +232,18 @@ class BaseChatAgentInputSchema(BaseAgentIO): ...- [BaseAgentIO](#baseagentio)-### BaseChatAgentInputSchema().stringify--[Show source in base_chat_agent.py:19](../../../../atomic_agents/agents/base_chat_agent.py#L19)-#### Signature-```python-def stringify(self): ...-```+## BaseChatAgentResponseSchema---## BaseChatAgentResponse--[Show source in base_chat_agent.py:22](../../../../atomic_agents/agents/base_chat_agent.py#L22)+[Show source in base_chat_agent.py:25](../../../../atomic_agents/agents/base_chat_agent.py#L25)#### Signature```python-class BaseChatAgentResponse(BaseAgentIO): ...+class BaseChatAgentResponseSchema(BaseAgentIO): ...```#### See also-- [BaseAgentIO](#baseagentio)--### BaseChatAgentResponse().stringify--[Show source in base_chat_agent.py:33](../../../../atomic_agents/agents/base_chat_agent.py#L33)--#### Signature--```python-def stringify(self): ...-```\ No newline at end of file+- [BaseAgentIO](#baseagentio)\ No newline at end of filediff --git a/docs/api/atomic_agents/agents/tool_interface_agent.md b/docs/api/atomic_agents/agents/tool_interface_agent.mdindex 746a869..f844886 100644--- a/docs/api/atomic_agents/agents/tool_interface_agent.md+++ b/docs/api/atomic_agents/agents/tool_interface_agent.md@@ -6,7 +6,6 @@- [ToolInterfaceAgent](#toolinterfaceagent)- [ToolInputModel](#toolinputmodel)- - [ToolInputModel().stringify](#toolinputmodel()stringify)- [ToolInterfaceAgent](#toolinterfaceagent-1)- [ToolInterfaceAgent()._get_and_handle_response](#toolinterfaceagent()_get_and_handle_response)- [ToolInterfaceAgentConfig](#toolinterfaceagentconfig)@@ -25,21 +24,11 @@ class ToolInputModel(BaseAgentIO): ...- [BaseAgentIO](./base_chat_agent.md#baseagentio)-### ToolInputModel().stringify--[Show source in tool_interface_agent.py:23](../../../../atomic_agents/agents/tool_interface_agent.py#L23)--#### Signature--```python-def stringify(self): ...-```-## ToolInterfaceAgent-[Show source in tool_interface_agent.py:26](../../../../atomic_agents/agents/tool_interface_agent.py#L26)+[Show source in tool_interface_agent.py:23](../../../../atomic_agents/agents/tool_interface_agent.py#L23)A specialized chat agent designed to interact with a specific tool.@@ -65,7 +54,7 @@ class ToolInterfaceAgent(BaseChatAgent):### ToolInterfaceAgent()._get_and_handle_response-[Show source in tool_interface_agent.py:89](../../../../atomic_agents/agents/tool_interface_agent.py#L89)+[Show source in tool_interface_agent.py:86](../../../../atomic_agents/agents/tool_interface_agent.py#L86)Handles obtaining and processing the response from the tool.diff --git a/docs/api/atomic_agents/lib/components/chat_memory.md b/docs/api/atomic_agents/lib/components/chat_memory.mdindex af68fb6..f801a8f 100644--- a/docs/api/atomic_agents/lib/components/chat_memory.md+++ b/docs/api/atomic_agents/lib/components/chat_memory.md@@ -39,7 +39,7 @@ Adds a message to the chat history.#### Arguments- `role` *str* - The role of the message sender.-content (Union[str, Dict]): The content of the message.+- `content` *str* - The content of the message.- `tool_message` *Optional[Dict]* - Optional tool message to be included.- `tool_id` *Optional[str]* - Optional unique identifier for the tool call.@@ -49,7 +49,7 @@ content (Union[str, Dict]): The content of the message.def add_message(self,role: str,- content: Union[str, Dict],+ content: str,tool_message: Optional[Dict] = None,tool_id: Optional[str] = None,) -> None: ...diff --git a/docs/api/atomic_agents/lib/tools/calculator_tool.md b/docs/api/atomic_agents/lib/tools/calculator_tool.mdindex f86a52b..6ab6ad2 100644--- a/docs/api/atomic_agents/lib/tools/calculator_tool.md+++ b/docs/api/atomic_agents/lib/tools/calculator_tool.md@@ -83,22 +83,30 @@ class CalculatorToolConfig(BaseToolConfig): ...## CalculatorToolOutputSchema-[Show source in calculator_tool.py:26](../../../../../atomic_agents/lib/tools/calculator_tool.py#L26)+[Show source in calculator_tool.py:25](../../../../../atomic_agents/lib/tools/calculator_tool.py#L25)#### Signature```python-class CalculatorToolOutputSchema(BaseModel): ...+class CalculatorToolOutputSchema(BaseAgentIO): ...```+#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)+## CalculatorToolSchema-[Show source in calculator_tool.py:12](../../../../../atomic_agents/lib/tools/calculator_tool.py#L12)+[Show source in calculator_tool.py:11](../../../../../atomic_agents/lib/tools/calculator_tool.py#L11)#### Signature```python-class CalculatorToolSchema(BaseModel): ...-```\ No newline at end of file+class CalculatorToolSchema(BaseAgentIO): ...+```++#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)\ No newline at end of filediff --git a/docs/api/atomic_agents/lib/tools/content_scraping_tool.md b/docs/api/atomic_agents/lib/tools/content_scraping_tool.mdindex dbe679b..1fe5b37 100644--- a/docs/api/atomic_agents/lib/tools/content_scraping_tool.md+++ b/docs/api/atomic_agents/lib/tools/content_scraping_tool.md@@ -16,28 +16,15 @@- [ContentScrapingTool](#contentscrapingtool)- - [ContentScrapingResultSchema](#contentscrapingresultschema)- [ContentScrapingTool](#contentscrapingtool-1)- [ContentScrapingTool().run](#contentscrapingtool()run)- [ContentScrapingToolConfig](#contentscrapingtoolconfig)- [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema)- [ContentScrapingToolSchema](#contentscrapingtoolschema)-## ContentScrapingResultSchema--[Show source in content_scraping_tool.py:30](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L30)--#### Signature--```python-class ContentScrapingResultSchema(BaseModel): ...-```---## ContentScrapingTool-[Show source in content_scraping_tool.py:43](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L43)+[Show source in content_scraping_tool.py:42](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L42)Tool for scraping web pages or PDFs and converting content to markdown.@@ -62,7 +49,7 @@ class ContentScrapingTool(BaseTool):### ContentScrapingTool().run-[Show source in content_scraping_tool.py:63](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L63)+[Show source in content_scraping_tool.py:62](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L62)Runs the ContentScrapingTool with the given parameters.@@ -89,7 +76,7 @@ def run(self, params: ContentScrapingToolSchema) -> ContentScrapingToolOutputSch## ContentScrapingToolConfig-[Show source in content_scraping_tool.py:40](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L40)+[Show source in content_scraping_tool.py:39](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L39)#### Signature@@ -105,22 +92,30 @@ class ContentScrapingToolConfig(BaseToolConfig): ...## ContentScrapingToolOutputSchema-[Show source in content_scraping_tool.py:34](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L34)+[Show source in content_scraping_tool.py:31](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L31)#### Signature```python-class ContentScrapingToolOutputSchema(BaseModel): ...+class ContentScrapingToolOutputSchema(BaseAgentIO): ...```+#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)+## ContentScrapingToolSchema-[Show source in content_scraping_tool.py:16](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L16)+[Show source in content_scraping_tool.py:17](../../../../../atomic_agents/lib/tools/content_scraping_tool.py#L17)#### Signature```python-class ContentScrapingToolSchema(BaseModel): ...-```\ No newline at end of file+class ContentScrapingToolSchema(BaseAgentIO): ...+```++#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)\ No newline at end of filediff --git a/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md b/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.mdindex a74ce80..1bad04b 100644--- a/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md+++ b/docs/api/atomic_agents/lib/tools/yelp_restaurant_finder_tool.md@@ -4,11 +4,6 @@> Auto-generated documentation for [atomic_agents.lib.tools.yelp_restaurant_finder_tool](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py) module.-#### Attributes--- `table` - Create a table to display the results: Table(title='Yelp Search Results')--- [Yelp Restaurant Finder Tool](#yelp-restaurant-finder-tool)- [PriceRange](#pricerange)- [YelpCategory](#yelpcategory)@@ -21,7 +16,7 @@## PriceRange-[Show source in yelp_restaurant_finder_tool.py:35](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L35)+[Show source in yelp_restaurant_finder_tool.py:36](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L36)#### Signature@@ -33,7 +28,7 @@ class PriceRange(Enum): ...## YelpCategory-[Show source in yelp_restaurant_finder_tool.py:14](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L14)+[Show source in yelp_restaurant_finder_tool.py:15](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L15)#### Signature@@ -45,19 +40,23 @@ class YelpCategory(Enum): ...## YelpSearchResultSchema-[Show source in yelp_restaurant_finder_tool.py:61](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L61)+[Show source in yelp_restaurant_finder_tool.py:62](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L62)#### Signature```python-class YelpSearchResultSchema(BaseModel): ...+class YelpSearchResultSchema(BaseAgentIO): ...```+#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)+## YelpSearchTool-[Show source in yelp_restaurant_finder_tool.py:80](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L80)+[Show source in yelp_restaurant_finder_tool.py:89](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L89)Tool for performing searches using the Yelp API based on the provided queries.@@ -82,7 +81,7 @@ class YelpSearchTool(BaseTool):### YelpSearchTool().run-[Show source in yelp_restaurant_finder_tool.py:104](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L104)+[Show source in yelp_restaurant_finder_tool.py:113](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L113)Runs the YelpSearchTool with the given parameters.@@ -115,7 +114,7 @@ def run(self, params: YelpSearchToolSchema) -> YelpSearchToolOutputSchema: ...## YelpSearchToolConfig-[Show source in yelp_restaurant_finder_tool.py:76](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L76)+[Show source in yelp_restaurant_finder_tool.py:85](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L85)#### Signature@@ -131,22 +130,30 @@ class YelpSearchToolConfig(BaseToolConfig): ...## YelpSearchToolOutputSchema-[Show source in yelp_restaurant_finder_tool.py:70](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L70)+[Show source in yelp_restaurant_finder_tool.py:71](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L71)#### Signature```python-class YelpSearchToolOutputSchema(BaseModel): ...+class YelpSearchToolOutputSchema(BaseAgentIO): ...```+#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)+## YelpSearchToolSchema-[Show source in yelp_restaurant_finder_tool.py:41](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L41)+[Show source in yelp_restaurant_finder_tool.py:42](../../../../../atomic_agents/lib/tools/yelp_restaurant_finder_tool.py#L42)#### Signature```python-class YelpSearchToolSchema(BaseModel): ...-```\ No newline at end of file+class YelpSearchToolSchema(BaseAgentIO): ...+```++#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)\ No newline at end of filediff --git a/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md b/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.mdindex 3b7e72b..6c9ed22 100644--- a/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md+++ b/docs/api/atomic_agents/lib/tools/yt_transcript_scraper.md@@ -5,7 +5,6 @@> Auto-generated documentation for [atomic_agents.lib.tools.yt_transcript_scraper](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py) module.- [Yt Transcript Scraper](#yt-transcript-scraper)- - [YouTubeTranscriptResultSchema](#youtubetranscriptresultschema)- [YouTubeTranscriptTool](#youtubetranscripttool)- [YouTubeTranscriptTool.extract_video_id](#youtubetranscripttoolextract_video_id)- [YouTubeTranscriptTool().fetch_video_metadata](#youtubetranscripttool()fetch_video_metadata)@@ -14,21 +13,9 @@- [YouTubeTranscriptToolOutputSchema](#youtubetranscripttooloutputschema)- [YouTubeTranscriptToolSchema](#youtubetranscripttoolschema)-## YouTubeTranscriptResultSchema--[Show source in yt_transcript_scraper.py:27](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L27)--#### Signature--```python-class YouTubeTranscriptResultSchema(BaseModel): ...-```---## YouTubeTranscriptTool-[Show source in yt_transcript_scraper.py:44](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L44)+[Show source in yt_transcript_scraper.py:49](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L49)Tool for fetching the transcript of a YouTube video using the YouTube Transcript API.@@ -51,7 +38,7 @@ class YouTubeTranscriptTool(BaseTool):### YouTubeTranscriptTool.extract_video_id-[Show source in yt_transcript_scraper.py:99](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L99)+[Show source in yt_transcript_scraper.py:104](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L104)Extracts the video ID from a YouTube URL.@@ -72,7 +59,7 @@ def extract_video_id(url: str) -> str: ...### YouTubeTranscriptTool().fetch_video_metadata-[Show source in yt_transcript_scraper.py:112](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L112)+[Show source in yt_transcript_scraper.py:117](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L117)Fetches metadata for a YouTube video.@@ -92,7 +79,7 @@ def fetch_video_metadata(self, video_id: str) -> dict: ...### YouTubeTranscriptTool().run-[Show source in yt_transcript_scraper.py:65](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L65)+[Show source in yt_transcript_scraper.py:70](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L70)Runs the YouTubeTranscriptTool with the given parameters.@@ -125,7 +112,7 @@ def run(## YouTubeTranscriptToolConfig-[Show source in yt_transcript_scraper.py:41](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L41)+[Show source in yt_transcript_scraper.py:46](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L46)#### Signature@@ -141,22 +128,30 @@ class YouTubeTranscriptToolConfig(BaseToolConfig): ...## YouTubeTranscriptToolOutputSchema-[Show source in yt_transcript_scraper.py:32](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L32)+[Show source in yt_transcript_scraper.py:28](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L28)#### Signature```python-class YouTubeTranscriptToolOutputSchema(BaseModel): ...+class YouTubeTranscriptToolOutputSchema(BaseAgentIO): ...```+#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)+## YouTubeTranscriptToolSchema-[Show source in yt_transcript_scraper.py:12](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L12)+[Show source in yt_transcript_scraper.py:13](../../../../../atomic_agents/lib/tools/yt_transcript_scraper.py#L13)#### Signature```python-class YouTubeTranscriptToolSchema(BaseModel): ...-```\ No newline at end of file+class YouTubeTranscriptToolSchema(BaseAgentIO): ...+```++#### See also++- [BaseAgentIO](../../agents/base_chat_agent.md#baseagentio)\ No newline at end of filediff --git a/examples/article_idea_outline_gen_with_search.py b/examples/article_idea_outline_gen_with_search.pydeleted file mode 100644index c5cdac9..0000000--- a/examples/article_idea_outline_gen_with_search.py+++ /dev/null@@ -1,125 +0,0 @@-"""-This example demonstrates how to create a chat agent that generates article ideas and outlines based on a given topic.-The agent uses a search tool to gather relevant information and provides a structured outline for an article based on the search results.-This script also demonstrates the usage of dynamic info providers to include additional dynamic information at runtime in the system prompt context.-This can be useful if you only want to include the latest search results to save tokens (and thus, money) and avoid unnecessary repetition.-"""--from datetime import datetime-import os-from rich.console import Console-from atomic_agents.lib.components.chat_memory import ChatMemory-from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentConfig-from atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGenerator, SystemPromptInfo-import instructor-import openai-from atomic_agents.lib.tools.base import BaseTool-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig---# We can define dynamic info providers to provide additional information in the system prompt context.-# Each provider must have a title and a `get_info` method that returns a string.-# Each run, get_info will be called in order to provide the information at runtime.-class CurrentDateProvider(SystemPromptContextProviderBase):- def __init__(self, format: str = '%Y-%m-%d %H:%M:%S', **kwargs):- super().__init__(**kwargs)- self.format = format-- def get_info(self) -> str:- return f'The current date, in the format "{self.format}", is {datetime.now().strftime(self.format)}'--class SearchResultsProvider(SystemPromptContextProviderBase):- def __init__(self, **kwargs):- super().__init__(**kwargs)- self.search_results: SearxNGSearchTool.output_schema = None-- def get_info(self) -> str:- response = ''- if not self.search_results:- return response-- for result in self.search_results.results:- response += f'--- {result.title} ---\n'- response += f'{result.content}\n'- response += f'[Read more]({result.url})\n'- response += '--------------------------------\n\n'-- return response--# Define dynamic info providers.-system_prompt_context_providers = {- 'date': CurrentDateProvider(title='Current date', format='%Y-%m-%d %H:%M:%S'),- 'search': SearchResultsProvider(title='Search results')-}--# Define the system prompt information including background, steps, and output instructions.-system_prompt = SystemPromptInfo(- background=[- 'This assistant is an expert in brainstorming ideas and creating article outlines.',- 'This assistant\'s goal is to generate engaging and creative ideas and structured outlines for articles based on the given topic.'- ],- steps=[- 'Note the observations about the input and thought process involved in preparing the ideas and outline.',- 'Respond with a list of 10 ideas and a structured outline for the article in a markdown-formatted text.'- ],- output_instructions=[- 'Ensure each idea is clearly numbered from 1 to 10.',- 'Output the list of ideas and the article outline in human-readable Markdown format.',- 'Include a list of the most promising-looking URLs for further research at the end of the response as a markdown list.',- 'Do not include any additional text or confirmation messages; only provide the list of ideas, the article outline, and the URLs.',- 'Do not reply to the user\'s input with anything except the list of ideas, the article outline, and the URLs.'- ],- context_providers=system_prompt_context_providers-)-system_prompt_generator = SystemPromptGenerator(system_prompt)--# Optionally define the memory with an initial message from the assistant.-memory = ChatMemory()-initial_memory = [- {'role': 'assistant', 'content': 'Hello! I\'m an AI assistant that can help you brainstorm ideas and generate article outlines. Please provide me with a topic to get started.'}-]-memory.load(initial_memory)--# Define ArticleIdeaOutlineGenConfig class - this is optional if you don't have any customization,-# but I like to do this for consistnecy and in order to not have to do it later if I need to add something.-class ArticleIdeaOutlineGenConfig(BaseChatAgentConfig):- search_tool: BaseTool--# For this example, we extend the BaseChatAgent to create a custom chat agent that interacts with a search tool.-class OutlineGenAgent(BaseChatAgent):- def __init__(self, config: ArticleIdeaOutlineGenConfig):- super().__init__(config)- self.search_tool = config.search_tool-- def _pre_run(self):- self.memory.add_message('assistant', 'First, I will perform a search with 3 different search queries to gather relevant information on the topic.')- search_input = self.get_response(response_model=SearxNGSearchTool.input_schema)- search_results = self.search_tool.run(search_input)- self.system_prompt_generator.system_prompt_info.context_providers['search'].search_results = search_results- self.memory.add_message('assistant', 'I have gathered the search results and they have been added to the context.')---# Update the configuration to use ArticleIdeaOutlineGenConfig-config = ArticleIdeaOutlineGenConfig(- client=instructor.from_openai(openai.OpenAI()),- model='gpt-3.5-turbo',- system_prompt_generator=system_prompt_generator,- memory=memory,- search_tool=SearxNGSearchTool(SearxNGSearchToolConfig(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=25))-)--# Create an instance of OutlineGenAgent with the specified configuration-agent = OutlineGenAgent(config=config)--console = Console()--console.print(f'Agent: {initial_memory[0]["content"]}')--while True:- user_input = input('You: ')- if user_input.lower() in ['exit', 'quit']:- print('Exiting chat...')- break-- response = agent.run(OutlineGenAgent.input_schema(chat_input=user_input))- console.print(f'Agent: {response.response}')\ No newline at end of filediff --git a/examples/notebooks/multi_agent_quickstart.ipynb b/examples/notebooks/multi_agent_quickstart.ipynbindex 49845a3..fc5896b 100644--- a/examples/notebooks/multi_agent_quickstart.ipynb+++ b/examples/notebooks/multi_agent_quickstart.ipynb@@ -230,4 +230,4 @@},"nbformat": 4,"nbformat_minor": 4- }\ No newline at end of file+}diff --git a/examples/notebooks/yelp_agent.ipynb b/examples/notebooks/yelp_agent.ipynbindex ebe1497..fbf13d5 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, BaseChatAgentResponse, BaseChatAgentConfig\n",+ "from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentResponseSchema, BaseChatAgentConfig\n","from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema"]},@@ -194,7 +194,7 @@"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[BaseChatAgentResponse, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')\n",+ " chosen_schema: Union[BaseChatAgentResponseSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')\n","\n"," class Config:\n"," title = 'ResponseSchema'\n",diff --git a/examples/yelp_restaurant_finder.py b/examples/yelp_restaurant_finder.pyindex a4cf28b..d42beae 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, BaseChatAgentResponse, BaseChatAgentConfig+from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentResponseSchema, BaseChatAgentConfigfrom atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema# Configure logging@@ -57,7 +57,7 @@ yelp_tool = YelpSearchTool(YelpSearchToolConfig(api_key=os.getenv('YELP_API_KEY'# Define a custom response schema that can handle both chat responses and Yelp search tool responsesclass ResponseSchema(BaseModel):- chosen_schema: Union[BaseChatAgentResponse, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')+ chosen_schema: Union[BaseChatAgentResponseSchema, YelpSearchToolSchema] = Field(..., description='The response from the chat agent.')class Config:title = 'ResponseSchema'