@ai-sdk/google 4.0.0-beta.17 → 4.0.0-beta.19

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
+ ## 4.0.0-beta.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 01fa606: feat(provider/google): support combining built-in tools with function calling on Gemini 3
8
+
9
+ ## 4.0.0-beta.18
10
+
11
+ ### Patch Changes
12
+
13
+ - 9715ec7: feat(provider/google): add support for service tier parameter
14
+
3
15
  ## 4.0.0-beta.17
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -39,6 +39,7 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
39
39
  longitude: number;
40
40
  } | undefined;
41
41
  } | undefined;
42
+ serviceTier?: "SERVICE_TIER_STANDARD" | "SERVICE_TIER_FLEX" | "SERVICE_TIER_PRIORITY" | undefined;
42
43
  }>;
43
44
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
44
45
 
@@ -58,6 +59,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
58
59
  };
59
60
  thought?: boolean | null | undefined;
60
61
  thoughtSignature?: string | null | undefined;
62
+ } | {
63
+ toolCall: {
64
+ toolType: string;
65
+ id: string;
66
+ args?: unknown;
67
+ };
68
+ thoughtSignature?: string | null | undefined;
69
+ } | {
70
+ toolResponse: {
71
+ toolType: string;
72
+ id: string;
73
+ response?: unknown;
74
+ };
75
+ thoughtSignature?: string | null | undefined;
61
76
  } | {
62
77
  executableCode?: {
63
78
  language: string;
@@ -155,6 +170,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
155
170
  blocked?: boolean | null | undefined;
156
171
  }[] | null | undefined;
157
172
  } | null | undefined;
173
+ serviceTier?: string | null | undefined;
158
174
  }>;
159
175
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
160
176
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
@@ -174,6 +190,7 @@ interface GoogleGenerativeAIProviderMetadata {
174
190
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
175
191
  usageMetadata: GoogleGenerativeAIUsageMetadata | null;
176
192
  finishMessage: string | null;
193
+ serviceTier: string | null;
177
194
  }
178
195
 
179
196
  type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
39
39
  longitude: number;
40
40
  } | undefined;
41
41
  } | undefined;
42
+ serviceTier?: "SERVICE_TIER_STANDARD" | "SERVICE_TIER_FLEX" | "SERVICE_TIER_PRIORITY" | undefined;
42
43
  }>;
43
44
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
44
45
 
@@ -58,6 +59,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
58
59
  };
59
60
  thought?: boolean | null | undefined;
60
61
  thoughtSignature?: string | null | undefined;
62
+ } | {
63
+ toolCall: {
64
+ toolType: string;
65
+ id: string;
66
+ args?: unknown;
67
+ };
68
+ thoughtSignature?: string | null | undefined;
69
+ } | {
70
+ toolResponse: {
71
+ toolType: string;
72
+ id: string;
73
+ response?: unknown;
74
+ };
75
+ thoughtSignature?: string | null | undefined;
61
76
  } | {
62
77
  executableCode?: {
63
78
  language: string;
@@ -155,6 +170,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
155
170
  blocked?: boolean | null | undefined;
156
171
  }[] | null | undefined;
157
172
  } | null | undefined;
173
+ serviceTier?: string | null | undefined;
158
174
  }>;
159
175
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
160
176
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
@@ -174,6 +190,7 @@ interface GoogleGenerativeAIProviderMetadata {
174
190
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
175
191
  usageMetadata: GoogleGenerativeAIUsageMetadata | null;
176
192
  finishMessage: string | null;
193
+ serviceTier: string | null;
177
194
  }
178
195
 
179
196
  type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
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 ? "4.0.0-beta.17" : "0.0.0-test";
33
+ var VERSION = true ? "4.0.0-beta.19" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -505,7 +505,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
505
505
  }
506
506
  }
507
507
  function convertToGoogleGenerativeAIMessages(prompt, options) {
508
- var _a, _b, _c, _d;
508
+ var _a, _b, _c, _d, _e, _f, _g, _h;
509
509
  const systemInstructionParts = [];
510
510
  const contents = [];
511
511
  let systemMessagesAllowed = true;
@@ -607,6 +607,18 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
607
607
  };
608
608
  }
609
609
  case "tool-call": {
610
+ const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
611
+ const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
612
+ if (serverToolCallId && serverToolType) {
613
+ return {
614
+ toolCall: {
615
+ toolType: serverToolType,
616
+ args: typeof part.input === "string" ? JSON.parse(part.input) : part.input,
617
+ id: serverToolCallId
618
+ },
619
+ thoughtSignature
620
+ };
621
+ }
610
622
  return {
611
623
  functionCall: {
612
624
  name: part.toolName,
@@ -615,6 +627,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
615
627
  thoughtSignature
616
628
  };
617
629
  }
630
+ case "tool-result": {
631
+ const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
632
+ const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
633
+ if (serverToolCallId && serverToolType) {
634
+ return {
635
+ toolResponse: {
636
+ toolType: serverToolType,
637
+ response: part.output.type === "json" ? part.output.value : {},
638
+ id: serverToolCallId
639
+ },
640
+ thoughtSignature
641
+ };
642
+ }
643
+ return void 0;
644
+ }
618
645
  }
619
646
  }).filter((part) => part !== void 0)
620
647
  });
@@ -627,6 +654,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
627
654
  if (part.type === "tool-approval-response") {
628
655
  continue;
629
656
  }
657
+ const partProviderOpts = (_g = (_d = part.providerOptions) == null ? void 0 : _d[providerOptionsName]) != null ? _g : providerOptionsName !== "google" ? (_e = part.providerOptions) == null ? void 0 : _e.google : (_f = part.providerOptions) == null ? void 0 : _f.vertex;
658
+ const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
659
+ const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
660
+ if (serverToolCallId && serverToolType) {
661
+ const serverThoughtSignature = (partProviderOpts == null ? void 0 : partProviderOpts.thoughtSignature) != null ? String(partProviderOpts.thoughtSignature) : void 0;
662
+ if (contents.length > 0) {
663
+ const lastContent = contents[contents.length - 1];
664
+ if (lastContent.role === "model") {
665
+ lastContent.parts.push({
666
+ toolResponse: {
667
+ toolType: serverToolType,
668
+ response: part.output.type === "json" ? part.output.value : {},
669
+ id: serverToolCallId
670
+ },
671
+ thoughtSignature: serverThoughtSignature
672
+ });
673
+ continue;
674
+ }
675
+ }
676
+ }
630
677
  const output = part.output;
631
678
  if (output.type === "content") {
632
679
  if (supportsFunctionResponseParts) {
@@ -640,7 +687,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
640
687
  name: part.toolName,
641
688
  response: {
642
689
  name: part.toolName,
643
- content: output.type === "execution-denied" ? (_d = output.reason) != null ? _d : "Tool execution denied." : output.value
690
+ content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
644
691
  }
645
692
  }
646
693
  });
@@ -786,7 +833,15 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
786
833
  latitude: import_v44.z.number(),
787
834
  longitude: import_v44.z.number()
788
835
  }).optional()
789
- }).optional()
836
+ }).optional(),
837
+ /**
838
+ * Optional. The service tier to use for the request.
839
+ */
840
+ serviceTier: import_v44.z.enum([
841
+ "SERVICE_TIER_STANDARD",
842
+ "SERVICE_TIER_FLEX",
843
+ "SERVICE_TIER_PRIORITY"
844
+ ]).optional()
790
845
  })
791
846
  )
792
847
  );
@@ -798,7 +853,7 @@ function prepareTools({
798
853
  toolChoice,
799
854
  modelId
800
855
  }) {
801
- var _a;
856
+ var _a, _b;
802
857
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
803
858
  const toolWarnings = [];
804
859
  const isLatest = [
@@ -807,13 +862,14 @@ function prepareTools({
807
862
  "gemini-pro-latest"
808
863
  ].some((id) => id === modelId);
809
864
  const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || modelId.includes("nano-banana") || isLatest;
865
+ const isGemini3orNewer = modelId.includes("gemini-3");
810
866
  const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
811
867
  if (tools == null) {
812
868
  return { tools: void 0, toolConfig: void 0, toolWarnings };
813
869
  }
814
870
  const hasFunctionTools = tools.some((tool) => tool.type === "function");
815
871
  const hasProviderTools = tools.some((tool) => tool.type === "provider");
816
- if (hasFunctionTools && hasProviderTools) {
872
+ if (hasFunctionTools && hasProviderTools && !isGemini3orNewer) {
817
873
  toolWarnings.push({
818
874
  type: "unsupported",
819
875
  feature: `combination of function and provider-defined tools`
@@ -918,6 +974,45 @@ function prepareTools({
918
974
  break;
919
975
  }
920
976
  });
977
+ if (hasFunctionTools && isGemini3orNewer && googleTools2.length > 0) {
978
+ const functionDeclarations2 = [];
979
+ for (const tool of tools) {
980
+ if (tool.type === "function") {
981
+ functionDeclarations2.push({
982
+ name: tool.name,
983
+ description: (_a = tool.description) != null ? _a : "",
984
+ parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
985
+ });
986
+ }
987
+ }
988
+ const combinedToolConfig = {
989
+ functionCallingConfig: { mode: "VALIDATED" },
990
+ includeServerSideToolInvocations: true
991
+ };
992
+ if (toolChoice != null) {
993
+ switch (toolChoice.type) {
994
+ case "auto":
995
+ break;
996
+ case "none":
997
+ combinedToolConfig.functionCallingConfig = { mode: "NONE" };
998
+ break;
999
+ case "required":
1000
+ combinedToolConfig.functionCallingConfig = { mode: "ANY" };
1001
+ break;
1002
+ case "tool":
1003
+ combinedToolConfig.functionCallingConfig = {
1004
+ mode: "ANY",
1005
+ allowedFunctionNames: [toolChoice.toolName]
1006
+ };
1007
+ break;
1008
+ }
1009
+ }
1010
+ return {
1011
+ tools: [...googleTools2, { functionDeclarations: functionDeclarations2 }],
1012
+ toolConfig: combinedToolConfig,
1013
+ toolWarnings
1014
+ };
1015
+ }
921
1016
  return {
922
1017
  tools: googleTools2.length > 0 ? googleTools2 : void 0,
923
1018
  toolConfig: void 0,
@@ -931,7 +1026,7 @@ function prepareTools({
931
1026
  case "function":
932
1027
  functionDeclarations.push({
933
1028
  name: tool.name,
934
- description: (_a = tool.description) != null ? _a : "",
1029
+ description: (_b = tool.description) != null ? _b : "",
935
1030
  parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
936
1031
  });
937
1032
  if (tool.strict === true) {
@@ -1147,14 +1242,15 @@ var GoogleGenerativeAILanguageModel = class {
1147
1242
  retrievalConfig: googleOptions.retrievalConfig
1148
1243
  } : googleToolConfig,
1149
1244
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
1150
- labels: googleOptions == null ? void 0 : googleOptions.labels
1245
+ labels: googleOptions == null ? void 0 : googleOptions.labels,
1246
+ serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
1151
1247
  },
1152
1248
  warnings: [...warnings, ...toolWarnings],
1153
1249
  providerOptionsName
1154
1250
  };
1155
1251
  }
1156
1252
  async doGenerate(options) {
1157
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1253
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1158
1254
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
1159
1255
  const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
1160
1256
  await (0, import_provider_utils6.resolve)(this.config.headers),
@@ -1180,6 +1276,7 @@ var GoogleGenerativeAILanguageModel = class {
1180
1276
  const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
1181
1277
  const usageMetadata = response.usageMetadata;
1182
1278
  let lastCodeExecutionToolCallId;
1279
+ let lastServerToolCallId;
1183
1280
  for (const part of parts) {
1184
1281
  if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
1185
1282
  const toolCallId = this.config.generateId();
@@ -1246,12 +1343,56 @@ var GoogleGenerativeAILanguageModel = class {
1246
1343
  }
1247
1344
  } : void 0
1248
1345
  });
1346
+ } else if ("toolCall" in part && part.toolCall) {
1347
+ const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
1348
+ lastServerToolCallId = toolCallId;
1349
+ content.push({
1350
+ type: "tool-call",
1351
+ toolCallId,
1352
+ toolName: `server:${part.toolCall.toolType}`,
1353
+ input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
1354
+ providerExecuted: true,
1355
+ dynamic: true,
1356
+ providerMetadata: part.thoughtSignature ? {
1357
+ [providerOptionsName]: {
1358
+ thoughtSignature: part.thoughtSignature,
1359
+ serverToolCallId: toolCallId,
1360
+ serverToolType: part.toolCall.toolType
1361
+ }
1362
+ } : {
1363
+ [providerOptionsName]: {
1364
+ serverToolCallId: toolCallId,
1365
+ serverToolType: part.toolCall.toolType
1366
+ }
1367
+ }
1368
+ });
1369
+ } else if ("toolResponse" in part && part.toolResponse) {
1370
+ const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
1371
+ content.push({
1372
+ type: "tool-result",
1373
+ toolCallId: responseToolCallId,
1374
+ toolName: `server:${part.toolResponse.toolType}`,
1375
+ result: (_h = part.toolResponse.response) != null ? _h : {},
1376
+ providerMetadata: part.thoughtSignature ? {
1377
+ [providerOptionsName]: {
1378
+ thoughtSignature: part.thoughtSignature,
1379
+ serverToolCallId: responseToolCallId,
1380
+ serverToolType: part.toolResponse.toolType
1381
+ }
1382
+ } : {
1383
+ [providerOptionsName]: {
1384
+ serverToolCallId: responseToolCallId,
1385
+ serverToolType: part.toolResponse.toolType
1386
+ }
1387
+ }
1388
+ });
1389
+ lastServerToolCallId = void 0;
1249
1390
  }
1250
1391
  }
1251
- const sources = (_e = extractSources({
1392
+ const sources = (_i = extractSources({
1252
1393
  groundingMetadata: candidate.groundingMetadata,
1253
1394
  generateId: this.config.generateId
1254
- })) != null ? _e : [];
1395
+ })) != null ? _i : [];
1255
1396
  for (const source of sources) {
1256
1397
  content.push(source);
1257
1398
  }
@@ -1265,18 +1406,19 @@ var GoogleGenerativeAILanguageModel = class {
1265
1406
  (part) => part.type === "tool-call" && !part.providerExecuted
1266
1407
  )
1267
1408
  }),
1268
- raw: (_f = candidate.finishReason) != null ? _f : void 0
1409
+ raw: (_j = candidate.finishReason) != null ? _j : void 0
1269
1410
  },
1270
1411
  usage: convertGoogleGenerativeAIUsage(usageMetadata),
1271
1412
  warnings,
1272
1413
  providerMetadata: {
1273
1414
  [providerOptionsName]: {
1274
- promptFeedback: (_g = response.promptFeedback) != null ? _g : null,
1275
- groundingMetadata: (_h = candidate.groundingMetadata) != null ? _h : null,
1276
- urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
1277
- safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
1415
+ promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
1416
+ groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
1417
+ urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
1418
+ safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
1278
1419
  usageMetadata: usageMetadata != null ? usageMetadata : null,
1279
- finishMessage: (_k = candidate.finishMessage) != null ? _k : null
1420
+ finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
1421
+ serviceTier: (_p = response.serviceTier) != null ? _p : null
1280
1422
  }
1281
1423
  },
1282
1424
  request: { body: args },
@@ -1312,6 +1454,7 @@ var GoogleGenerativeAILanguageModel = class {
1312
1454
  let providerMetadata = void 0;
1313
1455
  let lastGroundingMetadata = null;
1314
1456
  let lastUrlContextMetadata = null;
1457
+ let serviceTier = null;
1315
1458
  const generateId3 = this.config.generateId;
1316
1459
  let hasToolCalls = false;
1317
1460
  let currentTextBlockId = null;
@@ -1319,6 +1462,7 @@ var GoogleGenerativeAILanguageModel = class {
1319
1462
  let blockCounter = 0;
1320
1463
  const emittedSourceUrls = /* @__PURE__ */ new Set();
1321
1464
  let lastCodeExecutionToolCallId;
1465
+ let lastServerToolCallId;
1322
1466
  return {
1323
1467
  stream: response.pipeThrough(
1324
1468
  new TransformStream({
@@ -1326,7 +1470,7 @@ var GoogleGenerativeAILanguageModel = class {
1326
1470
  controller.enqueue({ type: "stream-start", warnings });
1327
1471
  },
1328
1472
  transform(chunk, controller) {
1329
- var _a, _b, _c, _d, _e, _f, _g;
1473
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1330
1474
  if (options.includeRawChunks) {
1331
1475
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1332
1476
  }
@@ -1339,6 +1483,9 @@ var GoogleGenerativeAILanguageModel = class {
1339
1483
  if (usageMetadata != null) {
1340
1484
  usage = usageMetadata;
1341
1485
  }
1486
+ if (value.serviceTier != null) {
1487
+ serviceTier = value.serviceTier;
1488
+ }
1342
1489
  const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
1343
1490
  if (candidate == null) {
1344
1491
  return;
@@ -1477,6 +1624,42 @@ var GoogleGenerativeAILanguageModel = class {
1477
1624
  data: part.inlineData.data,
1478
1625
  providerMetadata: fileMeta
1479
1626
  });
1627
+ } else if ("toolCall" in part && part.toolCall) {
1628
+ const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
1629
+ lastServerToolCallId = toolCallId;
1630
+ const serverMeta = {
1631
+ [providerOptionsName]: {
1632
+ ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
1633
+ serverToolCallId: toolCallId,
1634
+ serverToolType: part.toolCall.toolType
1635
+ }
1636
+ };
1637
+ controller.enqueue({
1638
+ type: "tool-call",
1639
+ toolCallId,
1640
+ toolName: `server:${part.toolCall.toolType}`,
1641
+ input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
1642
+ providerExecuted: true,
1643
+ dynamic: true,
1644
+ providerMetadata: serverMeta
1645
+ });
1646
+ } else if ("toolResponse" in part && part.toolResponse) {
1647
+ const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
1648
+ const serverMeta = {
1649
+ [providerOptionsName]: {
1650
+ ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
1651
+ serverToolCallId: responseToolCallId,
1652
+ serverToolType: part.toolResponse.toolType
1653
+ }
1654
+ };
1655
+ controller.enqueue({
1656
+ type: "tool-result",
1657
+ toolCallId: responseToolCallId,
1658
+ toolName: `server:${part.toolResponse.toolType}`,
1659
+ result: (_h = part.toolResponse.response) != null ? _h : {},
1660
+ providerMetadata: serverMeta
1661
+ });
1662
+ lastServerToolCallId = void 0;
1480
1663
  }
1481
1664
  }
1482
1665
  const toolCallDeltas = getToolCallsFromParts({
@@ -1524,12 +1707,13 @@ var GoogleGenerativeAILanguageModel = class {
1524
1707
  };
1525
1708
  providerMetadata = {
1526
1709
  [providerOptionsName]: {
1527
- promptFeedback: (_e = value.promptFeedback) != null ? _e : null,
1710
+ promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
1528
1711
  groundingMetadata: lastGroundingMetadata,
1529
1712
  urlContextMetadata: lastUrlContextMetadata,
1530
- safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null,
1713
+ safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
1531
1714
  usageMetadata: usageMetadata != null ? usageMetadata : null,
1532
- finishMessage: (_g = candidate.finishMessage) != null ? _g : null
1715
+ finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
1716
+ serviceTier
1533
1717
  }
1534
1718
  };
1535
1719
  }
@@ -1812,6 +1996,22 @@ var getContentSchema = () => import_v45.z.object({
1812
1996
  thought: import_v45.z.boolean().nullish(),
1813
1997
  thoughtSignature: import_v45.z.string().nullish()
1814
1998
  }),
1999
+ import_v45.z.object({
2000
+ toolCall: import_v45.z.object({
2001
+ toolType: import_v45.z.string(),
2002
+ args: import_v45.z.unknown().nullish(),
2003
+ id: import_v45.z.string()
2004
+ }),
2005
+ thoughtSignature: import_v45.z.string().nullish()
2006
+ }),
2007
+ import_v45.z.object({
2008
+ toolResponse: import_v45.z.object({
2009
+ toolType: import_v45.z.string(),
2010
+ response: import_v45.z.unknown().nullish(),
2011
+ id: import_v45.z.string()
2012
+ }),
2013
+ thoughtSignature: import_v45.z.string().nullish()
2014
+ }),
1815
2015
  import_v45.z.object({
1816
2016
  executableCode: import_v45.z.object({
1817
2017
  language: import_v45.z.string(),
@@ -1870,7 +2070,8 @@ var responseSchema = (0, import_provider_utils6.lazySchema)(
1870
2070
  promptFeedback: import_v45.z.object({
1871
2071
  blockReason: import_v45.z.string().nullish(),
1872
2072
  safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
1873
- }).nullish()
2073
+ }).nullish(),
2074
+ serviceTier: import_v45.z.string().nullish()
1874
2075
  })
1875
2076
  )
1876
2077
  );
@@ -1891,7 +2092,8 @@ var chunkSchema = (0, import_provider_utils6.lazySchema)(
1891
2092
  promptFeedback: import_v45.z.object({
1892
2093
  blockReason: import_v45.z.string().nullish(),
1893
2094
  safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
1894
- }).nullish()
2095
+ }).nullish(),
2096
+ serviceTier: import_v45.z.string().nullish()
1895
2097
  })
1896
2098
  )
1897
2099
  );