Building AI agents, atomically
remove extra example
KennyVaneetveldea9d97235b4bd
diff --git a/.gitignore b/.gitignoreindex a0d445e..dff89dd 100644--- a/.gitignore+++ b/.gitignore@@ -140,4 +140,6 @@ chromadb_tmp/personal_experiments/-*.psd\ No newline at end of file+*.psd++.output/\ No newline at end of filediff --git a/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/outline_gen_agent.py b/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/outline_gen_agent.pydeleted file mode 100644index 289b430..0000000--- a/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/outline_gen_agent.py+++ /dev/null@@ -1,56 +0,0 @@-# outline_gen_agent.py-from pydantic import Field-from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator-import instructor-import openai---class OutlineAgentInputSchema(BaseIOSchema):- """- Input schema for the Outline Generation Agent.- This schema defines the input structure for generating an article outline.- """-- instruction: str = Field(..., description="The main topic or instruction for the article.")- search_results: list = Field(..., description="A list of search results to use as reference for creating the outline.")---class OutlineAgentOutputSchema(BaseIOSchema):- """- Output schema for the Outline Generation Agent.- This schema defines the structure of the generated article outline.- """-- reasoning_and_analysis: list[str] = Field(..., description="A list of reasoning and analysis steps for the outline.")- article_title: str = Field(..., description="The title of the article.")- section_titles: list[str] = Field(- ..., description="A list of sections for the article, excluding introduction and conclusion."- )---outline_gen_agent = BaseAgent(- BaseAgentConfig(- client=instructor.from_openai(openai.OpenAI()),- model="gpt-4o-mini",- system_prompt_generator=SystemPromptGenerator(- background=[- "You are an expert article outline generator.",- "Your task is to create a comprehensive outline for an article based on a given topic and search results.",- ],- steps=[- "Analyze the given instruction and search results.",- "Generate a catchy and informative article title.",- "Generate 3-5 sections, excluding introduction and concluding sections.",- ],- output_instructions=[- "Provide an article title that accurately reflects the main topic.",- "Ensure the section titles are clear, concise, and logically ordered.",- "Do NOT include an introduction or conclusion in the section titles.",- "Provide a list of reasoning and analysis steps that led to your outline decisions.",- ],- ),- input_schema=OutlineAgentInputSchema,- output_schema=OutlineAgentOutputSchema,- )-)diff --git a/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/query_gen_agent.py b/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/query_gen_agent.pydeleted file mode 100644index bbdf64a..0000000--- a/examples/deep_article_writer_pipelines/outline_generation_pipeline/agents/query_gen_agent.py+++ /dev/null@@ -1,41 +0,0 @@-import instructor-import openai-from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator-from atomic_agents.lib.tools.search.searxng_tool import SearxNGTool---class QueryAgentInputSchema(BaseIOSchema):- """- Input schema for the Query Generation Agent.- This schema defines the input structure for generating research queries.- """-- instruction: str = "A detailed instruction or request to generate deep research queries for."- num_queries: int = "The number of queries to generate."---# Create the query agent-query_gen_agent = BaseAgent(- BaseAgentConfig(- client=instructor.from_openai(openai.OpenAI()),- model="gpt-4o-mini",- system_prompt_generator=SystemPromptGenerator(- background=[- "You are an intelligent query generation expert.",- "Your task is to generate a specified number of diverse and highly relevant queries based on a given instruction or request.",- "The queries should cover different aspects of the instruction to ensure comprehensive exploration.",- ],- steps=[- "You will receive a detailed instruction or request and the number of queries to generate.",- "Generate the requested number of queries in a JSON format.",- ],- output_instructions=[- "Ensure clarity and conciseness in each query.",- "Ensure each query is unique and as diverse as possible while remaining relevant to the instruction.",- ],- ),- input_schema=QueryAgentInputSchema,- output_schema=SearxNGTool.input_schema,- )-)diff --git a/examples/deep_article_writer_pipelines/outline_generation_pipeline/pipeline.py b/examples/deep_article_writer_pipelines/outline_generation_pipeline/pipeline.pydeleted file mode 100644index e3f783c..0000000--- a/examples/deep_article_writer_pipelines/outline_generation_pipeline/pipeline.py+++ /dev/null@@ -1,46 +0,0 @@-import os-from agents.query_gen_agent import query_gen_agent, QueryAgentInputSchema-from agents.outline_gen_agent import outline_gen_agent, OutlineAgentInputSchema-from atomic_agents.lib.tools.search.searxng_tool import SearxNGTool, SearxNGToolConfig--# Initialize the SearxNG tool-searxng_tool = SearxNGTool(config=SearxNGToolConfig(base_url=os.getenv("SEARXNG_BASE_URL"), max_results=5))---def run_pipeline(instruction: str):- # Step 1: Generate queries using the query_gen_agent- query_input = QueryAgentInputSchema(instruction=instruction, num_queries=3)- generated_queries = query_gen_agent.run(query_input)-- print("Generated queries:")- for i, query in enumerate(generated_queries.queries, 1):- print(f"{i}. {query}")-- # Step 2: Use the generated queries with the SearxNG tool- search_input = SearxNGTool.input_schema(queries=generated_queries.queries, category="general")- search_results = searxng_tool.run(search_input)-- print("\nSearch results:")- for i, result in enumerate(search_results.results, 1):- print(f"\n{i}. {result.title}")- print(f" URL: {result.url}")- print(f" Content: {result.content[:100]}...") # Print first 100 characters of content-- # Step 3: Generate article outline- outline_input = OutlineAgentInputSchema(instruction=instruction, search_results=search_results.results)- outline = outline_gen_agent.run(outline_input)-- print("\nArticle Outline:")- print(f"Title: {outline.article_title}")- print("Sections:")- for i, section in enumerate(outline.section_titles, 1):- print(f"{i}. {section}")-- print("\nReasoning and Analysis:")- for i, step in enumerate(outline.reasoning_and_analysis, 1):- print(f"{i}. {step}")---if __name__ == "__main__":- instruction = "Explain the impact of artificial intelligence on modern healthcare"- run_pipeline(instruction)