Closed miquelmongeAZ closed 3 months ago
🤖
Hey @miquelmongeAZ! Great to see you diving into the intricacies of LangChain again. Let's crack this one together! 🛠️
Based on the code you've provided and the context, it seems like you've correctly set return_intermediate_steps=True
for both the GraphCypherQAChain
tool and the AgentExecutor
. However, you're not seeing the intermediate steps from the GraphCypherQAChain
tool in the agent's output.
This could be due to how the AgentExecutor
handles the output of the tools it executes. If the AgentExecutor
doesn't specifically handle the intermediate steps from the tools, it might not include them in its own output, even if return_intermediate_steps=True
.
Here's a simplified example of how this might work:
class AgentExecutor:
def __init__(self, agent, tools, return_intermediate_steps):
self.agent = agent
self.tools = tools
self.return_intermediate_steps = return_intermediate_steps
def execute(self):
results = []
for tool in self.tools:
result = tool.execute()
if self.return_intermediate_steps:
results.append(result)
return results
In this example, the AgentExecutor
executes each tool and appends the result to a list if return_intermediate_steps=True
. However, it doesn't specifically handle the intermediate steps from the tools, so they're not included in the final output.
To fix this, you might need to modify the AgentExecutor
to handle the intermediate steps from the tools. However, without more information about how the AgentExecutor
and GraphCypherQAChain
are implemented, it's hard to provide a more specific solution.
If you could provide more details about these classes, especially how they handle the return_intermediate_steps
parameter and the output of the tools, it would be easier to diagnose the issue. For example, the relevant parts of the AgentExecutor.execute()
method and the GraphCypherQAChain.execute()
method would be very helpful.
You can refer to the source code of the GraphCypherQAChain
class in the LangChain repository here and the AgentExecutor
class here for more details.
I hope this helps! If you have any more questions, feel free to ask.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
GraphCypherQAChain tool is accesible for the react-chat agent an generate good cypher queries, but it do not return the cypher queries to the agent. What I expect is that with return_intermediate_steps on both the tool and the agent I can have both the cypher queries and the agent steps. Right now I only see the agents return_intermediate_steps, but there is any cypher query from the tool.
System Info
langchain==0.1.5 langchain-community==0.0.18 langchain-core==0.1.19 langchain-openai==0.0.5 langchainhub==0.1.14
mac
Python 3.9.6