-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Feat: separate tool_call_item and tool_call_output_item in stream events #974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hi i was just trying to get an effect of calling a tool with its name displays with a spinner and then after sometime the output so is it fixed Now? can i use it |
Yeah, just check out this PR and run the tests to verify. |
thank you so much. it works. hope it gets merged soon |
Waiting for it to get merged soon |
@gdisk thank you for this PR 🙏 hoping they merge soon cc/ @rm-openai in case you haven't seen yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked this change and it looks good to me. The proposed flow is quite similar to the one we do in Agents SDK TS.
@rm-openai What do you think about this?
) | ||
|
||
print("=== Run complete ===") | ||
assert tool_call_start_time > 0, "tool_call_item was not observed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be better to instead capture all the events and do a snapshot() to ensure they are in the right order + params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be better to instead capture all the events and do a snapshot() to ensure they are in the right order + params
The order of these events is correct, but tool_call_item
is triggered immediately after tool_call_output_item
(upon tool call completion), not at the start of the tool call.
Summary
During my analysis of the streaming API (run_streamed) results, I noticed that tool_call_item and tool_call_output_item events are currently being emitted concurrently upon tool call completion (as evidenced in #831). This implementation conflates what should logically be distinct events. The current PR addresses this by properly separating these event triggers to better reflect the actual workflow.
Test plan
The test file is created in
tests
namedtest_stream_events.py
.Run the test script below to test.The test result is:
Issue number
#831
Checks
make lint
andmake format