fix(ai): expose provider response ids on assistant messages fixes #2245

This commit is contained in:
Mario Zechner
2026-03-17 17:11:18 +01:00
parent 18d90b5c48
commit dd53eb56ee
11 changed files with 174 additions and 1 deletions
+3
View File
@@ -86,6 +86,9 @@ export const streamGoogle: StreamFunction<"google-generative-ai", GoogleOptions>
const blocks = output.content;
const blockIndex = () => blocks.length - 1;
for await (const chunk of googleStream) {
// @google/genai documents GenerateContentResponse.responseId as an output-only field
// used to identify each response. Keep the first non-empty one from the stream.
output.responseId ||= chunk.responseId;
const candidate = chunk.candidates?.[0];
if (candidate?.content?.parts) {
for (const part of candidate.content.parts) {