OpenAIChatHistoryExtensions.AddStreamingMessageAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Add a message to the chat history at the end of the streamed message
public static System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingChatMessageContent> AddStreamingMessageAsync(this Microsoft.SemanticKernel.ChatCompletion.ChatHistory chatHistory, System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Connectors.OpenAI.OpenAIStreamingChatMessageContent> streamingMessageContents, bool includeToolCalls = false);
static member AddStreamingMessageAsync : Microsoft.SemanticKernel.ChatCompletion.ChatHistory * System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Connectors.OpenAI.OpenAIStreamingChatMessageContent> * bool -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingChatMessageContent>
<Extension()>
Public Function AddStreamingMessageAsync (chatHistory As ChatHistory, streamingMessageContents As IAsyncEnumerable(Of OpenAIStreamingChatMessageContent), Optional includeToolCalls As Boolean = false) As IAsyncEnumerable(Of StreamingChatMessageContent)
Parameters
- chatHistory
- ChatHistory
Target chat history
- streamingMessageContents
- IAsyncEnumerable<OpenAIStreamingChatMessageContent>
IAsyncEnumerator<T> list of streaming message contents
- includeToolCalls
- Boolean
The tool call information from the processed message will be ignored (false) by default.
Returns
Returns the original streaming results with some message processing
Remarks
Setting removeToolCalls to false should be only for manual tool calling scenarios, otherwise may result in the error below. See Issue 9458An assistant message with 'tool_calls' must be followed by tool messages