@ai-sdk/google 4.0.0-beta.22 → 4.0.0-beta.23

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.
@@ -323,19 +323,36 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
323
323
  }
324
324
  case "file": {
325
325
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
326
- parts.push(
327
- part.data instanceof URL ? {
326
+ if (part.data instanceof URL) {
327
+ parts.push({
328
328
  fileData: {
329
329
  mimeType: mediaType,
330
330
  fileUri: part.data.toString()
331
331
  }
332
- } : {
332
+ });
333
+ } else if ((0, import_provider_utils.isProviderReference)(part.data)) {
334
+ if (providerOptionsName === "vertex") {
335
+ throw new import_provider.UnsupportedFunctionalityError({
336
+ functionality: "file parts with provider references"
337
+ });
338
+ }
339
+ parts.push({
340
+ fileData: {
341
+ mimeType: mediaType,
342
+ fileUri: (0, import_provider_utils.resolveProviderReference)({
343
+ reference: part.data,
344
+ provider: "google"
345
+ })
346
+ }
347
+ });
348
+ } else {
349
+ parts.push({
333
350
  inlineData: {
334
351
  mimeType: mediaType,
335
352
  data: (0, import_provider_utils.convertToBase64)(part.data)
336
353
  }
337
- }
338
- );
354
+ });
355
+ }
339
356
  break;
340
357
  }
341
358
  }
@@ -386,6 +403,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
386
403
  functionality: "File data URLs in assistant messages are not supported"
387
404
  });
388
405
  }
406
+ if ((0, import_provider_utils.isProviderReference)(part.data)) {
407
+ if (providerOptionsName === "vertex") {
408
+ throw new import_provider.UnsupportedFunctionalityError({
409
+ functionality: "file parts with provider references"
410
+ });
411
+ }
412
+ return {
413
+ fileData: {
414
+ mimeType: part.mediaType,
415
+ fileUri: (0, import_provider_utils.resolveProviderReference)({
416
+ reference: part.data,
417
+ provider: "google"
418
+ })
419
+ },
420
+ ...(providerOpts == null ? void 0 : providerOpts.thought) === true ? { thought: true } : {},
421
+ thoughtSignature
422
+ };
423
+ }
389
424
  return {
390
425
  inlineData: {
391
426
  mimeType: part.mediaType,