Skip to content
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

Fix streaming function calling #5718

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

SteveSandersonMS
Copy link
Member

@SteveSandersonMS SteveSandersonMS commented Dec 3, 2024

There was part of the FunctionInvokingChatClient implementation that I couldn't understand, and after investigation, I think it's a bug.

Our tests don't cover any cases where streaming returns multiple updates that contain function calls. I think that's a legitimate scenario, but I'm not sure that it can be modelled by the InvokeAndAssertStreamingAsync helper we use in those tests, because it treats each "plan" entry as the end of a response.

I've added a test showing what I think is this legitimate response format with multiple updates that have function calls. Without the fix in FunctionInvokingChatClient, it only removes one of the two FCCs from the result (and so the other one is both added to history and returned, which the method's XML docs say should not happen). The fix is completely trivial.

Microsoft Reviewers: Open in CodeFlow

@dotnet-comment-bot
Copy link
Collaborator

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.Diagnostics.Probes 70 76
Microsoft.Extensions.AI 83 84
Microsoft.Extensions.Caching.Hybrid 75 86
Microsoft.Extensions.AI.AzureAIInference 83 91

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=885239&view=codecoverage-tab

@stephentoub stephentoub enabled auto-merge (squash) December 3, 2024 19:59
@stephentoub stephentoub merged commit 6734c8f into main Dec 3, 2024
6 checks passed
@stephentoub stephentoub deleted the stevesa/fix-streaming-function-calling branch December 3, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants