@ai-sdk/google-vertex 5.0.0-beta.45 → 5.0.0-beta.47

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.
@@ -1,56 +1,45 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/edge/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- createVertex: () => createVertex2,
24
- vertex: () => vertex
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
1
  // src/edge/google-vertex-provider-edge.ts
29
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
2
+ import { loadOptionalSetting as loadOptionalSetting3, resolve as resolve5 } from "@ai-sdk/provider-utils";
30
3
 
31
4
  // src/google-vertex-provider.ts
32
- var import_internal3 = require("@ai-sdk/google/internal");
33
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
5
+ import { GoogleGenerativeAILanguageModel as GoogleGenerativeAILanguageModel2 } from "@ai-sdk/google/internal";
6
+ import {
7
+ generateId,
8
+ loadOptionalSetting,
9
+ loadSetting,
10
+ normalizeHeaders,
11
+ resolve as resolve4,
12
+ withoutTrailingSlash,
13
+ withUserAgentSuffix
14
+ } from "@ai-sdk/provider-utils";
34
15
 
35
16
  // src/version.ts
36
- var VERSION = true ? "5.0.0-beta.45" : "0.0.0-test";
17
+ var VERSION = true ? "5.0.0-beta.47" : "0.0.0-test";
37
18
 
38
19
  // src/google-vertex-embedding-model.ts
39
- var import_provider = require("@ai-sdk/provider");
40
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
41
- var import_v43 = require("zod/v4");
20
+ import {
21
+ TooManyEmbeddingValuesForCallError
22
+ } from "@ai-sdk/provider";
23
+ import {
24
+ combineHeaders,
25
+ createJsonResponseHandler,
26
+ postJsonToApi,
27
+ resolve,
28
+ parseProviderOptions
29
+ } from "@ai-sdk/provider-utils";
30
+ import { z as z3 } from "zod/v4";
42
31
 
43
32
  // src/google-vertex-error.ts
44
- var import_provider_utils = require("@ai-sdk/provider-utils");
45
- var import_v4 = require("zod/v4");
46
- var googleVertexErrorDataSchema = import_v4.z.object({
47
- error: import_v4.z.object({
48
- code: import_v4.z.number().nullable(),
49
- message: import_v4.z.string(),
50
- status: import_v4.z.string()
33
+ import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
34
+ import { z } from "zod/v4";
35
+ var googleVertexErrorDataSchema = z.object({
36
+ error: z.object({
37
+ code: z.number().nullable(),
38
+ message: z.string(),
39
+ status: z.string()
51
40
  })
52
41
  });
53
- var googleVertexFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)(
42
+ var googleVertexFailedResponseHandler = createJsonErrorResponseHandler(
54
43
  {
55
44
  errorSchema: googleVertexErrorDataSchema,
56
45
  errorToMessage: (data) => data.error.message
@@ -58,13 +47,13 @@ var googleVertexFailedResponseHandler = (0, import_provider_utils.createJsonErro
58
47
  );
59
48
 
60
49
  // src/google-vertex-embedding-options.ts
61
- var import_v42 = require("zod/v4");
62
- var googleVertexEmbeddingModelOptions = import_v42.z.object({
50
+ import { z as z2 } from "zod/v4";
51
+ var googleVertexEmbeddingModelOptions = z2.object({
63
52
  /**
64
53
  * Optional. Optional reduced dimension for the output embedding.
65
54
  * If set, excessive values in the output embedding are truncated from the end.
66
55
  */
67
- outputDimensionality: import_v42.z.number().optional(),
56
+ outputDimensionality: z2.number().optional(),
68
57
  /**
69
58
  * Optional. Specifies the task type for generating embeddings.
70
59
  * Supported task types:
@@ -77,7 +66,7 @@ var googleVertexEmbeddingModelOptions = import_v42.z.object({
77
66
  * - FACT_VERIFICATION: Optimized for verifying factual information.
78
67
  * - CODE_RETRIEVAL_QUERY: Optimized for retrieving code blocks based on natural language queries.
79
68
  */
80
- taskType: import_v42.z.enum([
69
+ taskType: z2.enum([
81
70
  "SEMANTIC_SIMILARITY",
82
71
  "CLASSIFICATION",
83
72
  "CLUSTERING",
@@ -92,12 +81,12 @@ var googleVertexEmbeddingModelOptions = import_v42.z.object({
92
81
  * Only valid when task_type is set to 'RETRIEVAL_DOCUMENT'.
93
82
  * Helps the model produce better embeddings by providing additional context.
94
83
  */
95
- title: import_v42.z.string().optional(),
84
+ title: z2.string().optional(),
96
85
  /**
97
86
  * Optional. When set to true, input text will be truncated. When set to false,
98
87
  * an error is returned if the input text is longer than the maximum length supported by the model. Defaults to true.
99
88
  */
100
- autoTruncate: import_v42.z.boolean().optional()
89
+ autoTruncate: z2.boolean().optional()
101
90
  });
102
91
 
103
92
  // src/google-vertex-embedding-model.ts
@@ -118,13 +107,13 @@ var GoogleVertexEmbeddingModel = class {
118
107
  abortSignal,
119
108
  providerOptions
120
109
  }) {
121
- let googleOptions = await (0, import_provider_utils2.parseProviderOptions)({
110
+ let googleOptions = await parseProviderOptions({
122
111
  provider: "vertex",
123
112
  providerOptions,
124
113
  schema: googleVertexEmbeddingModelOptions
125
114
  });
126
115
  if (googleOptions == null) {
127
- googleOptions = await (0, import_provider_utils2.parseProviderOptions)({
116
+ googleOptions = await parseProviderOptions({
128
117
  provider: "google",
129
118
  providerOptions,
130
119
  schema: googleVertexEmbeddingModelOptions
@@ -132,15 +121,15 @@ var GoogleVertexEmbeddingModel = class {
132
121
  }
133
122
  googleOptions = googleOptions != null ? googleOptions : {};
134
123
  if (values.length > this.maxEmbeddingsPerCall) {
135
- throw new import_provider.TooManyEmbeddingValuesForCallError({
124
+ throw new TooManyEmbeddingValuesForCallError({
136
125
  provider: this.provider,
137
126
  modelId: this.modelId,
138
127
  maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
139
128
  values
140
129
  });
141
130
  }
142
- const mergedHeaders = (0, import_provider_utils2.combineHeaders)(
143
- await (0, import_provider_utils2.resolve)(this.config.headers),
131
+ const mergedHeaders = combineHeaders(
132
+ await resolve(this.config.headers),
144
133
  headers
145
134
  );
146
135
  const url = `${this.config.baseURL}/models/${this.modelId}:predict`;
@@ -148,7 +137,7 @@ var GoogleVertexEmbeddingModel = class {
148
137
  responseHeaders,
149
138
  value: response,
150
139
  rawValue
151
- } = await (0, import_provider_utils2.postJsonToApi)({
140
+ } = await postJsonToApi({
152
141
  url,
153
142
  headers: mergedHeaders,
154
143
  body: {
@@ -163,7 +152,7 @@ var GoogleVertexEmbeddingModel = class {
163
152
  }
164
153
  },
165
154
  failedResponseHandler: googleVertexFailedResponseHandler,
166
- successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
155
+ successfulResponseHandler: createJsonResponseHandler(
167
156
  googleVertexTextEmbeddingResponseSchema
168
157
  ),
169
158
  abortSignal,
@@ -184,13 +173,13 @@ var GoogleVertexEmbeddingModel = class {
184
173
  };
185
174
  }
186
175
  };
187
- var googleVertexTextEmbeddingResponseSchema = import_v43.z.object({
188
- predictions: import_v43.z.array(
189
- import_v43.z.object({
190
- embeddings: import_v43.z.object({
191
- values: import_v43.z.array(import_v43.z.number()),
192
- statistics: import_v43.z.object({
193
- token_count: import_v43.z.number()
176
+ var googleVertexTextEmbeddingResponseSchema = z3.object({
177
+ predictions: z3.array(
178
+ z3.object({
179
+ embeddings: z3.object({
180
+ values: z3.array(z3.number()),
181
+ statistics: z3.object({
182
+ token_count: z3.number()
194
183
  })
195
184
  })
196
185
  })
@@ -198,9 +187,18 @@ var googleVertexTextEmbeddingResponseSchema = import_v43.z.object({
198
187
  });
199
188
 
200
189
  // src/google-vertex-image-model.ts
201
- var import_internal = require("@ai-sdk/google/internal");
202
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
203
- var import_v44 = require("zod/v4");
190
+ import { GoogleGenerativeAILanguageModel } from "@ai-sdk/google/internal";
191
+ import {
192
+ combineHeaders as combineHeaders2,
193
+ convertToBase64,
194
+ convertUint8ArrayToBase64,
195
+ createJsonResponseHandler as createJsonResponseHandler2,
196
+ generateId as defaultGenerateId,
197
+ parseProviderOptions as parseProviderOptions2,
198
+ postJsonToApi as postJsonToApi2,
199
+ resolve as resolve2
200
+ } from "@ai-sdk/provider-utils";
201
+ import { z as z4 } from "zod/v4";
204
202
  var GoogleVertexImageModel = class {
205
203
  constructor(modelId, config) {
206
204
  this.modelId = modelId;
@@ -243,7 +241,7 @@ var GoogleVertexImageModel = class {
243
241
  details: "This model does not support the `size` option. Use `aspectRatio` instead."
244
242
  });
245
243
  }
246
- const vertexImageOptions = await (0, import_provider_utils3.parseProviderOptions)({
244
+ const vertexImageOptions = await parseProviderOptions2({
247
245
  provider: "vertex",
248
246
  providerOptions,
249
247
  schema: googleVertexImageModelOptionsSchema
@@ -305,12 +303,12 @@ var GoogleVertexImageModel = class {
305
303
  };
306
304
  }
307
305
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
308
- const { value: response, responseHeaders } = await (0, import_provider_utils3.postJsonToApi)({
306
+ const { value: response, responseHeaders } = await postJsonToApi2({
309
307
  url: `${this.config.baseURL}/models/${this.modelId}:predict`,
310
- headers: (0, import_provider_utils3.combineHeaders)(await (0, import_provider_utils3.resolve)(this.config.headers), headers),
308
+ headers: combineHeaders2(await resolve2(this.config.headers), headers),
311
309
  body,
312
310
  failedResponseHandler: googleVertexFailedResponseHandler,
313
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
311
+ successfulResponseHandler: createJsonResponseHandler2(
314
312
  vertexImageResponseSchema
315
313
  ),
316
314
  abortSignal,
@@ -394,12 +392,12 @@ var GoogleVertexImageModel = class {
394
392
  const languageModelPrompt = [
395
393
  { role: "user", content: userContent }
396
394
  ];
397
- const languageModel = new import_internal.GoogleGenerativeAILanguageModel(this.modelId, {
395
+ const languageModel = new GoogleGenerativeAILanguageModel(this.modelId, {
398
396
  provider: this.config.provider,
399
397
  baseURL: this.config.baseURL,
400
398
  headers: (_a = this.config.headers) != null ? _a : {},
401
399
  fetch: this.config.fetch,
402
- generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils3.generateId,
400
+ generateId: (_b = this.config.generateId) != null ? _b : defaultGenerateId,
403
401
  supportedUrls: () => ({
404
402
  "*": [/^https?:\/\/.*$/, /^gs:\/\/.*$/]
405
403
  })
@@ -423,7 +421,7 @@ var GoogleVertexImageModel = class {
423
421
  const images = [];
424
422
  for (const part of result.content) {
425
423
  if (part.type === "file" && part.mediaType.startsWith("image/")) {
426
- images.push((0, import_provider_utils3.convertToBase64)(part.data));
424
+ images.push(convertToBase64(part.data));
427
425
  }
428
426
  }
429
427
  return {
@@ -450,41 +448,41 @@ var GoogleVertexImageModel = class {
450
448
  function isGeminiModel(modelId) {
451
449
  return modelId.startsWith("gemini-");
452
450
  }
453
- var vertexImageResponseSchema = import_v44.z.object({
454
- predictions: import_v44.z.array(
455
- import_v44.z.object({
456
- bytesBase64Encoded: import_v44.z.string(),
457
- mimeType: import_v44.z.string(),
458
- prompt: import_v44.z.string().nullish()
451
+ var vertexImageResponseSchema = z4.object({
452
+ predictions: z4.array(
453
+ z4.object({
454
+ bytesBase64Encoded: z4.string(),
455
+ mimeType: z4.string(),
456
+ prompt: z4.string().nullish()
459
457
  })
460
458
  ).nullish()
461
459
  });
462
- var googleVertexImageModelOptionsSchema = import_v44.z.object({
463
- negativePrompt: import_v44.z.string().nullish(),
464
- personGeneration: import_v44.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
465
- safetySetting: import_v44.z.enum([
460
+ var googleVertexImageModelOptionsSchema = z4.object({
461
+ negativePrompt: z4.string().nullish(),
462
+ personGeneration: z4.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
463
+ safetySetting: z4.enum([
466
464
  "block_low_and_above",
467
465
  "block_medium_and_above",
468
466
  "block_only_high",
469
467
  "block_none"
470
468
  ]).nullish(),
471
- addWatermark: import_v44.z.boolean().nullish(),
472
- storageUri: import_v44.z.string().nullish(),
473
- sampleImageSize: import_v44.z.enum(["1K", "2K"]).nullish(),
469
+ addWatermark: z4.boolean().nullish(),
470
+ storageUri: z4.string().nullish(),
471
+ sampleImageSize: z4.enum(["1K", "2K"]).nullish(),
474
472
  /**
475
473
  * Configuration for image editing operations
476
474
  */
477
- edit: import_v44.z.object({
475
+ edit: z4.object({
478
476
  /**
479
477
  * An integer that represents the number of sampling steps.
480
478
  * A higher value offers better image quality, a lower value offers better latency.
481
479
  * Try 35 steps to start. If the quality doesn't meet your requirements,
482
480
  * increase the value towards an upper limit of 75.
483
481
  */
484
- baseSteps: import_v44.z.number().nullish(),
482
+ baseSteps: z4.number().nullish(),
485
483
  // Edit mode options
486
484
  // https://cloud.google.com/vertex-ai/generative-ai/docs/image/edit-insert-objects
487
- mode: import_v44.z.enum([
485
+ mode: z4.enum([
488
486
  "EDIT_MODE_INPAINT_INSERTION",
489
487
  "EDIT_MODE_INPAINT_REMOVAL",
490
488
  "EDIT_MODE_OUTPAINT",
@@ -500,7 +498,7 @@ var googleVertexImageModelOptionsSchema = import_v44.z.object({
500
498
  * - `MASK_MODE_CLOTHING_AREA` - Masks from segmenting the clothing area with open-vocab segmentation.
501
499
  * - `MASK_MODE_PARSED_PERSON` - Masks from segmenting the person body and clothing using the person-parsing model.
502
500
  */
503
- maskMode: import_v44.z.enum([
501
+ maskMode: z4.enum([
504
502
  "MASK_MODE_DEFAULT",
505
503
  "MASK_MODE_USER_PROVIDED",
506
504
  "MASK_MODE_DETECTION_BOX",
@@ -512,7 +510,7 @@ var googleVertexImageModelOptionsSchema = import_v44.z.object({
512
510
  * percentage of the image width to grow the mask by. Using dilation helps
513
511
  * compensate for imprecise masks. We recommend a value of 0.01.
514
512
  */
515
- maskDilation: import_v44.z.number().nullish()
513
+ maskDilation: z4.number().nullish()
516
514
  }).nullish()
517
515
  });
518
516
  function getBase64Data(file) {
@@ -524,25 +522,37 @@ function getBase64Data(file) {
524
522
  if (typeof file.data === "string") {
525
523
  return file.data;
526
524
  }
527
- return (0, import_provider_utils3.convertUint8ArrayToBase64)(file.data);
525
+ return convertUint8ArrayToBase64(file.data);
528
526
  }
529
527
 
530
528
  // src/google-vertex-tools.ts
531
- var import_internal2 = require("@ai-sdk/google/internal");
529
+ import { googleTools } from "@ai-sdk/google/internal";
532
530
  var googleVertexTools = {
533
- googleSearch: import_internal2.googleTools.googleSearch,
534
- enterpriseWebSearch: import_internal2.googleTools.enterpriseWebSearch,
535
- googleMaps: import_internal2.googleTools.googleMaps,
536
- urlContext: import_internal2.googleTools.urlContext,
537
- fileSearch: import_internal2.googleTools.fileSearch,
538
- codeExecution: import_internal2.googleTools.codeExecution,
539
- vertexRagStore: import_internal2.googleTools.vertexRagStore
531
+ googleSearch: googleTools.googleSearch,
532
+ enterpriseWebSearch: googleTools.enterpriseWebSearch,
533
+ googleMaps: googleTools.googleMaps,
534
+ urlContext: googleTools.urlContext,
535
+ fileSearch: googleTools.fileSearch,
536
+ codeExecution: googleTools.codeExecution,
537
+ vertexRagStore: googleTools.vertexRagStore
540
538
  };
541
539
 
542
540
  // src/google-vertex-video-model.ts
543
- var import_provider2 = require("@ai-sdk/provider");
544
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
545
- var import_v45 = require("zod/v4");
541
+ import {
542
+ AISDKError
543
+ } from "@ai-sdk/provider";
544
+ import {
545
+ combineHeaders as combineHeaders3,
546
+ convertUint8ArrayToBase64 as convertUint8ArrayToBase642,
547
+ createJsonResponseHandler as createJsonResponseHandler3,
548
+ delay,
549
+ lazySchema,
550
+ parseProviderOptions as parseProviderOptions3,
551
+ postJsonToApi as postJsonToApi3,
552
+ resolve as resolve3,
553
+ zodSchema
554
+ } from "@ai-sdk/provider-utils";
555
+ import { z as z5 } from "zod/v4";
546
556
  var GoogleVertexVideoModel = class {
547
557
  constructor(modelId, config) {
548
558
  this.modelId = modelId;
@@ -559,7 +569,7 @@ var GoogleVertexVideoModel = class {
559
569
  var _a, _b, _c, _d, _e, _f;
560
570
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
561
571
  const warnings = [];
562
- const vertexOptions = await (0, import_provider_utils4.parseProviderOptions)({
572
+ const vertexOptions = await parseProviderOptions3({
563
573
  provider: "vertex",
564
574
  providerOptions: options.providerOptions,
565
575
  schema: googleVertexVideoModelOptionsSchema
@@ -577,7 +587,7 @@ var GoogleVertexVideoModel = class {
577
587
  details: "Vertex AI video models require base64-encoded images or GCS URIs. URL will be ignored."
578
588
  });
579
589
  } else {
580
- const base64Data = typeof options.image.data === "string" ? options.image.data : (0, import_provider_utils4.convertUint8ArrayToBase64)(options.image.data);
590
+ const base64Data = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase642(options.image.data);
581
591
  instance.image = {
582
592
  bytesBase64Encoded: base64Data,
583
593
  mimeType: options.image.mediaType
@@ -635,17 +645,17 @@ var GoogleVertexVideoModel = class {
635
645
  }
636
646
  }
637
647
  }
638
- const { value: operation } = await (0, import_provider_utils4.postJsonToApi)({
648
+ const { value: operation } = await postJsonToApi3({
639
649
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
640
- headers: (0, import_provider_utils4.combineHeaders)(
641
- await (0, import_provider_utils4.resolve)(this.config.headers),
650
+ headers: combineHeaders3(
651
+ await resolve3(this.config.headers),
642
652
  options.headers
643
653
  ),
644
654
  body: {
645
655
  instances,
646
656
  parameters
647
657
  },
648
- successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
658
+ successfulResponseHandler: createJsonResponseHandler3(
649
659
  vertexOperationSchema
650
660
  ),
651
661
  failedResponseHandler: googleVertexFailedResponseHandler,
@@ -654,7 +664,7 @@ var GoogleVertexVideoModel = class {
654
664
  });
655
665
  const operationName = operation.name;
656
666
  if (!operationName) {
657
- throw new import_provider2.AISDKError({
667
+ throw new AISDKError({
658
668
  name: "VERTEX_VIDEO_GENERATION_ERROR",
659
669
  message: "No operation name returned from API"
660
670
  });
@@ -666,28 +676,28 @@ var GoogleVertexVideoModel = class {
666
676
  let responseHeaders;
667
677
  while (!finalOperation.done) {
668
678
  if (Date.now() - startTime > pollTimeoutMs) {
669
- throw new import_provider2.AISDKError({
679
+ throw new AISDKError({
670
680
  name: "VERTEX_VIDEO_GENERATION_TIMEOUT",
671
681
  message: `Video generation timed out after ${pollTimeoutMs}ms`
672
682
  });
673
683
  }
674
- await (0, import_provider_utils4.delay)(pollIntervalMs);
684
+ await delay(pollIntervalMs);
675
685
  if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
676
- throw new import_provider2.AISDKError({
686
+ throw new AISDKError({
677
687
  name: "VERTEX_VIDEO_GENERATION_ABORTED",
678
688
  message: "Video generation request was aborted"
679
689
  });
680
690
  }
681
- const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils4.postJsonToApi)({
691
+ const { value: statusOperation, responseHeaders: pollHeaders } = await postJsonToApi3({
682
692
  url: `${this.config.baseURL}/models/${this.modelId}:fetchPredictOperation`,
683
- headers: (0, import_provider_utils4.combineHeaders)(
684
- await (0, import_provider_utils4.resolve)(this.config.headers),
693
+ headers: combineHeaders3(
694
+ await resolve3(this.config.headers),
685
695
  options.headers
686
696
  ),
687
697
  body: {
688
698
  operationName
689
699
  },
690
- successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
700
+ successfulResponseHandler: createJsonResponseHandler3(
691
701
  vertexOperationSchema
692
702
  ),
693
703
  failedResponseHandler: googleVertexFailedResponseHandler,
@@ -698,14 +708,14 @@ var GoogleVertexVideoModel = class {
698
708
  responseHeaders = pollHeaders;
699
709
  }
700
710
  if (finalOperation.error) {
701
- throw new import_provider2.AISDKError({
711
+ throw new AISDKError({
702
712
  name: "VERTEX_VIDEO_GENERATION_FAILED",
703
713
  message: `Video generation failed: ${finalOperation.error.message}`
704
714
  });
705
715
  }
706
716
  const response = finalOperation.response;
707
717
  if (!(response == null ? void 0 : response.videos) || response.videos.length === 0) {
708
- throw new import_provider2.AISDKError({
718
+ throw new AISDKError({
709
719
  name: "VERTEX_VIDEO_GENERATION_ERROR",
710
720
  message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
711
721
  });
@@ -735,7 +745,7 @@ var GoogleVertexVideoModel = class {
735
745
  }
736
746
  }
737
747
  if (videos.length === 0) {
738
- throw new import_provider2.AISDKError({
748
+ throw new AISDKError({
739
749
  name: "VERTEX_VIDEO_GENERATION_ERROR",
740
750
  message: "No valid videos in response"
741
751
  });
@@ -756,38 +766,38 @@ var GoogleVertexVideoModel = class {
756
766
  };
757
767
  }
758
768
  };
759
- var vertexOperationSchema = import_v45.z.object({
760
- name: import_v45.z.string().nullish(),
761
- done: import_v45.z.boolean().nullish(),
762
- error: import_v45.z.object({
763
- code: import_v45.z.number().nullish(),
764
- message: import_v45.z.string(),
765
- status: import_v45.z.string().nullish()
769
+ var vertexOperationSchema = z5.object({
770
+ name: z5.string().nullish(),
771
+ done: z5.boolean().nullish(),
772
+ error: z5.object({
773
+ code: z5.number().nullish(),
774
+ message: z5.string(),
775
+ status: z5.string().nullish()
766
776
  }).nullish(),
767
- response: import_v45.z.object({
768
- videos: import_v45.z.array(
769
- import_v45.z.object({
770
- bytesBase64Encoded: import_v45.z.string().nullish(),
771
- gcsUri: import_v45.z.string().nullish(),
772
- mimeType: import_v45.z.string().nullish()
777
+ response: z5.object({
778
+ videos: z5.array(
779
+ z5.object({
780
+ bytesBase64Encoded: z5.string().nullish(),
781
+ gcsUri: z5.string().nullish(),
782
+ mimeType: z5.string().nullish()
773
783
  })
774
784
  ).nullish(),
775
- raiMediaFilteredCount: import_v45.z.number().nullish()
785
+ raiMediaFilteredCount: z5.number().nullish()
776
786
  }).nullish()
777
787
  });
778
- var googleVertexVideoModelOptionsSchema = (0, import_provider_utils4.lazySchema)(
779
- () => (0, import_provider_utils4.zodSchema)(
780
- import_v45.z.object({
781
- pollIntervalMs: import_v45.z.number().positive().nullish(),
782
- pollTimeoutMs: import_v45.z.number().positive().nullish(),
783
- personGeneration: import_v45.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
784
- negativePrompt: import_v45.z.string().nullish(),
785
- generateAudio: import_v45.z.boolean().nullish(),
786
- gcsOutputDirectory: import_v45.z.string().nullish(),
787
- referenceImages: import_v45.z.array(
788
- import_v45.z.object({
789
- bytesBase64Encoded: import_v45.z.string().nullish(),
790
- gcsUri: import_v45.z.string().nullish()
788
+ var googleVertexVideoModelOptionsSchema = lazySchema(
789
+ () => zodSchema(
790
+ z5.object({
791
+ pollIntervalMs: z5.number().positive().nullish(),
792
+ pollTimeoutMs: z5.number().positive().nullish(),
793
+ personGeneration: z5.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
794
+ negativePrompt: z5.string().nullish(),
795
+ generateAudio: z5.boolean().nullish(),
796
+ gcsOutputDirectory: z5.string().nullish(),
797
+ referenceImages: z5.array(
798
+ z5.object({
799
+ bytesBase64Encoded: z5.string().nullish(),
800
+ gcsUri: z5.string().nullish()
791
801
  })
792
802
  ).nullish()
793
803
  }).passthrough()
@@ -801,7 +811,7 @@ function createExpressModeFetch(apiKey, customFetch) {
801
811
  const modifiedInit = {
802
812
  ...init,
803
813
  headers: {
804
- ...(init == null ? void 0 : init.headers) ? (0, import_provider_utils5.normalizeHeaders)(init.headers) : {},
814
+ ...(init == null ? void 0 : init.headers) ? normalizeHeaders(init.headers) : {},
805
815
  "x-goog-api-key": apiKey
806
816
  }
807
817
  };
@@ -809,17 +819,17 @@ function createExpressModeFetch(apiKey, customFetch) {
809
819
  };
810
820
  }
811
821
  function createVertex(options = {}) {
812
- const apiKey = (0, import_provider_utils5.loadOptionalSetting)({
822
+ const apiKey = loadOptionalSetting({
813
823
  settingValue: options.apiKey,
814
824
  environmentVariableName: "GOOGLE_VERTEX_API_KEY"
815
825
  });
816
- const loadVertexProject = () => (0, import_provider_utils5.loadSetting)({
826
+ const loadVertexProject = () => loadSetting({
817
827
  settingValue: options.project,
818
828
  settingName: "project",
819
829
  environmentVariableName: "GOOGLE_VERTEX_PROJECT",
820
830
  description: "Google Vertex project"
821
831
  });
822
- const loadVertexLocation = () => (0, import_provider_utils5.loadSetting)({
832
+ const loadVertexLocation = () => loadSetting({
823
833
  settingValue: options.location,
824
834
  settingName: "location",
825
835
  environmentVariableName: "GOOGLE_VERTEX_LOCATION",
@@ -828,18 +838,18 @@ function createVertex(options = {}) {
828
838
  const loadBaseURL = () => {
829
839
  var _a, _b;
830
840
  if (apiKey) {
831
- return (_a = (0, import_provider_utils5.withoutTrailingSlash)(options.baseURL)) != null ? _a : EXPRESS_MODE_BASE_URL;
841
+ return (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : EXPRESS_MODE_BASE_URL;
832
842
  }
833
843
  const region = loadVertexLocation();
834
844
  const project = loadVertexProject();
835
845
  const baseHost = `${region === "global" ? "" : region + "-"}aiplatform.googleapis.com`;
836
- return (_b = (0, import_provider_utils5.withoutTrailingSlash)(options.baseURL)) != null ? _b : `https://${baseHost}/v1beta1/projects/${project}/locations/${region}/publishers/google`;
846
+ return (_b = withoutTrailingSlash(options.baseURL)) != null ? _b : `https://${baseHost}/v1beta1/projects/${project}/locations/${region}/publishers/google`;
837
847
  };
838
848
  const createConfig = (name) => {
839
849
  const getHeaders = async () => {
840
850
  var _a;
841
- const originalHeaders = await (0, import_provider_utils5.resolve)((_a = options.headers) != null ? _a : {});
842
- return (0, import_provider_utils5.withUserAgentSuffix)(
851
+ const originalHeaders = await resolve4((_a = options.headers) != null ? _a : {});
852
+ return withUserAgentSuffix(
843
853
  originalHeaders,
844
854
  `ai-sdk/google-vertex/${VERSION}`
845
855
  );
@@ -853,9 +863,9 @@ function createVertex(options = {}) {
853
863
  };
854
864
  const createChatModel = (modelId) => {
855
865
  var _a;
856
- return new import_internal3.GoogleGenerativeAILanguageModel(modelId, {
866
+ return new GoogleGenerativeAILanguageModel2(modelId, {
857
867
  ...createConfig("chat"),
858
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils5.generateId,
868
+ generateId: (_a = options.generateId) != null ? _a : generateId,
859
869
  supportedUrls: () => ({
860
870
  "*": [
861
871
  // HTTP URLs:
@@ -871,14 +881,14 @@ function createVertex(options = {}) {
871
881
  var _a;
872
882
  return new GoogleVertexImageModel(modelId, {
873
883
  ...createConfig("image"),
874
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils5.generateId
884
+ generateId: (_a = options.generateId) != null ? _a : generateId
875
885
  });
876
886
  };
877
887
  const createVideoModel = (modelId) => {
878
888
  var _a;
879
889
  return new GoogleVertexVideoModel(modelId, {
880
890
  ...createConfig("video"),
881
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils5.generateId
891
+ generateId: (_a = options.generateId) != null ? _a : generateId
882
892
  });
883
893
  };
884
894
  const provider = function(modelId) {
@@ -902,23 +912,28 @@ function createVertex(options = {}) {
902
912
  }
903
913
 
904
914
  // src/edge/google-vertex-auth-edge.ts
905
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
915
+ import {
916
+ loadOptionalSetting as loadOptionalSetting2,
917
+ loadSetting as loadSetting2,
918
+ withUserAgentSuffix as withUserAgentSuffix2,
919
+ getRuntimeEnvironmentUserAgent
920
+ } from "@ai-sdk/provider-utils";
906
921
  var loadCredentials = async () => {
907
922
  try {
908
923
  return {
909
- clientEmail: (0, import_provider_utils6.loadSetting)({
924
+ clientEmail: loadSetting2({
910
925
  settingValue: void 0,
911
926
  settingName: "clientEmail",
912
927
  environmentVariableName: "GOOGLE_CLIENT_EMAIL",
913
928
  description: "Google client email"
914
929
  }),
915
- privateKey: (0, import_provider_utils6.loadSetting)({
930
+ privateKey: loadSetting2({
916
931
  settingValue: void 0,
917
932
  settingName: "privateKey",
918
933
  environmentVariableName: "GOOGLE_PRIVATE_KEY",
919
934
  description: "Google private key"
920
935
  }),
921
- privateKeyId: (0, import_provider_utils6.loadOptionalSetting)({
936
+ privateKeyId: loadOptionalSetting2({
922
937
  settingValue: void 0,
923
938
  environmentVariableName: "GOOGLE_PRIVATE_KEY_ID"
924
939
  })
@@ -987,10 +1002,10 @@ async function generateAuthToken(credentials) {
987
1002
  const jwt = await buildJwt(creds);
988
1003
  const response = await fetch("https://oauth2.googleapis.com/token", {
989
1004
  method: "POST",
990
- headers: (0, import_provider_utils6.withUserAgentSuffix)(
1005
+ headers: withUserAgentSuffix2(
991
1006
  { "Content-Type": "application/x-www-form-urlencoded" },
992
1007
  `ai-sdk/google-vertex/${VERSION}`,
993
- (0, import_provider_utils6.getRuntimeEnvironmentUserAgent)()
1008
+ getRuntimeEnvironmentUserAgent()
994
1009
  ),
995
1010
  body: new URLSearchParams({
996
1011
  grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
@@ -1009,7 +1024,7 @@ async function generateAuthToken(credentials) {
1009
1024
 
1010
1025
  // src/edge/google-vertex-provider-edge.ts
1011
1026
  function createVertex2(options = {}) {
1012
- const apiKey = (0, import_provider_utils7.loadOptionalSetting)({
1027
+ const apiKey = loadOptionalSetting3({
1013
1028
  settingValue: options.apiKey,
1014
1029
  environmentVariableName: "GOOGLE_VERTEX_API_KEY"
1015
1030
  });
@@ -1022,14 +1037,13 @@ function createVertex2(options = {}) {
1022
1037
  Authorization: `Bearer ${await generateAuthToken(
1023
1038
  options.googleCredentials
1024
1039
  )}`,
1025
- ...await (0, import_provider_utils7.resolve)(options.headers)
1040
+ ...await resolve5(options.headers)
1026
1041
  })
1027
1042
  });
1028
1043
  }
1029
1044
  var vertex = createVertex2();
1030
- // Annotate the CommonJS export names for ESM import in node:
1031
- 0 && (module.exports = {
1032
- createVertex,
1045
+ export {
1046
+ createVertex2 as createVertex,
1033
1047
  vertex
1034
- });
1048
+ };
1035
1049
  //# sourceMappingURL=index.js.map