Building AI agents, atomically
Improve shared context example Re-organize and fix bug in deep research example
KennyVaneetvelde99cf2fad7507
diff --git a/examples/deep_research_multi_agent/info_refiner.py b/examples/deep_research_multi_agent/agents/info_refiner_agent.pysimilarity index 95%rename from examples/deep_research_multi_agent/info_refiner.pyrename to examples/deep_research_multi_agent/agents/info_refiner_agent.pyindex f000cae..e47f4c5 100644--- a/examples/deep_research_multi_agent/info_refiner.py+++ b/examples/deep_research_multi_agent/agents/info_refiner_agent.py@@ -25,6 +25,7 @@ refine_answer_agent = BaseChatAgent(],steps=["You will receive a question or instruction, the initial answer, and additional context from vector DB chunks.",+ "Correct any inaccuracies and factual errors in the initial answer.","Expand and elaborate on the initial answer using the additional context to provide a more comprehensive and detailed response."],output_instructions=[diff --git a/examples/deep_research_multi_agent/query_agent.py b/examples/deep_research_multi_agent/agents/query_agent.pysimilarity index 100%rename from examples/deep_research_multi_agent/query_agent.pyrename to examples/deep_research_multi_agent/agents/query_agent.pydiff --git a/examples/deep_research_multi_agent/question_answering.py b/examples/deep_research_multi_agent/agents/question_answering_agent.pysimilarity index 100%rename from examples/deep_research_multi_agent/question_answering.pyrename to examples/deep_research_multi_agent/agents/question_answering_agent.pydiff --git a/examples/deep_research_multi_agent/top_urls_selector.py b/examples/deep_research_multi_agent/agents/top_urls_selector_agent.pysimilarity index 100%rename from examples/deep_research_multi_agent/top_urls_selector.pyrename to examples/deep_research_multi_agent/agents/top_urls_selector_agent.pydiff --git a/examples/deep_research_multi_agent/in_memory_faiss.py b/examples/deep_research_multi_agent/in_memory_faiss.pyindex d6a764d..dcce3b2 100644--- a/examples/deep_research_multi_agent/in_memory_faiss.py+++ b/examples/deep_research_multi_agent/in_memory_faiss.py@@ -49,8 +49,9 @@ class InMemFaiss:async def generate_embeddings(self, texts):embeddings = []for text in texts:- response = await openai.embeddings.create(input=text, model="text-embedding-3-small")- embeddings.append(response.data[0].embedding)+ response = openai.embeddings.create(input=text, model="text-embedding-3-small")+ embedding = response.data[0].embedding+ embeddings.append(embedding)return np.array(embeddings).astype('float32')async def ingest_urls(self, urls):diff --git a/examples/deep_research_multi_agent/main.py b/examples/deep_research_multi_agent/main.pyindex 137c444..fd2c706 100644--- a/examples/deep_research_multi_agent/main.py+++ b/examples/deep_research_multi_agent/main.py@@ -1,8 +1,8 @@import os-from examples.deep_research_multi_agent.query_agent import query_agent-from examples.deep_research_multi_agent.question_answering import answer_agent-from examples.deep_research_multi_agent.top_urls_selector import top_urls_selector_agent-from examples.deep_research_multi_agent.info_refiner import refine_answer_agent+from examples.deep_research_multi_agent.agents.query_agent import query_agent+from examples.deep_research_multi_agent.agents.question_answering_agent import answer_agent+from examples.deep_research_multi_agent.agents.top_urls_selector_agent import top_urls_selector_agent+from examples.deep_research_multi_agent.agents.info_refiner_agent import refine_answer_agentfrom examples.deep_research_multi_agent.providers import search_results_provider, vector_db_chunks_providerfrom examples.deep_research_multi_agent.in_memory_faiss import InMemFaissfrom atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfigdiff --git a/examples/shared_context.py b/examples/shared_context.pyindex 81c103e..d1c095b 100644--- a/examples/shared_context.py+++ b/examples/shared_context.py@@ -31,6 +31,8 @@ agent_two = BaseChatAgent(model='gpt-3.5-turbo',))++# Add an additional output instruction to agent two, to have some differences between the two agentsagent_two.system_prompt_generator.system_prompt_info.output_instructions.append('Always respond in a beautiful poetic rhyming verse.')# Define a context provider that will be shared between the two agents