dspy
dspy copied to clipboard
ReAct doesn't return actions executed
It would be nice to have ReAct returning the actions in the response, to know which tools were used to generate the answer. As now, ReAct only returns the observations, which are the results obtained from the tools. It should be enough to add the following line to the forward() method:
actions = [args[key] for key in args if key.startswith("Action")]
and then to add the actions key in the return, like this:
return dspy.Prediction(observations=observations, actions=actions, **{list(self.output_fields.keys())[0]: action_val or ""})