@ai-sdk/google 3.0.61 → 3.0.63
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 +12 -0
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +19 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +19 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/google-generative-ai-language-model.ts +34 -20
- package/src/google-generative-ai-options.ts +10 -2
package/dist/internal/index.mjs
CHANGED
|
@@ -617,9 +617,10 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
617
617
|
/**
|
|
618
618
|
* Optional. When set to true, function call arguments will be streamed
|
|
619
619
|
* incrementally via partialArgs in streaming responses. Only supported
|
|
620
|
-
* on the Vertex AI API (not the Gemini API)
|
|
620
|
+
* on the Vertex AI API (not the Gemini API) and only for Gemini 3+
|
|
621
|
+
* models.
|
|
621
622
|
*
|
|
622
|
-
* @default
|
|
623
|
+
* @default false
|
|
623
624
|
*
|
|
624
625
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
625
626
|
*/
|
|
@@ -631,6 +632,11 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
631
632
|
})
|
|
632
633
|
)
|
|
633
634
|
);
|
|
635
|
+
var VertexServiceTierMap = {
|
|
636
|
+
standard: "SERVICE_TIER_STANDARD",
|
|
637
|
+
flex: "SERVICE_TIER_FLEX",
|
|
638
|
+
priority: "SERVICE_TIER_PRIORITY"
|
|
639
|
+
};
|
|
634
640
|
|
|
635
641
|
// src/google-prepare-tools.ts
|
|
636
642
|
import {
|
|
@@ -1163,7 +1169,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1163
1169
|
tools,
|
|
1164
1170
|
toolChoice,
|
|
1165
1171
|
providerOptions
|
|
1166
|
-
}) {
|
|
1172
|
+
}, { isStreaming = false } = {}) {
|
|
1167
1173
|
var _a, _b;
|
|
1168
1174
|
const warnings = [];
|
|
1169
1175
|
const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
|
|
@@ -1194,6 +1200,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1194
1200
|
message: `'streamFunctionCallArguments' is only supported on the Vertex AI API and will be ignored with the current Google provider (${this.config.provider}). See https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc`
|
|
1195
1201
|
});
|
|
1196
1202
|
}
|
|
1203
|
+
let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1204
|
+
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
1205
|
+
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
1206
|
+
}
|
|
1197
1207
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1198
1208
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
1199
1209
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
@@ -1213,7 +1223,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1213
1223
|
toolChoice,
|
|
1214
1224
|
modelId: this.modelId
|
|
1215
1225
|
});
|
|
1216
|
-
const streamFunctionCallArguments = isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a :
|
|
1226
|
+
const streamFunctionCallArguments = isStreaming && isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : false : void 0;
|
|
1217
1227
|
const toolConfig = googleToolConfig || streamFunctionCallArguments || (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
|
|
1218
1228
|
...googleToolConfig,
|
|
1219
1229
|
...streamFunctionCallArguments && {
|
|
@@ -1264,7 +1274,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1264
1274
|
toolConfig,
|
|
1265
1275
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1266
1276
|
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1267
|
-
serviceTier:
|
|
1277
|
+
serviceTier: sanitizedServiceTier
|
|
1268
1278
|
},
|
|
1269
1279
|
warnings: [...warnings, ...toolWarnings],
|
|
1270
1280
|
providerOptionsName
|
|
@@ -1452,7 +1462,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1452
1462
|
};
|
|
1453
1463
|
}
|
|
1454
1464
|
async doStream(options) {
|
|
1455
|
-
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
1465
|
+
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
1466
|
+
options,
|
|
1467
|
+
{ isStreaming: true }
|
|
1468
|
+
);
|
|
1456
1469
|
const headers = combineHeaders(
|
|
1457
1470
|
await resolve(this.config.headers),
|
|
1458
1471
|
options.headers
|