Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion dotnet/src/Connectors/Connectors.OpenAI/AzureSdk/ClientCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,18 @@ internal async IAsyncEnumerable<OpenAIStreamingChatMessageContent> GetStreamingC
OpenAIFunctionToolCall.TrackStreamingToolingUpdate(update.ToolCallUpdate, ref toolCallIdsByIndex, ref functionNamesByIndex, ref functionArgumentBuildersByIndex);
}

var openAIStreamingChatMessageContent = new OpenAIStreamingChatMessageContent(update, update.ChoiceIndex ?? 0, this.DeploymentOrModelName, metadata) { AuthorName = streamedName };
AuthorRole? role = null;
if (streamedRole.HasValue)
{
role = new AuthorRole(streamedRole.Value.ToString());
}

OpenAIStreamingChatMessageContent openAIStreamingChatMessageContent =
new(update, update.ChoiceIndex ?? 0, this.DeploymentOrModelName, metadata)
{
AuthorName = streamedName,
Role = role,
Comment thread
dmytrostruk marked this conversation as resolved.
};
Comment thread
crickman marked this conversation as resolved.

if (update.ToolCallUpdate is StreamingFunctionToolCallUpdate functionCallUpdate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public async Task AzureOpenAIStreamingTestAsync(bool useChatModel, string prompt
// Act
await foreach (var content in target.InvokeStreamingAsync<StreamingKernelContent>(plugins["ChatPlugin"]["Chat"], new() { [InputParameterName] = prompt }))
{
if (content is StreamingChatMessageContent messageContent)
{
Assert.NotNull(messageContent.Role);
}

fullResult.Append(content);
}

Expand Down