microsoft/semantic-kernel

Python: streaming tool calls with multiple indices are broken

Closed this issue · 0 comments

Describe the bug

When using function calling and streaming responses, the arguments from a non-zero index (aka a second or third tool call ID) are being added to the first tool call ID, showing arguments like {}{"city": "Boston"}.

The issue looks to be located in the StreamingChatMessageContent add override method, where once the FunctionCallContent is added for the first id, the enumerate loop has a break and subsequent tool call IDs don't have a chance to be processed.

https://github.com/microsoft/semantic-kernel/blob/b4bfef1115445ebb08cebfa79ca7a5be7924b3cb/python/semantic_kernel/contents/streaming_chat_message_content.py#L184C9-L196C50