@ai-sdk/google 3.0.98 → 3.0.99
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.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-generative-ai-messages.ts +18 -7
package/dist/internal/index.js
CHANGED
|
@@ -377,6 +377,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
377
377
|
}
|
|
378
378
|
case "assistant": {
|
|
379
379
|
systemMessagesAllowed = false;
|
|
380
|
+
let modelResponseHasSignedFunctionCall = false;
|
|
380
381
|
contents.push({
|
|
381
382
|
role: "model",
|
|
382
383
|
parts: content.map((part) => {
|
|
@@ -417,8 +418,19 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
417
418
|
case "tool-call": {
|
|
418
419
|
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
419
420
|
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
420
|
-
const
|
|
421
|
-
|
|
421
|
+
const isServerToolCall = serverToolCallId != null && serverToolType != null;
|
|
422
|
+
const shouldSkipMissingSignatureMitigation = (
|
|
423
|
+
// Gemini 3 returns a single signature for a parallel
|
|
424
|
+
// function-call response on the first standard function
|
|
425
|
+
// call. Subsequent standard function calls in the same
|
|
426
|
+
// model response legitimately have no signature.
|
|
427
|
+
!isServerToolCall && thoughtSignature == null && modelResponseHasSignedFunctionCall
|
|
428
|
+
);
|
|
429
|
+
const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model && !shouldSkipMissingSignatureMitigation ? injectSkipSignature(part.toolName) : void 0;
|
|
430
|
+
if (!isServerToolCall && thoughtSignature != null) {
|
|
431
|
+
modelResponseHasSignedFunctionCall = true;
|
|
432
|
+
}
|
|
433
|
+
if (isServerToolCall) {
|
|
422
434
|
return {
|
|
423
435
|
toolCall: {
|
|
424
436
|
toolType: serverToolType,
|