@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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.63
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e1a5ab: fix(google): fix `serviceTier` to be correctly formatted for Vertex API
8
+
9
+ ## 3.0.62
10
+
11
+ ### Patch Changes
12
+
13
+ - 46a3584: fix(google-vertex): don't send streamFunctionCallArguments for unary API calls and change default to false
14
+
3
15
  ## 3.0.61
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.61" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.63" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -822,9 +822,10 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
822
822
  /**
823
823
  * Optional. When set to true, function call arguments will be streamed
824
824
  * incrementally via partialArgs in streaming responses. Only supported
825
- * on the Vertex AI API (not the Gemini API).
825
+ * on the Vertex AI API (not the Gemini API) and only for Gemini 3+
826
+ * models.
826
827
  *
827
- * @default true
828
+ * @default false
828
829
  *
829
830
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
830
831
  */
@@ -836,6 +837,11 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
836
837
  })
837
838
  )
838
839
  );
840
+ var VertexServiceTierMap = {
841
+ standard: "SERVICE_TIER_STANDARD",
842
+ flex: "SERVICE_TIER_FLEX",
843
+ priority: "SERVICE_TIER_PRIORITY"
844
+ };
839
845
 
840
846
  // src/google-prepare-tools.ts
841
847
  var import_provider3 = require("@ai-sdk/provider");
@@ -1366,7 +1372,7 @@ var GoogleGenerativeAILanguageModel = class {
1366
1372
  tools,
1367
1373
  toolChoice,
1368
1374
  providerOptions
1369
- }) {
1375
+ }, { isStreaming = false } = {}) {
1370
1376
  var _a, _b;
1371
1377
  const warnings = [];
1372
1378
  const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
@@ -1397,6 +1403,10 @@ var GoogleGenerativeAILanguageModel = class {
1397
1403
  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`
1398
1404
  });
1399
1405
  }
1406
+ let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
1407
+ if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
1408
+ sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
1409
+ }
1400
1410
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1401
1411
  const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
1402
1412
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
@@ -1416,7 +1426,7 @@ var GoogleGenerativeAILanguageModel = class {
1416
1426
  toolChoice,
1417
1427
  modelId: this.modelId
1418
1428
  });
1419
- const streamFunctionCallArguments = isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : true : void 0;
1429
+ const streamFunctionCallArguments = isStreaming && isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : false : void 0;
1420
1430
  const toolConfig = googleToolConfig || streamFunctionCallArguments || (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
1421
1431
  ...googleToolConfig,
1422
1432
  ...streamFunctionCallArguments && {
@@ -1467,7 +1477,7 @@ var GoogleGenerativeAILanguageModel = class {
1467
1477
  toolConfig,
1468
1478
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
1469
1479
  labels: googleOptions == null ? void 0 : googleOptions.labels,
1470
- serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
1480
+ serviceTier: sanitizedServiceTier
1471
1481
  },
1472
1482
  warnings: [...warnings, ...toolWarnings],
1473
1483
  providerOptionsName
@@ -1655,7 +1665,10 @@ var GoogleGenerativeAILanguageModel = class {
1655
1665
  };
1656
1666
  }
1657
1667
  async doStream(options) {
1658
- const { args, warnings, providerOptionsName } = await this.getArgs(options);
1668
+ const { args, warnings, providerOptionsName } = await this.getArgs(
1669
+ options,
1670
+ { isStreaming: true }
1671
+ );
1659
1672
  const headers = (0, import_provider_utils6.combineHeaders)(
1660
1673
  await (0, import_provider_utils6.resolve)(this.config.headers),
1661
1674
  options.headers