Skip to content

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.py
similarity index 95%
rename from examples/deep_research_multi_agent/info_refiner.py
rename to examples/deep_research_multi_agent/agents/info_refiner_agent.py
index 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.py
similarity index 100%
rename from examples/deep_research_multi_agent/query_agent.py
rename to examples/deep_research_multi_agent/agents/query_agent.py
diff --git a/examples/deep_research_multi_agent/question_answering.py b/examples/deep_research_multi_agent/agents/question_answering_agent.py
similarity index 100%
rename from examples/deep_research_multi_agent/question_answering.py
rename to examples/deep_research_multi_agent/agents/question_answering_agent.py
diff --git a/examples/deep_research_multi_agent/top_urls_selector.py b/examples/deep_research_multi_agent/agents/top_urls_selector_agent.py
similarity index 100%
rename from examples/deep_research_multi_agent/top_urls_selector.py
rename to examples/deep_research_multi_agent/agents/top_urls_selector_agent.py
diff --git a/examples/deep_research_multi_agent/in_memory_faiss.py b/examples/deep_research_multi_agent/in_memory_faiss.py
index 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.py
index 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_agent
from examples.deep_research_multi_agent.providers import search_results_provider, vector_db_chunks_provider
from examples.deep_research_multi_agent.in_memory_faiss import InMemFaiss
from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig
diff --git a/examples/shared_context.py b/examples/shared_context.py
index 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 agents
agent_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