Find answers from the community

Updated 4 months ago

Hey guys! I'm running a `routes/events.

Hey guys! I'm running a routes/events.py events generator to generate tool call events that are sent to the frontend with data about tool calls. I'm using React Agent as chat engine.
When I do anything that involves more than one tool - my system breaks. It seems to be stemming from the fact that no matter how many tools I call, the event data for the first tool called is the only one that gets sent,

Plain Text
""
8:[{"type": "events", "data": {"title": "Calling tool: recipe_lookup_thought with inputs: {'recipe_name': 'Carrot Cake'}"}}]
8:[{"type": "events", "data": {"title": "Calling tool: recipe_id_lookup_thought with inputs: {'recipe_id': 'bc495a05-bd5b-451e-bdfc-88eea3fccfe8'}"}}]
8:[{"type": "events", "data": {"title": "Calling tool: recipe_card_tool with inputs: {'recipeId': 'bc495a05-bd5b-451e-bdfc-88eea3fccfe8"}}]
0:" The"
8:[{"type": "tools", "data": {"toolOutput": {"output": "The recipeId for carrot cake is bc495a05-bd5b-451e-bdfc-88eea3fccfe8", "isError": false}, "toolCall": {"id": null, "name": "recipe_lookup_thought", "input": {"args": [], "kwargs": {"food_name": "CarrotCake"}}}}}]
0:" recipe"
0:" for"


However my desired outcome is to have several lines of 8: tool type events - has anyone faced this issue before? Any tips on how to get more granular control over the react agent flow beside modifying the react prompt template?
0
L
3 comments
I have the following code in my /chat route:
Plain Text
                async def _event_generator():
                    async for event in event_handler.async_event_gen():
                        event_response = event.to_response()
                        if event_response is not None:
                            yield VercelStreamResponse.convert_data(event_response)


Yet in the response I get only the first tool that the agent calls, but I do get the events with the inputs for the other tool calls:

Plain Text
0:""
8:[{"type": "events", "data": {"title": "Calling tool: recipe_lookup_thought with inputs: {'recipe_name': 'Carrot Cake'}"}}]
8:[{"type": "events", "data": {"title": "Calling tool: recipe_id_lookup_thought with inputs: {'recipe_id': 'bc495a05-bd5b-451e-bdfc-88eea3fccfe8'}"}}]
8:[{"type": "events", "data": {"title": "Calling tool: recipe_card_tool with inputs: {'recipe_name': 'bc495a05-bd5b-451e-bdfc-88eea3fccfe8', 'recipe_id': 'bc495a05-bd5b-451e-bdfc-88eea3fccfe8'}"}}]
0:" The"
8:[{"type": "tools", "data": {"toolOutput": {"output": "The recipeId for CarrotCake is bc495a05-bd5b-451e-bdfc-88eea3fccfe8", "isError": false}, "toolCall": {"id": null, "name": "recipe_lookup_thought", "input": {"args": [], "kwargs": {"recipe_name": "Carrot Cake"}}}}}]
0:" cap"


Could this be a bug with llamaindex not sending subsequent agent_step events to the callback manager?
I'm on
Plain Text
llama-index-core = "0.10.28"
@Logan M
Updated to 0.10.58 and I am having the same issue
Sorry my guy, no idea what you are trying to do here lol
Add a reply
Sign up and join the conversation on Discord