@ai-sdk/google 3.0.0-beta.53 → 3.0.0-beta.54

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,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.54
4
+
5
+ ### Patch Changes
6
+
7
+ - bb28cac: Change streamText loop to merge file part processing into main parts loop
8
+
3
9
  ## 3.0.0-beta.53
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils13 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.0-beta.53" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.54" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -236,14 +236,16 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
236
236
  }
237
237
  if (type) {
238
238
  if (Array.isArray(type)) {
239
- if (type.includes("null")) {
240
- result.type = type.filter((t) => t !== "null")[0];
241
- result.nullable = true;
239
+ const hasNull = type.includes("null");
240
+ const nonNullTypes = type.filter((t) => t !== "null");
241
+ if (nonNullTypes.length === 0) {
242
+ result.type = "null";
242
243
  } else {
243
- result.type = type;
244
+ result.anyOf = nonNullTypes.map((t) => ({ type: t }));
245
+ if (hasNull) {
246
+ result.nullable = true;
247
+ }
244
248
  }
245
- } else if (type === "null") {
246
- result.type = "null";
247
249
  } else {
248
250
  result.type = type;
249
251
  }
@@ -718,7 +720,7 @@ function prepareTools({
718
720
  }
719
721
  if (toolChoice == null) {
720
722
  return {
721
- tools: { functionDeclarations },
723
+ tools: [{ functionDeclarations }],
722
724
  toolConfig: void 0,
723
725
  toolWarnings
724
726
  };
@@ -727,25 +729,25 @@ function prepareTools({
727
729
  switch (type) {
728
730
  case "auto":
729
731
  return {
730
- tools: { functionDeclarations },
732
+ tools: [{ functionDeclarations }],
731
733
  toolConfig: { functionCallingConfig: { mode: "AUTO" } },
732
734
  toolWarnings
733
735
  };
734
736
  case "none":
735
737
  return {
736
- tools: { functionDeclarations },
738
+ tools: [{ functionDeclarations }],
737
739
  toolConfig: { functionCallingConfig: { mode: "NONE" } },
738
740
  toolWarnings
739
741
  };
740
742
  case "required":
741
743
  return {
742
- tools: { functionDeclarations },
744
+ tools: [{ functionDeclarations }],
743
745
  toolConfig: { functionCallingConfig: { mode: "ANY" } },
744
746
  toolWarnings
745
747
  };
746
748
  case "tool":
747
749
  return {
748
- tools: { functionDeclarations },
750
+ tools: [{ functionDeclarations }],
749
751
  toolConfig: {
750
752
  functionCallingConfig: {
751
753
  mode: "ANY",
@@ -1162,11 +1164,7 @@ var GoogleGenerativeAILanguageModel = class {
1162
1164
  } : void 0
1163
1165
  });
1164
1166
  }
1165
- }
1166
- }
1167
- const inlineDataParts = getInlineDataParts(content.parts);
1168
- if (inlineDataParts != null) {
1169
- for (const part of inlineDataParts) {
1167
+ } else if ("inlineData" in part) {
1170
1168
  controller.enqueue({
1171
1169
  type: "file",
1172
1170
  mediaType: part.inlineData.mimeType,
@@ -1268,11 +1266,6 @@ function getToolCallsFromParts({
1268
1266
  providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
1269
1267
  }));
1270
1268
  }
1271
- function getInlineDataParts(parts) {
1272
- return parts == null ? void 0 : parts.filter(
1273
- (part) => "inlineData" in part
1274
- );
1275
- }
1276
1269
  function extractSources({
1277
1270
  groundingMetadata,
1278
1271
  generateId: generateId3