Why draw_messages() in src/streamlit_app.py expects only human and ai types? #39
-
In schema.py ChatMessage class, type could be human, ai or tool. But draw_messages() will throw error on tool type. Did I miss something somewhere? I read through the code multiple times but couldn't figure out why. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
After more debug, I found out the magic happens on line 198 in streamlit_app.py If I modified the condition to I still don't understand why appending content to session_state will impact message type though. |
Beta Was this translation helpful? Give feedback.
-
The expected pattern is that a ToolMessage will follow an AIMessage that contains However I recently saw some unexpected errors in the current version of the app when the research assistant requests multiple parallel tool calls. This used to work but seems to be broken now. I haven't had a chance to debug but it does suggest that this code isn't perfect currently :) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response, @JoshuaC215 . Yes, I also saw multiple tool calls are triggered in some of the request. I reckon it might be caused by the change on Langraph. |
Beta Was this translation helpful? Give feedback.
The expected pattern is that a ToolMessage will follow an AIMessage that contains
tool_calls
, so the ToolMessage is handled with an inner iteration rather than in the main loop - see here.However I recently saw some unexpected errors in the current version of the app when the research assistant requests multiple parallel tool calls. This used to work but seems to be broken now. I haven't had a chance to debug but it does suggest that this code isn't perfect currently :)