Skip to content

Building AI agents, atomically

Add reasoning to the agents in the RAG example

KennyVaneetveldeaacca315e465
diff --git a/atomic-examples/rag-chatbot/rag_chatbot/agents/qa_agent.py b/atomic-examples/rag-chatbot/rag_chatbot/agents/qa_agent.py
index da2854c..3a935ae 100644
--- a/atomic-examples/rag-chatbot/rag_chatbot/agents/qa_agent.py
+++ b/atomic-examples/rag-chatbot/rag_chatbot/agents/qa_agent.py
@@ -16,6 +16,7 @@ class RAGQuestionAnsweringAgentInputSchema(BaseIOSchema):
class RAGQuestionAnsweringAgentOutputSchema(BaseIOSchema):
"""Output schema for the RAG QA agent."""
+ reasoning: str = Field(..., description="The reasoning process leading up to the final answer")
answer: str = Field(..., description="The answer to the user's question based on the retrieved context")
diff --git a/atomic-examples/rag-chatbot/rag_chatbot/agents/query_agent.py b/atomic-examples/rag-chatbot/rag_chatbot/agents/query_agent.py
index 5375fda..ffb36a8 100644
--- a/atomic-examples/rag-chatbot/rag_chatbot/agents/query_agent.py
+++ b/atomic-examples/rag-chatbot/rag_chatbot/agents/query_agent.py
@@ -16,6 +16,7 @@ class RAGQueryAgentInputSchema(BaseIOSchema):
class RAGQueryAgentOutputSchema(BaseIOSchema):
"""Output schema for the RAG query agent."""
+ reasoning: str = Field(..., description="The reasoning process leading up to the final query")
query: str = Field(..., description="The semantic search query to use for retrieving relevant chunks")