@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.
@@ -630,9 +630,10 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
630
630
  /**
631
631
  * Optional. When set to true, function call arguments will be streamed
632
632
  * incrementally via partialArgs in streaming responses. Only supported
633
- * on the Vertex AI API (not the Gemini API).
633
+ * on the Vertex AI API (not the Gemini API) and only for Gemini 3+
634
+ * models.
634
635
  *
635
- * @default true
636
+ * @default false
636
637
  *
637
638
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
638
639
  */
@@ -644,6 +645,11 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
644
645
  })
645
646
  )
646
647
  );
648
+ var VertexServiceTierMap = {
649
+ standard: "SERVICE_TIER_STANDARD",
650
+ flex: "SERVICE_TIER_FLEX",
651
+ priority: "SERVICE_TIER_PRIORITY"
652
+ };
647
653
 
648
654
  // src/google-prepare-tools.ts
649
655
  var import_provider2 = require("@ai-sdk/provider");
@@ -1174,7 +1180,7 @@ var GoogleGenerativeAILanguageModel = class {
1174
1180
  tools,
1175
1181
  toolChoice,
1176
1182
  providerOptions
1177
- }) {
1183
+ }, { isStreaming = false } = {}) {
1178
1184
  var _a, _b;
1179
1185
  const warnings = [];
1180
1186
  const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
@@ -1205,6 +1211,10 @@ var GoogleGenerativeAILanguageModel = class {
1205
1211
  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`
1206
1212
  });
1207
1213
  }
1214
+ let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
1215
+ if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
1216
+ sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
1217
+ }
1208
1218
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1209
1219
  const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
1210
1220
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
@@ -1224,7 +1234,7 @@ var GoogleGenerativeAILanguageModel = class {
1224
1234
  toolChoice,
1225
1235
  modelId: this.modelId
1226
1236
  });
1227
- const streamFunctionCallArguments = isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : true : void 0;
1237
+ const streamFunctionCallArguments = isStreaming && isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : false : void 0;
1228
1238
  const toolConfig = googleToolConfig || streamFunctionCallArguments || (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
1229
1239
  ...googleToolConfig,
1230
1240
  ...streamFunctionCallArguments && {
@@ -1275,7 +1285,7 @@ var GoogleGenerativeAILanguageModel = class {
1275
1285
  toolConfig,
1276
1286
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
1277
1287
  labels: googleOptions == null ? void 0 : googleOptions.labels,
1278
- serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
1288
+ serviceTier: sanitizedServiceTier
1279
1289
  },
1280
1290
  warnings: [...warnings, ...toolWarnings],
1281
1291
  providerOptionsName
@@ -1463,7 +1473,10 @@ var GoogleGenerativeAILanguageModel = class {
1463
1473
  };
1464
1474
  }
1465
1475
  async doStream(options) {
1466
- const { args, warnings, providerOptionsName } = await this.getArgs(options);
1476
+ const { args, warnings, providerOptionsName } = await this.getArgs(
1477
+ options,
1478
+ { isStreaming: true }
1479
+ );
1467
1480
  const headers = (0, import_provider_utils4.combineHeaders)(
1468
1481
  await (0, import_provider_utils4.resolve)(this.config.headers),
1469
1482
  options.headers