Repository navigation
.Net: Report time to first content in chat reducer sample - #14197
Ilia Sokolov (ilia-sokolov) wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a latency metric to the .NET streaming chat-history reducer sample so users can see how long it takes before the first assistant text becomes available when chat-history reduction is enabled.
Changes:
- Start a per-turn
Stopwatchbefore initiating streaming and print elapsed time on the first non-empty text update. - Preserve existing response assembly and token usage aggregation while streaming.
- Add a fallback message for streams that produce no text content.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @microsoft/octo-semantickernel-pr-dotnet, could someone review this focused .NET sample change when you have a chance? It addresses #9580 by reporting reducer-inclusive time to first non-empty text, and reports stream-completion time separately for textless responses. The earlier Copilot feedback has been addressed. Please let me know whether this is still the desired scope or if any adjustments or additional validation would help. Thanks! |
Motivation and Context
The streaming chat-history reducer sample reports aggregate token usage but gives no indication of the latency users experience before the first response content becomes available.
This change addresses #9580 by making that latency visible for the reducer-enabled streaming path. The label explicitly states that chat-history reduction is included, avoiding the misleading implication that the value represents provider-only latency.
Description
The change is confined to
MultipleProviders_ChatHistoryReducer.cs, introduces no dependencies or public APIs, and intentionally avoids timing thresholds because provider latency is nondeterministic.Validation
The exact modified sample source compiled successfully with 0 warnings and 0 errors against the released Semantic Kernel 1.78 packages.
The repository-wide Concepts build and formatter traverse a large connector project graph and did not complete in the available validation window. The modified Semantic Kernel API expressions are unchanged from
main; the added implementation uses onlySystem.Diagnostics.Stopwatchand local control flow.Contribution Checklist