File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
libs/langchain/langchain/agents Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -1229,11 +1229,14 @@ def _get_tool_return(
12291229 """Check if the tool is a returning tool."""
12301230 agent_action , observation = next_step_output
12311231 name_to_tool_map = {tool .name : tool for tool in self .tools }
1232+ return_value_key = "output"
1233+ if len (self .agent .return_values ) > 0 :
1234+ return_value_key = self .agent .return_values [0 ]
12321235 # Invalid tools won't be in the map, so we return False.
12331236 if agent_action .tool in name_to_tool_map :
12341237 if name_to_tool_map [agent_action .tool ].return_direct :
12351238 return AgentFinish (
1236- {self . agent . return_values [ 0 ] : observation },
1239+ {return_value_key : observation },
12371240 "" ,
12381241 )
12391242 return None
You can’t perform that action at this time.
0 commit comments