Skip to content

Commit bf5192c

Browse files
committed
fix: Initialize ChatResponseUpdate.MessageId with ResponseId
Fixes #15327
1 parent 33229e0 commit bf5192c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

apis/Google.Cloud.VertexAI.Extensions/Google.Cloud.VertexAI.Extensions.Tests/BuildIChatClientTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,11 @@ public async Task IChatClient_GetStreamingResponseAsync_BasicStreaming()
17571757

17581758
string[] texts = [.. updates.Select(u => ((TextContent) u.Contents[0]).Text)];
17591759
Assert.Equal(["Hello", " world", "!"], texts);
1760+
string?[] messageIds = [.. updates.Select(u => u.MessageId)];
1761+
string?[] responseIds = [.. updates.Select(u => u.ResponseId)];
1762+
string[] expectedIds = ["response-1", "response-2", "response-3"];
1763+
Assert.Equal(expectedIds, messageIds);
1764+
Assert.Equal(expectedIds, responseIds);
17601765
}
17611766

17621767
[Fact]

apis/Google.Cloud.VertexAI.Extensions/Google.Cloud.VertexAI.Extensions/PredictionServiceChatClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(IEnu
104104
ModelId = !string.IsNullOrEmpty(generateResult.ModelVersion) ? generateResult.ModelVersion : request.Model,
105105
RawRepresentation = generateResult,
106106
ResponseId = generateResult.ResponseId,
107+
MessageId = generateResult.ResponseId,
107108
};
108109

109110
// Populate the response update contents.

0 commit comments

Comments
 (0)