Passing an array to a tool #29314
Replies: 1 comment 2 replies
-
Hey @egaillera! 👋 I'm here to help you out with any bugs, questions, or to assist you in becoming a contributor. The issue you're encountering is due to the input being passed as a string instead of a list to the To resolve this, you need to ensure that the input is correctly parsed into a list of numbers before it is passed to the tool. You can achieve this by modifying the way the input is processed in the agent. Here's a possible solution:
Here's an example of how you might modify the def main():
main_agent = create_main_agent()
# Extract numbers from the input string
input_string = "sum the numbers 2, 3 and 4"
numbers = [float(num) for num in input_string.split() if num.isdigit()]
# Invoke the agent with the parsed list
result = main_agent.invoke({"input": numbers})
print(result['output'])
if __name__ == "__main__":
main() This modification ensures that the input to the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following code: a simple react agent with only one tool, that expects an array of numbers.
Looks like the agent is passing the array as a string:
Beta Was this translation helpful? Give feedback.
All reactions