Find answers from the community

Updated 7 months ago

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

At a glance

A community member is running a routes/events.py events generator to generate tool call events that are sent to the frontend with data about tool calls. They are using React Agent as a chat engine. The issue is that when they call more than one tool, only the event data for the first tool called is sent, even though the events for the other tool calls are generated.

Another community member provided some code they have in their /chat route, which shows that they are only getting the first tool that the agent calls, even though they are getting the events with the inputs for the other tool calls. They suspect this could be a bug with llamaindex not sending subsequent agent_step events to the callback manager.

The community member updated to llama-index-core version 0.10.58 but is still having the same issue. Another community member commented that they have no idea what the original poster is trying to do.

There is no explicitly marked answer in the comments.

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