Closed JulianOestreich90 closed 4 days ago
To address the issue of not receiving source nodes in responses from your top-level ReAct Agent, despite individual document-specific agents returning them as expected, you'll need to make adjustments to ensure that source nodes are aggregated and included in the top agent's responses. Here's a concise guide to achieve this:
Ensure Document Agents Return Source Nodes: First, verify that each document-specific agent is correctly configured to return source nodes with their responses.
Modify Top-Level Agent to Include Source Nodes: Enhance the top-level agent to aggregate and include source nodes from the document-specific agents in its responses. This may involve customizing the response structure to ensure source nodes are part of the output.
Customize Tool Retriever Logic: Ensure the tool retriever mechanism used by the top-level agent is set up to consider source nodes in its operation. This might require customizing the retrieval process to include source nodes in the returned objects or in post-processing steps.
Implement Callbacks or Post-Processing Steps: If applicable, use callbacks or post-processing steps to attach source nodes from document-specific agents to the top-level agent's responses. This could involve adjusting the logic in these steps to handle source nodes appropriately.
Review Agent Construction Logic: Finally, review the construction logic of your top-level agent to ensure it's configured to handle source nodes correctly. This might mean passing additional parameters or adjusting internal mechanisms during the agent setup.
By following these steps, you can ensure that your top-level ReAct Agent returns source nodes in its responses, similar to the individual document-specific agents. This approach requires careful adjustment of the agent's configuration and possibly customizing certain components to handle source nodes as part of the response object.
To continue the conversation, mention @dosu.
I modified the code from here to use ReActAgent similar to your code and was able to get the source nodes on the response object returned from top_agent.chat()
can you show what kind of output you are getting? The only thing different in the example code and your code apart from different data and prompts might be how you build the VectorStoreIndex.
Question Validation
Question
I am using ReAct agents to query multiple documents. I setted up a QueryEngineTool for every Document based on
And a top agent
When i use a single VectorStoreIndex.as_query_engine() instance and execute
query()
i get the source nodes returned. If i perform top_agent.chat() no Source Nodes are returned.How can i return the source nodes when using the top_agent?