Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net Agents - Fix Function Call Handling for Streaming (#9652)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Fixes: #9638 `System.ArgumentException: An item with the same key has already been added. ` - Duplicate key added when processing function result. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> The processing loop for assistant streaming is selecting completed steps which is resulting in over-processing that violates the state-tracking. This was due to leveraging the existing utiility method `GetRunStepsAsync`. I removed this method in favor of inline invocation since the processing for Streaming and Non-Streaming have distinct considerations. Also, as the SDK has evolved (paging removed), the utility method isn't adding much value. > Note: Was able to reproduce reported issue by setting `ParallelToolCallsEnabled = false` on `OpenAIAssistant_Streaming` demo and verify fix. Existing approach was able to handle parallel function calls and function calls on different steps adequetly. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
- Loading branch information