Fix streaming function call display in 04-semantic-kernel-tool.ipynb #244
+33
−1
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.
The
04-semantic-kernel-tool.ipynb
notebook was designed to display function call details in a collapsible section when the agent invokes tools, but this functionality was not working due to a limitation in the Semantic Kernel Python streaming API.Problem
The notebook code was correctly written to detect
FunctionCallContent
andFunctionResultContent
in streaming responses, but the Semantic Kernel Python streaming API (version 1.35.0) was only yieldingFunctionCallContent
andStreamingTextContent
, notFunctionResultContent
. This meant that while function calls were working correctly, users couldn't see the function call details that were supposed to appear in the "Function Calls" collapsible section.As shown in the issue screenshot, the agent successfully calls functions like
get_destinations()
andget_availability()
and provides correct responses, but the function call transparency features were missing.Root Cause
This was a known upstream issue in microsoft/semantic-kernel that was fixed in PR #9974 (merged December 18, 2024). The issue affected the streaming API where
FunctionResultContent
was not being yielded during streaming function calls.Solution
Implemented a backward-compatible workaround that:
FunctionCallContent
is received during streamingFunctionResultContent
FunctionResultContent
is not available in streamingKey Changes
Expected Behavior After Fix
When users run the notebook, they will now see:
This restores the intended transparency and debugging capabilities for tool use demonstrations.
Fixes #194.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.