@ai-sdk/google 3.0.46 → 3.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +13 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +13 -5
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-generative-ai-messages.ts +3 -0
- package/src/google-generative-ai-language-model.ts +28 -16
|
@@ -304,17 +304,23 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
304
304
|
: undefined,
|
|
305
305
|
});
|
|
306
306
|
} else if ('inlineData' in part) {
|
|
307
|
+
const hasThought = part.thought === true;
|
|
308
|
+
const hasThoughtSignature = !!part.thoughtSignature;
|
|
307
309
|
content.push({
|
|
308
310
|
type: 'file' as const,
|
|
309
311
|
data: part.inlineData.data,
|
|
310
312
|
mediaType: part.inlineData.mimeType,
|
|
311
|
-
providerMetadata:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
providerMetadata:
|
|
314
|
+
hasThought || hasThoughtSignature
|
|
315
|
+
? {
|
|
316
|
+
[providerOptionsName]: {
|
|
317
|
+
...(hasThought ? { thought: true } : {}),
|
|
318
|
+
...(hasThoughtSignature
|
|
319
|
+
? { thoughtSignature: part.thoughtSignature }
|
|
320
|
+
: {}),
|
|
321
|
+
},
|
|
322
|
+
}
|
|
323
|
+
: undefined,
|
|
318
324
|
});
|
|
319
325
|
}
|
|
320
326
|
}
|
|
@@ -590,19 +596,24 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
590
596
|
currentReasoningBlockId = null;
|
|
591
597
|
}
|
|
592
598
|
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
const hasThought = part.thought === true;
|
|
600
|
+
const hasThoughtSignature = !!part.thoughtSignature;
|
|
601
|
+
const fileMeta =
|
|
602
|
+
hasThought || hasThoughtSignature
|
|
603
|
+
? {
|
|
604
|
+
[providerOptionsName]: {
|
|
605
|
+
...(hasThought ? { thought: true } : {}),
|
|
606
|
+
...(hasThoughtSignature
|
|
607
|
+
? { thoughtSignature: part.thoughtSignature }
|
|
608
|
+
: {}),
|
|
609
|
+
},
|
|
610
|
+
}
|
|
611
|
+
: undefined;
|
|
601
612
|
controller.enqueue({
|
|
602
613
|
type: 'file',
|
|
603
614
|
mediaType: part.inlineData.mimeType,
|
|
604
615
|
data: part.inlineData.data,
|
|
605
|
-
providerMetadata:
|
|
616
|
+
providerMetadata: fileMeta,
|
|
606
617
|
});
|
|
607
618
|
}
|
|
608
619
|
}
|
|
@@ -935,6 +946,7 @@ const getContentSchema = () =>
|
|
|
935
946
|
mimeType: z.string(),
|
|
936
947
|
data: z.string(),
|
|
937
948
|
}),
|
|
949
|
+
thought: z.boolean().nullish(),
|
|
938
950
|
thoughtSignature: z.string().nullish(),
|
|
939
951
|
}),
|
|
940
952
|
z.object({
|