@ai-sdk/google-vertex 4.0.189 → 4.0.193

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,38 @@
1
1
  # @ai-sdk/google-vertex
2
2
 
3
+ ## 4.0.193
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [35430d7]
8
+ - @ai-sdk/google@3.0.118
9
+
10
+ ## 4.0.192
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [b068651]
15
+ - @ai-sdk/google@3.0.117
16
+
17
+ ## 4.0.191
18
+
19
+ ### Patch Changes
20
+
21
+ - cfdc8df: feat (provider/google, provider/google-vertex): Gemini 3.5 Transcribe support — unary transcription (`gemini-3.5-transcribe`) via generateContent with language detection, speaker diarization, word timestamps, custom vocabulary, and `mode: 'VERBATIM' | 'SMART'` transcription formatting
22
+ - Updated dependencies [9a1656e]
23
+ - Updated dependencies [cfdc8df]
24
+ - @ai-sdk/google@3.0.116
25
+
26
+ ## 4.0.190
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [9a521b9]
31
+ - @ai-sdk/provider-utils@4.0.49
32
+ - @ai-sdk/anthropic@3.0.114
33
+ - @ai-sdk/google@3.0.115
34
+ - @ai-sdk/openai-compatible@2.0.73
35
+
3
36
  ## 4.0.189
4
37
 
5
38
  ### Patch Changes
@@ -32,7 +32,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
32
32
  var import_provider_utils = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "4.0.189" : "0.0.0-test";
35
+ var VERSION = true ? "4.0.193" : "0.0.0-test";
36
36
 
37
37
  // src/edge/google-vertex-auth-edge.ts
38
38
  var loadCredentials = async () => {
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "4.0.189" : "0.0.0-test";
13
+ var VERSION = true ? "4.0.193" : "0.0.0-test";
14
14
 
15
15
  // src/edge/google-vertex-auth-edge.ts
16
16
  var loadCredentials = async () => {
@@ -26,14 +26,14 @@ __export(index_exports, {
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
28
  // src/edge/google-vertex-provider-edge.ts
29
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
29
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
30
30
 
31
31
  // src/google-vertex-provider.ts
32
32
  var import_internal3 = require("@ai-sdk/google/internal");
33
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
33
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
34
34
 
35
35
  // src/version.ts
36
- var VERSION = true ? "4.0.189" : "0.0.0-test";
36
+ var VERSION = true ? "4.0.193" : "0.0.0-test";
37
37
 
38
38
  // src/google-vertex-embedding-model.ts
39
39
  var import_provider = require("@ai-sdk/provider");
@@ -758,10 +758,214 @@ var googleVertexTranscriptionResponseSchema = import_v46.z.object({
758
758
  }).nullish()
759
759
  });
760
760
 
761
- // src/google-vertex-video-model.ts
761
+ // src/gemini-transcription/google-vertex-gemini-transcription-model.ts
762
762
  var import_provider2 = require("@ai-sdk/provider");
763
763
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
764
+ var import_v48 = require("zod/v4");
765
+
766
+ // src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts
764
767
  var import_v47 = require("zod/v4");
768
+ var googleVertexGeminiTranscriptionModelOptions = import_v47.z.object({
769
+ /**
770
+ * BCP-47 language codes providing hints about the languages present in the
771
+ * audio. If omitted or empty, defaults to automatic language detection.
772
+ */
773
+ languageCodes: import_v47.z.array(import_v47.z.string()).optional(),
774
+ /**
775
+ * Custom vocabulary phrases, which bias the speech recognition model
776
+ * toward recognizing specific terms.
777
+ */
778
+ customVocabulary: import_v47.z.array(import_v47.z.string()).optional(),
779
+ /**
780
+ * Enables word-level timestamp generation.
781
+ */
782
+ wordTimestamp: import_v47.z.boolean().optional(),
783
+ /**
784
+ * Enables speaker diarization.
785
+ */
786
+ diarization: import_v47.z.boolean().optional(),
787
+ /**
788
+ * Transcription output formatting mode.
789
+ *
790
+ * - `VERBATIM` (default): exact literal transcript preserving filler
791
+ * words, repetitions, and false starts.
792
+ * - `SMART`: cleans up and structures the transcript in real time —
793
+ * disfluency removal, inline self-corrections, structured formatting
794
+ * (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
795
+ */
796
+ mode: import_v47.z.enum(["SMART", "VERBATIM"]).optional()
797
+ });
798
+
799
+ // src/gemini-transcription/google-vertex-gemini-transcription-model.ts
800
+ function isLiveTranscriptionModelId(modelId) {
801
+ return modelId.includes("-live");
802
+ }
803
+ var GoogleVertexGeminiTranscriptionModel = class {
804
+ constructor(modelId, config) {
805
+ this.modelId = modelId;
806
+ this.config = config;
807
+ this.specificationVersion = "v3";
808
+ }
809
+ get provider() {
810
+ return this.config.provider;
811
+ }
812
+ async parseOptions(providerOptions) {
813
+ for (const provider of ["googleVertex", "vertex", "google"]) {
814
+ const parsed = await (0, import_provider_utils5.parseProviderOptions)({
815
+ provider,
816
+ providerOptions,
817
+ schema: googleVertexGeminiTranscriptionModelOptions
818
+ });
819
+ if (parsed != null) return parsed;
820
+ }
821
+ return void 0;
822
+ }
823
+ async doGenerate(options) {
824
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
825
+ if (isLiveTranscriptionModelId(this.modelId)) {
826
+ throw new import_provider2.InvalidArgumentError({
827
+ argument: "modelId",
828
+ message: `Model '${this.modelId}' only supports streaming transcription, which requires AI SDK v7. Use a unary model such as 'gemini-3.5-transcribe'.`
829
+ });
830
+ }
831
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
832
+ const warnings = [];
833
+ const googleOptions = await this.parseOptions(options.providerOptions);
834
+ const audioTranscriptionConfig = buildAudioTranscriptionConfig(googleOptions);
835
+ const requestBody = {
836
+ contents: [
837
+ {
838
+ role: "user",
839
+ parts: [
840
+ {
841
+ inlineData: {
842
+ mimeType: options.mediaType,
843
+ data: (0, import_provider_utils5.convertToBase64)(options.audio)
844
+ }
845
+ }
846
+ ]
847
+ }
848
+ ],
849
+ ...audioTranscriptionConfig != null ? { generationConfig: { audioTranscriptionConfig } } : {}
850
+ };
851
+ const {
852
+ value: response,
853
+ responseHeaders,
854
+ rawValue: rawResponse
855
+ } = await (0, import_provider_utils5.postJsonToApi)({
856
+ url: `${this.config.baseURL}/models/${this.modelId}:generateContent`,
857
+ headers: (0, import_provider_utils5.combineHeaders)(
858
+ this.config.headers ? await (0, import_provider_utils5.resolve)(this.config.headers) : void 0,
859
+ options.headers
860
+ ),
861
+ body: requestBody,
862
+ failedResponseHandler: googleVertexFailedResponseHandler,
863
+ successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
864
+ googleVertexGeminiTranscriptionResponseSchema
865
+ ),
866
+ abortSignal: options.abortSignal,
867
+ fetch: this.config.fetch
868
+ });
869
+ const parts = (_g = (_f = (_e = (_d = response.candidates) == null ? void 0 : _d[0]) == null ? void 0 : _e.content) == null ? void 0 : _f.parts) != null ? _g : [];
870
+ const plainText = parts.map((part) => {
871
+ var _a2;
872
+ return (_a2 = part.text) != null ? _a2 : "";
873
+ }).join("");
874
+ const transcriptionText = parts.map((part) => {
875
+ var _a2, _b2;
876
+ return (_b2 = (_a2 = part.audioTranscription) == null ? void 0 : _a2.text) != null ? _b2 : "";
877
+ }).join("");
878
+ const text = plainText !== "" ? plainText : transcriptionText;
879
+ let language;
880
+ const segments = [];
881
+ for (const part of parts) {
882
+ const transcription = part.audioTranscription;
883
+ if (transcription == null) continue;
884
+ language != null ? language : language = (_h = transcription.languageCode) != null ? _h : void 0;
885
+ for (const word of (_i = transcription.words) != null ? _i : []) {
886
+ const startSecond = parseOffsetSeconds(word.startOffset);
887
+ const endSecond = parseOffsetSeconds(word.endOffset);
888
+ if (word.word == null || startSecond == null || endSecond == null) {
889
+ continue;
890
+ }
891
+ segments.push({ text: word.word, startSecond, endSecond });
892
+ }
893
+ }
894
+ return {
895
+ text,
896
+ segments,
897
+ language,
898
+ durationInSeconds: void 0,
899
+ warnings,
900
+ response: {
901
+ timestamp: currentDate,
902
+ modelId: this.modelId,
903
+ headers: responseHeaders,
904
+ body: rawResponse
905
+ },
906
+ ...response.usageMetadata != null ? {
907
+ providerMetadata: {
908
+ google: { usageMetadata: response.usageMetadata }
909
+ }
910
+ } : {}
911
+ };
912
+ }
913
+ };
914
+ function buildAudioTranscriptionConfig(options) {
915
+ if (options == null) return void 0;
916
+ const config = {};
917
+ if (options.languageCodes != null) {
918
+ config.languageCodes = options.languageCodes;
919
+ }
920
+ if (options.customVocabulary != null) {
921
+ config.customVocabulary = options.customVocabulary;
922
+ }
923
+ if (options.wordTimestamp != null) {
924
+ config.wordTimestamp = options.wordTimestamp;
925
+ }
926
+ if (options.diarization != null) {
927
+ config.diarization = options.diarization;
928
+ }
929
+ if (options.mode != null) {
930
+ config.mode = options.mode;
931
+ }
932
+ return Object.keys(config).length > 0 ? config : void 0;
933
+ }
934
+ function parseOffsetSeconds(offset) {
935
+ if (offset == null) return void 0;
936
+ const parsed = Number.parseFloat(offset);
937
+ return Number.isFinite(parsed) ? parsed : void 0;
938
+ }
939
+ var googleVertexGeminiTranscriptionWordSchema = import_v48.z.object({
940
+ word: import_v48.z.string().nullish(),
941
+ startOffset: import_v48.z.string().nullish(),
942
+ endOffset: import_v48.z.string().nullish()
943
+ });
944
+ var googleVertexGeminiTranscriptionResponseSchema = import_v48.z.object({
945
+ candidates: import_v48.z.array(
946
+ import_v48.z.object({
947
+ content: import_v48.z.object({
948
+ parts: import_v48.z.array(
949
+ import_v48.z.object({
950
+ text: import_v48.z.string().nullish(),
951
+ audioTranscription: import_v48.z.object({
952
+ text: import_v48.z.string().nullish(),
953
+ languageCode: import_v48.z.string().nullish(),
954
+ speakerLabel: import_v48.z.string().nullish(),
955
+ words: import_v48.z.array(googleVertexGeminiTranscriptionWordSchema).nullish()
956
+ }).nullish()
957
+ })
958
+ ).nullish()
959
+ }).nullish()
960
+ })
961
+ ).nullish(),
962
+ usageMetadata: import_v48.z.record(import_v48.z.string(), import_v48.z.unknown()).nullish()
963
+ });
964
+
965
+ // src/google-vertex-video-model.ts
966
+ var import_provider3 = require("@ai-sdk/provider");
967
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
968
+ var import_v49 = require("zod/v4");
765
969
  function getFirstFrameImage(options) {
766
970
  var _a, _b;
767
971
  return (_b = (_a = options.frameImages) == null ? void 0 : _a.find((frame) => frame.frameType === "first_frame")) == null ? void 0 : _b.image;
@@ -795,7 +999,7 @@ function convertFileToVertexImage(file, warnings) {
795
999
  });
796
1000
  return void 0;
797
1001
  }
798
- const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils5.convertUint8ArrayToBase64)(file.data);
1002
+ const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils6.convertUint8ArrayToBase64)(file.data);
799
1003
  return {
800
1004
  bytesBase64Encoded: base64Data,
801
1005
  mimeType: file.mediaType || "image/png"
@@ -821,7 +1025,7 @@ var GoogleVertexVideoModel = class {
821
1025
  var _a, _b, _c, _d, _e, _f, _g;
822
1026
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
823
1027
  const warnings = [];
824
- const vertexOptions = await (0, import_provider_utils5.parseProviderOptions)({
1028
+ const vertexOptions = await (0, import_provider_utils6.parseProviderOptions)({
825
1029
  provider: "vertex",
826
1030
  providerOptions: options.providerOptions,
827
1031
  schema: googleVertexVideoModelOptionsSchema
@@ -903,17 +1107,17 @@ var GoogleVertexVideoModel = class {
903
1107
  }
904
1108
  }
905
1109
  }
906
- const { value: operation } = await (0, import_provider_utils5.postJsonToApi)({
1110
+ const { value: operation } = await (0, import_provider_utils6.postJsonToApi)({
907
1111
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
908
- headers: (0, import_provider_utils5.combineHeaders)(
909
- await (0, import_provider_utils5.resolve)(this.config.headers),
1112
+ headers: (0, import_provider_utils6.combineHeaders)(
1113
+ await (0, import_provider_utils6.resolve)(this.config.headers),
910
1114
  options.headers
911
1115
  ),
912
1116
  body: {
913
1117
  instances,
914
1118
  parameters
915
1119
  },
916
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
1120
+ successfulResponseHandler: (0, import_provider_utils6.createJsonResponseHandler)(
917
1121
  vertexOperationSchema
918
1122
  ),
919
1123
  failedResponseHandler: googleVertexFailedResponseHandler,
@@ -922,7 +1126,7 @@ var GoogleVertexVideoModel = class {
922
1126
  });
923
1127
  const operationName = operation.name;
924
1128
  if (!operationName) {
925
- throw new import_provider2.AISDKError({
1129
+ throw new import_provider3.AISDKError({
926
1130
  name: "VERTEX_VIDEO_GENERATION_ERROR",
927
1131
  message: "No operation name returned from API"
928
1132
  });
@@ -934,28 +1138,28 @@ var GoogleVertexVideoModel = class {
934
1138
  let responseHeaders;
935
1139
  while (!finalOperation.done) {
936
1140
  if (Date.now() - startTime > pollTimeoutMs) {
937
- throw new import_provider2.AISDKError({
1141
+ throw new import_provider3.AISDKError({
938
1142
  name: "VERTEX_VIDEO_GENERATION_TIMEOUT",
939
1143
  message: `Video generation timed out after ${pollTimeoutMs}ms`
940
1144
  });
941
1145
  }
942
- await (0, import_provider_utils5.delay)(pollIntervalMs);
1146
+ await (0, import_provider_utils6.delay)(pollIntervalMs);
943
1147
  if ((_g = options.abortSignal) == null ? void 0 : _g.aborted) {
944
- throw new import_provider2.AISDKError({
1148
+ throw new import_provider3.AISDKError({
945
1149
  name: "VERTEX_VIDEO_GENERATION_ABORTED",
946
1150
  message: "Video generation request was aborted"
947
1151
  });
948
1152
  }
949
- const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils5.postJsonToApi)({
1153
+ const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils6.postJsonToApi)({
950
1154
  url: `${this.config.baseURL}/models/${this.modelId}:fetchPredictOperation`,
951
- headers: (0, import_provider_utils5.combineHeaders)(
952
- await (0, import_provider_utils5.resolve)(this.config.headers),
1155
+ headers: (0, import_provider_utils6.combineHeaders)(
1156
+ await (0, import_provider_utils6.resolve)(this.config.headers),
953
1157
  options.headers
954
1158
  ),
955
1159
  body: {
956
1160
  operationName
957
1161
  },
958
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
1162
+ successfulResponseHandler: (0, import_provider_utils6.createJsonResponseHandler)(
959
1163
  vertexOperationSchema
960
1164
  ),
961
1165
  failedResponseHandler: googleVertexFailedResponseHandler,
@@ -966,14 +1170,14 @@ var GoogleVertexVideoModel = class {
966
1170
  responseHeaders = pollHeaders;
967
1171
  }
968
1172
  if (finalOperation.error) {
969
- throw new import_provider2.AISDKError({
1173
+ throw new import_provider3.AISDKError({
970
1174
  name: "VERTEX_VIDEO_GENERATION_FAILED",
971
1175
  message: `Video generation failed: ${finalOperation.error.message}`
972
1176
  });
973
1177
  }
974
1178
  const response = finalOperation.response;
975
1179
  if (!(response == null ? void 0 : response.videos) || response.videos.length === 0) {
976
- throw new import_provider2.AISDKError({
1180
+ throw new import_provider3.AISDKError({
977
1181
  name: "VERTEX_VIDEO_GENERATION_ERROR",
978
1182
  message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
979
1183
  });
@@ -1003,7 +1207,7 @@ var GoogleVertexVideoModel = class {
1003
1207
  }
1004
1208
  }
1005
1209
  if (videos.length === 0) {
1006
- throw new import_provider2.AISDKError({
1210
+ throw new import_provider3.AISDKError({
1007
1211
  name: "VERTEX_VIDEO_GENERATION_ERROR",
1008
1212
  message: "No valid videos in response"
1009
1213
  });
@@ -1024,38 +1228,38 @@ var GoogleVertexVideoModel = class {
1024
1228
  };
1025
1229
  }
1026
1230
  };
1027
- var vertexOperationSchema = import_v47.z.object({
1028
- name: import_v47.z.string().nullish(),
1029
- done: import_v47.z.boolean().nullish(),
1030
- error: import_v47.z.object({
1031
- code: import_v47.z.number().nullish(),
1032
- message: import_v47.z.string(),
1033
- status: import_v47.z.string().nullish()
1231
+ var vertexOperationSchema = import_v49.z.object({
1232
+ name: import_v49.z.string().nullish(),
1233
+ done: import_v49.z.boolean().nullish(),
1234
+ error: import_v49.z.object({
1235
+ code: import_v49.z.number().nullish(),
1236
+ message: import_v49.z.string(),
1237
+ status: import_v49.z.string().nullish()
1034
1238
  }).nullish(),
1035
- response: import_v47.z.object({
1036
- videos: import_v47.z.array(
1037
- import_v47.z.object({
1038
- bytesBase64Encoded: import_v47.z.string().nullish(),
1039
- gcsUri: import_v47.z.string().nullish(),
1040
- mimeType: import_v47.z.string().nullish()
1239
+ response: import_v49.z.object({
1240
+ videos: import_v49.z.array(
1241
+ import_v49.z.object({
1242
+ bytesBase64Encoded: import_v49.z.string().nullish(),
1243
+ gcsUri: import_v49.z.string().nullish(),
1244
+ mimeType: import_v49.z.string().nullish()
1041
1245
  })
1042
1246
  ).nullish(),
1043
- raiMediaFilteredCount: import_v47.z.number().nullish()
1247
+ raiMediaFilteredCount: import_v49.z.number().nullish()
1044
1248
  }).nullish()
1045
1249
  });
1046
- var googleVertexVideoModelOptionsSchema = (0, import_provider_utils5.lazySchema)(
1047
- () => (0, import_provider_utils5.zodSchema)(
1048
- import_v47.z.object({
1049
- pollIntervalMs: import_v47.z.number().positive().nullish(),
1050
- pollTimeoutMs: import_v47.z.number().positive().nullish(),
1051
- personGeneration: import_v47.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1052
- negativePrompt: import_v47.z.string().nullish(),
1053
- generateAudio: import_v47.z.boolean().nullish(),
1054
- gcsOutputDirectory: import_v47.z.string().nullish(),
1055
- referenceImages: import_v47.z.array(
1056
- import_v47.z.object({
1057
- bytesBase64Encoded: import_v47.z.string().nullish(),
1058
- gcsUri: import_v47.z.string().nullish()
1250
+ var googleVertexVideoModelOptionsSchema = (0, import_provider_utils6.lazySchema)(
1251
+ () => (0, import_provider_utils6.zodSchema)(
1252
+ import_v49.z.object({
1253
+ pollIntervalMs: import_v49.z.number().positive().nullish(),
1254
+ pollTimeoutMs: import_v49.z.number().positive().nullish(),
1255
+ personGeneration: import_v49.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
1256
+ negativePrompt: import_v49.z.string().nullish(),
1257
+ generateAudio: import_v49.z.boolean().nullish(),
1258
+ gcsOutputDirectory: import_v49.z.string().nullish(),
1259
+ referenceImages: import_v49.z.array(
1260
+ import_v49.z.object({
1261
+ bytesBase64Encoded: import_v49.z.string().nullish(),
1262
+ gcsUri: import_v49.z.string().nullish()
1059
1263
  })
1060
1264
  ).nullish()
1061
1265
  }).passthrough()
@@ -1069,7 +1273,7 @@ function createExpressModeFetch(apiKey, customFetch) {
1069
1273
  const modifiedInit = {
1070
1274
  ...init,
1071
1275
  headers: {
1072
- ...(init == null ? void 0 : init.headers) ? (0, import_provider_utils6.normalizeHeaders)(init.headers) : {},
1276
+ ...(init == null ? void 0 : init.headers) ? (0, import_provider_utils7.normalizeHeaders)(init.headers) : {},
1073
1277
  "x-goog-api-key": apiKey
1074
1278
  }
1075
1279
  };
@@ -1077,17 +1281,17 @@ function createExpressModeFetch(apiKey, customFetch) {
1077
1281
  };
1078
1282
  }
1079
1283
  function createVertex(options = {}) {
1080
- const apiKey = (0, import_provider_utils6.loadOptionalSetting)({
1284
+ const apiKey = (0, import_provider_utils7.loadOptionalSetting)({
1081
1285
  settingValue: options.apiKey,
1082
1286
  environmentVariableName: "GOOGLE_VERTEX_API_KEY"
1083
1287
  });
1084
- const loadVertexProject = () => (0, import_provider_utils6.loadSetting)({
1288
+ const loadVertexProject = () => (0, import_provider_utils7.loadSetting)({
1085
1289
  settingValue: options.project,
1086
1290
  settingName: "project",
1087
1291
  environmentVariableName: "GOOGLE_VERTEX_PROJECT",
1088
1292
  description: "Google Vertex project"
1089
1293
  });
1090
- const loadVertexLocation = () => (0, import_provider_utils6.loadSetting)({
1294
+ const loadVertexLocation = () => (0, import_provider_utils7.loadSetting)({
1091
1295
  settingValue: options.location,
1092
1296
  settingName: "location",
1093
1297
  environmentVariableName: "GOOGLE_VERTEX_LOCATION",
@@ -1096,7 +1300,7 @@ function createVertex(options = {}) {
1096
1300
  const loadBaseURL = ({ endpoint = false } = {}) => {
1097
1301
  var _a, _b;
1098
1302
  if (apiKey) {
1099
- return (_a = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _a : EXPRESS_MODE_BASE_URL;
1303
+ return (_a = (0, import_provider_utils7.withoutTrailingSlash)(options.baseURL)) != null ? _a : EXPRESS_MODE_BASE_URL;
1100
1304
  }
1101
1305
  const region = loadVertexLocation();
1102
1306
  const project = loadVertexProject();
@@ -1109,13 +1313,13 @@ function createVertex(options = {}) {
1109
1313
  return `${region}-aiplatform.googleapis.com`;
1110
1314
  }
1111
1315
  };
1112
- return (_b = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _b : `https://${getHost()}/v1beta1/projects/${project}/locations/${region}${endpoint ? "" : "/publishers/google"}`;
1316
+ return (_b = (0, import_provider_utils7.withoutTrailingSlash)(options.baseURL)) != null ? _b : `https://${getHost()}/v1beta1/projects/${project}/locations/${region}${endpoint ? "" : "/publishers/google"}`;
1113
1317
  };
1114
1318
  const createConfig = (name, { endpoint = false } = {}) => {
1115
1319
  const getHeaders = async () => {
1116
1320
  var _a;
1117
- const originalHeaders = await (0, import_provider_utils6.resolve)((_a = options.headers) != null ? _a : {});
1118
- return (0, import_provider_utils6.withUserAgentSuffix)(
1321
+ const originalHeaders = await (0, import_provider_utils7.resolve)((_a = options.headers) != null ? _a : {});
1322
+ return (0, import_provider_utils7.withUserAgentSuffix)(
1119
1323
  originalHeaders,
1120
1324
  `ai-sdk/google-vertex/${VERSION}`
1121
1325
  );
@@ -1131,7 +1335,7 @@ function createVertex(options = {}) {
1131
1335
  var _a;
1132
1336
  return new import_internal3.GoogleGenerativeAILanguageModel(modelId, {
1133
1337
  ...createConfig("chat"),
1134
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils6.generateId,
1338
+ generateId: (_a = options.generateId) != null ? _a : import_provider_utils7.generateId,
1135
1339
  supportedUrls: () => ({
1136
1340
  "*": [
1137
1341
  // HTTP URLs:
@@ -1157,7 +1361,7 @@ function createVertex(options = {}) {
1157
1361
  // endpoint-style base URL without the `/publishers/google` suffix that
1158
1362
  // the base-model paths carry.
1159
1363
  ...createConfig("interactions", { endpoint: true }),
1160
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils6.generateId
1364
+ generateId: (_a = options.generateId) != null ? _a : import_provider_utils7.generateId
1161
1365
  }
1162
1366
  );
1163
1367
  };
@@ -1166,14 +1370,14 @@ function createVertex(options = {}) {
1166
1370
  var _a;
1167
1371
  return new GoogleVertexImageModel(modelId, {
1168
1372
  ...createConfig("image"),
1169
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils6.generateId
1373
+ generateId: (_a = options.generateId) != null ? _a : import_provider_utils7.generateId
1170
1374
  });
1171
1375
  };
1172
1376
  const createVideoModel = (modelId) => {
1173
1377
  var _a;
1174
1378
  return new GoogleVertexVideoModel(modelId, {
1175
1379
  ...createConfig("video"),
1176
- generateId: (_a = options.generateId) != null ? _a : import_provider_utils6.generateId
1380
+ generateId: (_a = options.generateId) != null ? _a : import_provider_utils7.generateId
1177
1381
  });
1178
1382
  };
1179
1383
  const createTranscriptionModel = (modelId) => {
@@ -1183,6 +1387,14 @@ function createVertex(options = {}) {
1183
1387
  );
1184
1388
  }
1185
1389
  const config = createConfig("transcription");
1390
+ if (modelId.startsWith("gemini")) {
1391
+ return new GoogleVertexGeminiTranscriptionModel(modelId, {
1392
+ provider: config.provider,
1393
+ baseURL: loadBaseURL(),
1394
+ headers: config.headers,
1395
+ fetch: config.fetch
1396
+ });
1397
+ }
1186
1398
  return new GoogleVertexTranscriptionModel(modelId, {
1187
1399
  provider: config.provider,
1188
1400
  headers: config.headers,
@@ -1215,23 +1427,23 @@ function createVertex(options = {}) {
1215
1427
  }
1216
1428
 
1217
1429
  // src/edge/google-vertex-auth-edge.ts
1218
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
1430
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1219
1431
  var loadCredentials = async () => {
1220
1432
  try {
1221
1433
  return {
1222
- clientEmail: (0, import_provider_utils7.loadSetting)({
1434
+ clientEmail: (0, import_provider_utils8.loadSetting)({
1223
1435
  settingValue: void 0,
1224
1436
  settingName: "clientEmail",
1225
1437
  environmentVariableName: "GOOGLE_CLIENT_EMAIL",
1226
1438
  description: "Google client email"
1227
1439
  }),
1228
- privateKey: (0, import_provider_utils7.loadSetting)({
1440
+ privateKey: (0, import_provider_utils8.loadSetting)({
1229
1441
  settingValue: void 0,
1230
1442
  settingName: "privateKey",
1231
1443
  environmentVariableName: "GOOGLE_PRIVATE_KEY",
1232
1444
  description: "Google private key"
1233
1445
  }),
1234
- privateKeyId: (0, import_provider_utils7.loadOptionalSetting)({
1446
+ privateKeyId: (0, import_provider_utils8.loadOptionalSetting)({
1235
1447
  settingValue: void 0,
1236
1448
  environmentVariableName: "GOOGLE_PRIVATE_KEY_ID"
1237
1449
  })
@@ -1300,10 +1512,10 @@ async function generateAuthToken(credentials) {
1300
1512
  const jwt = await buildJwt(creds);
1301
1513
  const response = await fetch("https://oauth2.googleapis.com/token", {
1302
1514
  method: "POST",
1303
- headers: (0, import_provider_utils7.withUserAgentSuffix)(
1515
+ headers: (0, import_provider_utils8.withUserAgentSuffix)(
1304
1516
  { "Content-Type": "application/x-www-form-urlencoded" },
1305
1517
  `ai-sdk/google-vertex/${VERSION}`,
1306
- (0, import_provider_utils7.getRuntimeEnvironmentUserAgent)()
1518
+ (0, import_provider_utils8.getRuntimeEnvironmentUserAgent)()
1307
1519
  ),
1308
1520
  body: new URLSearchParams({
1309
1521
  grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
@@ -1322,7 +1534,7 @@ async function generateAuthToken(credentials) {
1322
1534
 
1323
1535
  // src/edge/google-vertex-provider-edge.ts
1324
1536
  function createVertex2(options = {}) {
1325
- const apiKey = (0, import_provider_utils8.loadOptionalSetting)({
1537
+ const apiKey = (0, import_provider_utils9.loadOptionalSetting)({
1326
1538
  settingValue: options.apiKey,
1327
1539
  environmentVariableName: "GOOGLE_VERTEX_API_KEY"
1328
1540
  });
@@ -1335,7 +1547,7 @@ function createVertex2(options = {}) {
1335
1547
  Authorization: `Bearer ${await generateAuthToken(
1336
1548
  options.googleCredentials
1337
1549
  )}`,
1338
- ...await (0, import_provider_utils8.resolve)(options.headers)
1550
+ ...await (0, import_provider_utils9.resolve)(options.headers)
1339
1551
  })
1340
1552
  });
1341
1553
  }