@ai-sdk/google-vertex 4.0.230 → 4.0.232
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 +14 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/anthropic/edge/index.mjs +1 -1
- package/dist/edge/index.d.mts +1 -1
- package/dist/edge/index.d.ts +1 -1
- package/dist/edge/index.js +32 -18
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/index.mjs +27 -11
- package/dist/edge/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -9
- package/dist/index.mjs.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/maas/edge/index.mjs +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/dist/xai/edge/index.mjs +1 -1
- package/docs/16-google-vertex.mdx +5 -1
- package/package.json +2 -2
- package/src/google-vertex-options.ts +1 -0
- package/src/google-vertex-transcription-model-options.ts +2 -1
- package/src/google-vertex-transcription-model.ts +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 4.0.232
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ea9b26: Reject invalid Cloud Speech transcription regions and default locations before resolving credentials or sending requests, preventing URL delimiters from redirecting bearer tokens and audio to another host.
|
|
8
|
+
|
|
9
|
+
## 4.0.231
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 56c41d5: Add support for the `gemini-4-carbon` model with the same capabilities as `gemini-4-argon`.
|
|
14
|
+
- Updated dependencies [56c41d5]
|
|
15
|
+
- @ai-sdk/google@3.0.145
|
|
16
|
+
|
|
3
17
|
## 4.0.230
|
|
4
18
|
|
|
5
19
|
### 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.
|
|
35
|
+
var VERSION = true ? "4.0.232" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/edge/google-vertex-auth-edge.ts
|
|
38
38
|
var loadCredentials = async () => {
|
package/dist/edge/index.d.mts
CHANGED
|
@@ -25,7 +25,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
|
|
|
25
25
|
|
|
26
26
|
type GoogleVertexImageModelId = 'imagen-3.0-generate-001' | 'imagen-3.0-generate-002' | 'imagen-3.0-fast-generate-001' | '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' | 'gemini-nano-banana-2.1' | (string & {});
|
|
27
27
|
|
|
28
|
-
type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
|
|
28
|
+
type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-4-carbon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
|
|
29
29
|
|
|
30
30
|
declare const googleVertexTools: {
|
|
31
31
|
googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
|
|
|
25
25
|
|
|
26
26
|
type GoogleVertexImageModelId = 'imagen-3.0-generate-001' | 'imagen-3.0-generate-002' | 'imagen-3.0-fast-generate-001' | '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' | 'gemini-nano-banana-2.1' | (string & {});
|
|
27
27
|
|
|
28
|
-
type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
|
|
28
|
+
type GoogleVertexModelId = 'gemini-nano-banana-2.1' | 'gemini-4-argon' | 'gemini-4-carbon' | 'gemini-3.8-flash' | 'gemini-3.7-flash' | 'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
|
|
29
29
|
|
|
30
30
|
declare const googleVertexTools: {
|
|
31
31
|
googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
package/dist/edge/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var import_internal3 = require("@ai-sdk/google/internal");
|
|
|
33
33
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
34
34
|
|
|
35
35
|
// src/version.ts
|
|
36
|
-
var VERSION = true ? "4.0.
|
|
36
|
+
var VERSION = true ? "4.0.232" : "0.0.0-test";
|
|
37
37
|
|
|
38
38
|
// src/google-vertex-embedding-model.ts
|
|
39
39
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -622,6 +622,7 @@ var googleVertexTools = {
|
|
|
622
622
|
};
|
|
623
623
|
|
|
624
624
|
// src/google-vertex-transcription-model.ts
|
|
625
|
+
var import_provider2 = require("@ai-sdk/provider");
|
|
625
626
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
626
627
|
var import_v46 = require("zod/v4");
|
|
627
628
|
|
|
@@ -651,7 +652,8 @@ var googleVertexTranscriptionProviderOptionsSchema = (0, import_provider_utils5.
|
|
|
651
652
|
enableWordTimeOffsets: import_v45.z.boolean().optional(),
|
|
652
653
|
/**
|
|
653
654
|
* The Cloud Speech-to-Text region for the request (e.g. `'us'`, `'eu'`,
|
|
654
|
-
* `'us-central1'`). Defaults to the provider `location`.
|
|
655
|
+
* `'us-central1'`). Defaults to the provider `location`. Must be a single
|
|
656
|
+
* DNS label (letters, digits, and hyphens).
|
|
655
657
|
*
|
|
656
658
|
* Note: Speech-to-Text regions differ from Vertex AI regions. Chirp is only
|
|
657
659
|
* available in specific Speech-to-Text regions and is not available in the
|
|
@@ -691,7 +693,7 @@ var GoogleVertexTranscriptionModel = class {
|
|
|
691
693
|
return this.config.provider;
|
|
692
694
|
}
|
|
693
695
|
async doGenerate(options) {
|
|
694
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
696
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
695
697
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
696
698
|
const warnings = [];
|
|
697
699
|
let googleOptions;
|
|
@@ -706,7 +708,13 @@ var GoogleVertexTranscriptionModel = class {
|
|
|
706
708
|
}
|
|
707
709
|
}
|
|
708
710
|
const region = (_d = googleOptions == null ? void 0 : googleOptions.region) != null ? _d : this.config.location;
|
|
709
|
-
|
|
711
|
+
if (((_e = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.exec(region)) == null ? void 0 : _e[0]) !== region) {
|
|
712
|
+
throw new import_provider2.InvalidArgumentError({
|
|
713
|
+
argument: (googleOptions == null ? void 0 : googleOptions.region) != null ? "region" : "location",
|
|
714
|
+
message: "Invalid Google Cloud Speech-to-Text region. Expected a single DNS label (letters, digits, and hyphens)."
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
const languageCodes = (_f = googleOptions == null ? void 0 : googleOptions.languageCodes) != null ? _f : ["auto"];
|
|
710
718
|
const content = typeof options.audio === "string" ? options.audio : (0, import_provider_utils6.convertUint8ArrayToBase64)(options.audio);
|
|
711
719
|
const requestBody = {
|
|
712
720
|
config: {
|
|
@@ -716,14 +724,20 @@ var GoogleVertexTranscriptionModel = class {
|
|
|
716
724
|
autoDecodingConfig: {},
|
|
717
725
|
features: {
|
|
718
726
|
// Word timing populates `segments`.
|
|
719
|
-
enableWordTimeOffsets: (
|
|
720
|
-
enableAutomaticPunctuation: (
|
|
727
|
+
enableWordTimeOffsets: (_g = googleOptions == null ? void 0 : googleOptions.enableWordTimeOffsets) != null ? _g : true,
|
|
728
|
+
enableAutomaticPunctuation: (_h = googleOptions == null ? void 0 : googleOptions.enableAutomaticPunctuation) != null ? _h : true
|
|
721
729
|
}
|
|
722
730
|
},
|
|
723
731
|
content
|
|
724
732
|
};
|
|
725
733
|
const host = region === "global" ? "speech.googleapis.com" : `${region}-speech.googleapis.com`;
|
|
726
734
|
const url = `https://${host}/v2/projects/${this.config.project}/locations/${region}/recognizers/_:recognize`;
|
|
735
|
+
if (new URL(url).origin !== `https://${host.toLowerCase()}`) {
|
|
736
|
+
throw new import_provider2.InvalidArgumentError({
|
|
737
|
+
argument: (googleOptions == null ? void 0 : googleOptions.region) != null ? "region" : "location",
|
|
738
|
+
message: "Invalid Google Cloud Speech-to-Text endpoint origin."
|
|
739
|
+
});
|
|
740
|
+
}
|
|
727
741
|
const {
|
|
728
742
|
value: response,
|
|
729
743
|
responseHeaders,
|
|
@@ -742,7 +756,7 @@ var GoogleVertexTranscriptionModel = class {
|
|
|
742
756
|
abortSignal: options.abortSignal,
|
|
743
757
|
fetch: this.config.fetch
|
|
744
758
|
});
|
|
745
|
-
const results = (
|
|
759
|
+
const results = (_i = response.results) != null ? _i : [];
|
|
746
760
|
const text = results.map((result) => {
|
|
747
761
|
var _a2, _b2, _c2;
|
|
748
762
|
return (_c2 = (_b2 = (_a2 = result.alternatives) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.transcript) != null ? _c2 : "";
|
|
@@ -757,13 +771,13 @@ var GoogleVertexTranscriptionModel = class {
|
|
|
757
771
|
})) != null ? _d2 : [];
|
|
758
772
|
}
|
|
759
773
|
);
|
|
760
|
-
const language = convertBcp47ToIso6391((
|
|
774
|
+
const language = convertBcp47ToIso6391((_j = results[0]) == null ? void 0 : _j.languageCode);
|
|
761
775
|
return {
|
|
762
776
|
text,
|
|
763
777
|
segments,
|
|
764
778
|
language,
|
|
765
779
|
durationInSeconds: parseDurationSeconds(
|
|
766
|
-
(
|
|
780
|
+
(_k = response.metadata) == null ? void 0 : _k.totalBilledDuration
|
|
767
781
|
),
|
|
768
782
|
warnings,
|
|
769
783
|
response: {
|
|
@@ -803,7 +817,7 @@ var googleVertexTranscriptionResponseSchema = (0, import_provider_utils6.lazySch
|
|
|
803
817
|
);
|
|
804
818
|
|
|
805
819
|
// src/gemini-transcription/google-vertex-gemini-transcription-model.ts
|
|
806
|
-
var
|
|
820
|
+
var import_provider3 = require("@ai-sdk/provider");
|
|
807
821
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
808
822
|
var import_v48 = require("zod/v4");
|
|
809
823
|
|
|
@@ -872,7 +886,7 @@ var GoogleVertexGeminiTranscriptionModel = class {
|
|
|
872
886
|
async doGenerate(options) {
|
|
873
887
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
874
888
|
if (isLiveTranscriptionModelId(this.modelId)) {
|
|
875
|
-
throw new
|
|
889
|
+
throw new import_provider3.InvalidArgumentError({
|
|
876
890
|
argument: "modelId",
|
|
877
891
|
message: `Model '${this.modelId}' only supports streaming transcription, which requires AI SDK v7. Use a unary model such as 'gemini-3.5-transcribe'.`
|
|
878
892
|
});
|
|
@@ -1016,7 +1030,7 @@ var googleVertexGeminiTranscriptionResponseSchema = (0, import_provider_utils8.l
|
|
|
1016
1030
|
);
|
|
1017
1031
|
|
|
1018
1032
|
// src/google-vertex-video-model.ts
|
|
1019
|
-
var
|
|
1033
|
+
var import_provider4 = require("@ai-sdk/provider");
|
|
1020
1034
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1021
1035
|
var import_v49 = require("zod/v4");
|
|
1022
1036
|
function getFirstFrameImage(options) {
|
|
@@ -1179,7 +1193,7 @@ var GoogleVertexVideoModel = class {
|
|
|
1179
1193
|
});
|
|
1180
1194
|
const operationName = operation.name;
|
|
1181
1195
|
if (!operationName) {
|
|
1182
|
-
throw new
|
|
1196
|
+
throw new import_provider4.AISDKError({
|
|
1183
1197
|
name: "VERTEX_VIDEO_GENERATION_ERROR",
|
|
1184
1198
|
message: "No operation name returned from API"
|
|
1185
1199
|
});
|
|
@@ -1191,14 +1205,14 @@ var GoogleVertexVideoModel = class {
|
|
|
1191
1205
|
let responseHeaders;
|
|
1192
1206
|
while (!finalOperation.done) {
|
|
1193
1207
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
1194
|
-
throw new
|
|
1208
|
+
throw new import_provider4.AISDKError({
|
|
1195
1209
|
name: "VERTEX_VIDEO_GENERATION_TIMEOUT",
|
|
1196
1210
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
1197
1211
|
});
|
|
1198
1212
|
}
|
|
1199
1213
|
await (0, import_provider_utils9.delay)(pollIntervalMs);
|
|
1200
1214
|
if ((_g = options.abortSignal) == null ? void 0 : _g.aborted) {
|
|
1201
|
-
throw new
|
|
1215
|
+
throw new import_provider4.AISDKError({
|
|
1202
1216
|
name: "VERTEX_VIDEO_GENERATION_ABORTED",
|
|
1203
1217
|
message: "Video generation request was aborted"
|
|
1204
1218
|
});
|
|
@@ -1223,14 +1237,14 @@ var GoogleVertexVideoModel = class {
|
|
|
1223
1237
|
responseHeaders = pollHeaders;
|
|
1224
1238
|
}
|
|
1225
1239
|
if (finalOperation.error) {
|
|
1226
|
-
throw new
|
|
1240
|
+
throw new import_provider4.AISDKError({
|
|
1227
1241
|
name: "VERTEX_VIDEO_GENERATION_FAILED",
|
|
1228
1242
|
message: `Video generation failed: ${finalOperation.error.message}`
|
|
1229
1243
|
});
|
|
1230
1244
|
}
|
|
1231
1245
|
const response = finalOperation.response;
|
|
1232
1246
|
if (!(response == null ? void 0 : response.videos) || response.videos.length === 0) {
|
|
1233
|
-
throw new
|
|
1247
|
+
throw new import_provider4.AISDKError({
|
|
1234
1248
|
name: "VERTEX_VIDEO_GENERATION_ERROR",
|
|
1235
1249
|
message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
|
|
1236
1250
|
});
|
|
@@ -1260,7 +1274,7 @@ var GoogleVertexVideoModel = class {
|
|
|
1260
1274
|
}
|
|
1261
1275
|
}
|
|
1262
1276
|
if (videos.length === 0) {
|
|
1263
|
-
throw new
|
|
1277
|
+
throw new import_provider4.AISDKError({
|
|
1264
1278
|
name: "VERTEX_VIDEO_GENERATION_ERROR",
|
|
1265
1279
|
message: "No valid videos in response"
|
|
1266
1280
|
});
|