-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fixed and chain stream #39029
Open
howieleung
wants to merge
9
commits into
feature/azure-ai-projects-beta5
Choose a base branch
from
howie/fix-and-chain-stream
base: feature/azure-ai-projects-beta5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixed and chain stream #39029
howieleung
wants to merge
9
commits into
feature/azure-ai-projects-beta5
from
howie/fix-and-chain-stream
+1,153
−260
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
howieleung
requested review from
luigiw,
needuv,
achauhan-scc,
kingernupur,
paulshealy1,
singankit,
dargilco,
jhakulin and
jayesh-tanna
as code owners
January 3, 2025 21:30
jhakulin
reviewed
Jan 3, 2025
sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_functions.py
Outdated
Show resolved
Hide resolved
We need to add extensive tests because lots of changes |
jhakulin
reviewed
Jan 3, 2025
...jects/samples/agents/async_samples/sample_agents_stream_eventhandler_with_functions_async.py
Outdated
Show resolved
Hide resolved
jhakulin
reviewed
Jan 3, 2025
...jects/samples/agents/async_samples/sample_agents_stream_eventhandler_with_functions_async.py
Outdated
Show resolved
Hide resolved
jhakulin
requested changes
Jan 3, 2025
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.
Need to integrate with CI tests
API change check APIView has identified API level changes in this PR and created following API reviews. |
howieleung
force-pushed
the
howie/fix-and-chain-stream
branch
from
January 7, 2025 05:21
5154fa3
to
08d9c82
Compare
howieleung
force-pushed
the
howie/fix-and-chain-stream
branch
from
January 7, 2025 17:57
1fdf60e
to
121f588
Compare
jhakulin
reviewed
Jan 7, 2025
...azure-ai-projects/tests/agents/assets/fetch_current_datetime_and_weather_stream_response.txt
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Then when function tool calls are executed by the event handler, the response iterator of tool call stream is associated to the same event handler followed by calling until_done(). The call of until_done() pulls all events until no more response from the stream. As a result, the for loop above don't receive the events.
To fix the issue, I don't do until_done() after making tool call, so the for loop above will receive events from tool calls.
Make submit_tool_outputs_to_stream function to return None instead of AgentRunStream because developers are not expected to iterate events from submit_tool_outputs_to_stream by context manager.
Before the fix, when you make create_stream calls, the event handler received response_iterator and create_buffers from response_iterator. When the event handler makes tool calls, it will overwrite the response_iterator from the toolcall stream and reset the buffer. This might cause buffer and event lost. With the fix, when event handler make toolcalls, we chain the response_iterator of the toolcall stream to the original stream and retain buffer.
Introduce unit and integrated test. Unit test focus on logic in parsing response. Integrated test focus on handing response toolcall and call submit tool call and able handing response again from tool call streaming.