.Net: Add Async Support for ConverseStreamResponse to Avoid Thread Blocking#10159
Merged
rogerbarreto merged 4 commits intomicrosoft:mainfrom Jan 16, 2025
Merged
Conversation
added 2 commits
January 11, 2025 00:31
markwallace-microsoft
approved these changes
Jan 11, 2025
Contributor
|
@shethaadit Do we really need to rely on |
Contributor
Author
|
Hi @RogerBarret0, this fix just got available yesterday in latest Nuget. We would need to keep the new version to get this fix. |
SergeyMenshykh
approved these changes
Jan 13, 2025
Contributor
Author
|
Hi @RogerBarret0 / @markwallace-microsoft, can we merge this as it's already approved? |
Member
|
Hi @shethaadit, seems that the solution currently does not compile, please before posting the PR ensure the solution compiles and the all UT are passing. Thanks. |
added 2 commits
January 16, 2025 01:21
…into shethaadit/FixBug9519-New
rogerbarreto
approved these changes
Jan 16, 2025
This file contains hidden or 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
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.
Motivation and Context
This change replaces the use of
response.Stream.AsEnumerable()withawait foreachfor async streaming in the Amazon Bedrock SDK. The previous method blocked the calling thread, leading to potential thread exhaustion in high-concurrency scenarios. This update aligns with best practices for asynchronous operations in .NET.Description
await foreachfor streamingConverseStreamResponsechunks asynchronously.Contribution Checklist
Fixes #9519