@ai-sdk/google-vertex 5.0.117 → 5.0.119
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 +29 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/edge/index.d.ts +0 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +22 -22
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +23 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/docs/16-google-vertex.mdx +60 -7
- package/package.json +6 -6
- package/src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts +40 -31
- package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +40 -33
- package/src/google-vertex-cloud-tts-speech-model.ts +9 -3
- package/src/google-vertex-embedding-model-options.ts +52 -43
- package/src/google-vertex-embedding-model.ts +28 -18
- package/src/google-vertex-error.ts +20 -9
- package/src/google-vertex-transcription-model-options.ts +40 -31
- package/src/google-vertex-transcription-model.ts +36 -30
- package/src/google-vertex-video-model.ts +32 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 5.0.119
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 60e63b6: Defer construction of provider validation schemas until first use to reduce package import time.
|
|
8
|
+
- Updated dependencies [b089ce8]
|
|
9
|
+
- Updated dependencies [39a776b]
|
|
10
|
+
- Updated dependencies [d39b41d]
|
|
11
|
+
- Updated dependencies [754407e]
|
|
12
|
+
- Updated dependencies [e619655]
|
|
13
|
+
- Updated dependencies [bc1a2e9]
|
|
14
|
+
- @ai-sdk/provider-utils@5.0.65
|
|
15
|
+
- @ai-sdk/anthropic@4.0.85
|
|
16
|
+
- @ai-sdk/google@4.0.102
|
|
17
|
+
- @ai-sdk/openai-compatible@3.0.75
|
|
18
|
+
|
|
19
|
+
## 5.0.118
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [9d13c4d]
|
|
24
|
+
- Updated dependencies [0c2a9de]
|
|
25
|
+
- Updated dependencies [200c47f]
|
|
26
|
+
- @ai-sdk/anthropic@4.0.84
|
|
27
|
+
- @ai-sdk/provider@4.0.31
|
|
28
|
+
- @ai-sdk/provider-utils@5.0.64
|
|
29
|
+
- @ai-sdk/google@4.0.101
|
|
30
|
+
- @ai-sdk/openai-compatible@3.0.74
|
|
31
|
+
|
|
3
32
|
## 5.0.117
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@ import { InvalidArgumentError, NoSuchModelError } from "@ai-sdk/provider";
|
|
|
3
3
|
import { AnthropicLanguageModel, anthropicTools } from "@ai-sdk/anthropic/internal";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "5.0.
|
|
6
|
+
const VERSION = "5.0.119";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/edge/google-vertex-auth-edge.ts
|
|
9
9
|
const loadCredentials = async () => {
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FetchFunction, Resolvable, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, WebSocketConstructor } from "@ai-sdk/provider-utils";
|
|
2
2
|
import { GoogleInteractionsAgentName, GoogleInteractionsModelId } from "@ai-sdk/google/internal";
|
|
3
3
|
import { EmbeddingModelV4, Experimental_VideoModelV4, ImageModelV4, LanguageModelV4, ProviderV4, SpeechModelV4, TranscriptionModelV4 } from "@ai-sdk/provider";
|
|
4
|
-
import { z } from "zod/v4";
|
|
5
4
|
import "@ai-sdk/google";
|
|
6
5
|
//#region src/google-vertex-embedding-model-options.d.ts
|
|
7
6
|
type GoogleVertexEmbeddingModelId = 'textembedding-gecko' | 'textembedding-gecko@001' | 'textembedding-gecko@003' | 'textembedding-gecko-multilingual' | 'textembedding-gecko-multilingual@001' | 'text-multilingual-embedding-002' | 'text-embedding-004' | 'text-embedding-005' | 'gemini-embedding-001' | 'gemini-embedding-2' | 'gemini-embedding-2-preview' | (string & {});
|
package/dist/edge/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal"],"sources":["../../src/google-vertex-embedding-model-options.ts","../../src/google-vertex-config.ts","../../src/google-vertex-embedding-model.ts","../../src/google-vertex-image-settings.ts","../../src/google-vertex-options.ts","../../src/google-vertex-tools.ts","../../src/google-vertex-transcription-model-options.ts","../../src/google-vertex-video-settings.ts","../../src/google-vertex-speech-model-options.ts","../../src/google-vertex-provider-base.ts","../../src/edge/google-vertex-auth-edge.ts","../../src/edge/google-vertex-provider-edge.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal"],"sources":["../../src/google-vertex-embedding-model-options.ts","../../src/google-vertex-config.ts","../../src/google-vertex-embedding-model.ts","../../src/google-vertex-image-settings.ts","../../src/google-vertex-options.ts","../../src/google-vertex-tools.ts","../../src/google-vertex-transcription-model-options.ts","../../src/google-vertex-video-settings.ts","../../src/google-vertex-speech-model-options.ts","../../src/google-vertex-provider-base.ts","../../src/edge/google-vertex-auth-edge.ts","../../src/edge/google-vertex-provider-edge.ts"],"mappings":";;;;;KAQY;;;UCNK;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;cCkBG,sCAAsC;WACxC;WACA,SAAS;WACT;mBAEQ;UAET,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B;IACA,QAAQ;MACT;MAIG;MAMA;EAKF,YAAA,SAAS,8BACT,QAAQ;EAMJ,UACJ,QACA,YACA,SACA,aACA,mBACC,WAAW,kCAAkC,QAC9C,QAAQ,WAAW;;;;KCtEX;;;KCGA;;;cCDC;;;;MAS4wnB,YAAC;MAAsD,cAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCFr0nB;;;KCTA;;;KCMA;;;UCqEK,6BAA6B;;;;GAI3C,SAAS,sBAAsB;EAEhC,gBAAgB,SAAS,wBAAwB;;;;;;;EAQjD,aACE,gBACI;IACE,OAAO;;IACP;MACL;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;EAE/C,cAAc;;;;EAKd,mBACE,SAAS,+BACR;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;;;;EAK/C,OAAO,SAAS,4BAA4B;;;;EAK5C,YAAY,SAAS,4BAA4B;;;;EAKjD,cACE,SAAS,mCACR;;;;EAKH,mBACE,SAAS,mCACR;;UAGYA;;;;;;EAMf;;;;EAKA;;;;EAKA;;;;;;;;EASA,UAAU,WAAW;;;;;EAMrB,QAAQ;EAGR;;;;EAKA;;;;;;EAOA,YAAY;;;;;EAMZ;;;;IAIE;;;;;UCtMa;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;UCbe,qCAAqCC;;;;;;EAMpD,oBAAoB;;wBAGN,mBACd,UAAS,+BACR;;;;qBAwBU,cAAY"}
|
package/dist/edge/index.js
CHANGED
|
@@ -3,21 +3,21 @@ import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel
|
|
|
3
3
|
import { AISDKError, InvalidArgumentError, TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "5.0.
|
|
6
|
+
const VERSION = "5.0.119";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/google-vertex-error.ts
|
|
9
|
-
const googleVertexErrorDataSchema = z.object({ error: z.object({
|
|
9
|
+
const googleVertexErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
|
|
10
10
|
code: z.number().nullable(),
|
|
11
11
|
message: z.string(),
|
|
12
12
|
status: z.string()
|
|
13
|
-
}) });
|
|
13
|
+
}) })));
|
|
14
14
|
const googleVertexFailedResponseHandler = createJsonErrorResponseHandler({
|
|
15
15
|
errorSchema: googleVertexErrorDataSchema,
|
|
16
16
|
errorToMessage: (data) => data.error.message
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/google-vertex-embedding-model-options.ts
|
|
20
|
-
const googleVertexEmbeddingModelOptions = z.object({
|
|
20
|
+
const googleVertexEmbeddingModelOptions = lazySchema(() => zodSchema(z.object({
|
|
21
21
|
/**
|
|
22
22
|
* Optional. Optional reduced dimension for the output embedding.
|
|
23
23
|
* If set, excessive values in the output embedding are truncated from the end.
|
|
@@ -56,7 +56,7 @@ const googleVertexEmbeddingModelOptions = z.object({
|
|
|
56
56
|
* an error is returned if the input text is longer than the maximum length supported by the model. Defaults to true.
|
|
57
57
|
*/
|
|
58
58
|
autoTruncate: z.boolean().optional()
|
|
59
|
-
});
|
|
59
|
+
})));
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/google-vertex-embedding-model.ts
|
|
62
62
|
var GoogleVertexEmbeddingModel = class GoogleVertexEmbeddingModel {
|
|
@@ -164,14 +164,14 @@ var GoogleVertexEmbeddingModel = class GoogleVertexEmbeddingModel {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
const googleVertexTextEmbeddingResponseSchema = z.object({ predictions: z.array(z.object({ embeddings: z.object({
|
|
167
|
+
const googleVertexTextEmbeddingResponseSchema = lazySchema(() => zodSchema(z.object({ predictions: z.array(z.object({ embeddings: z.object({
|
|
168
168
|
values: z.array(z.number()),
|
|
169
169
|
statistics: z.object({ token_count: z.number() })
|
|
170
|
-
}) })) });
|
|
171
|
-
const googleVertexEmbedContentResponseSchema = z.object({
|
|
170
|
+
}) })) })));
|
|
171
|
+
const googleVertexEmbedContentResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
172
172
|
embedding: z.object({ values: z.array(z.number()) }),
|
|
173
173
|
usageMetadata: z.object({ promptTokenCount: z.number().nullish() }).nullish()
|
|
174
|
-
});
|
|
174
|
+
})));
|
|
175
175
|
function usesEmbedContentEndpoint(modelId) {
|
|
176
176
|
return modelId === "gemini-embedding-2" || modelId === "gemini-embedding-2-preview";
|
|
177
177
|
}
|
|
@@ -385,7 +385,7 @@ var GoogleVertexCloudTTSSpeechModel = class GoogleVertexCloudTTSSpeechModel {
|
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
387
|
};
|
|
388
|
-
const googleVertexCloudTTSResponseSchema = z.object({ audioContent: z.string().nullish() });
|
|
388
|
+
const googleVertexCloudTTSResponseSchema = lazySchema(() => zodSchema(z.object({ audioContent: z.string().nullish() })));
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/google-vertex-tools.ts
|
|
391
391
|
const googleVertexTools = {
|
|
@@ -399,7 +399,7 @@ const googleVertexTools = {
|
|
|
399
399
|
};
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region src/google-vertex-transcription-model-options.ts
|
|
402
|
-
const googleVertexTranscriptionProviderOptionsSchema = z.object({
|
|
402
|
+
const googleVertexTranscriptionProviderOptionsSchema = lazySchema(() => zodSchema(z.object({
|
|
403
403
|
/**
|
|
404
404
|
* BCP-47 language codes to recognize (e.g. `['en-US']`), or `['auto']` to let
|
|
405
405
|
* Chirp auto-detect the spoken language. Defaults to `['auto']`. For
|
|
@@ -428,7 +428,7 @@ const googleVertexTranscriptionProviderOptionsSchema = z.object({
|
|
|
428
428
|
* `global` location.
|
|
429
429
|
*/
|
|
430
430
|
region: z.string().optional()
|
|
431
|
-
});
|
|
431
|
+
})));
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/google-vertex-transcription-model.ts
|
|
434
434
|
function parseDurationSeconds(value) {
|
|
@@ -532,7 +532,7 @@ var GoogleVertexTranscriptionModel = class GoogleVertexTranscriptionModel {
|
|
|
532
532
|
};
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
|
-
const googleVertexTranscriptionResponseSchema = z.object({
|
|
535
|
+
const googleVertexTranscriptionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
536
536
|
results: z.array(z.object({
|
|
537
537
|
alternatives: z.array(z.object({
|
|
538
538
|
transcript: z.string().nullish(),
|
|
@@ -545,7 +545,7 @@ const googleVertexTranscriptionResponseSchema = z.object({
|
|
|
545
545
|
languageCode: z.string().nullish()
|
|
546
546
|
})).nullish(),
|
|
547
547
|
metadata: z.object({ totalBilledDuration: z.string().nullish() }).nullish()
|
|
548
|
-
});
|
|
548
|
+
})));
|
|
549
549
|
//#endregion
|
|
550
550
|
//#region src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts
|
|
551
551
|
/**
|
|
@@ -554,7 +554,7 @@ const googleVertexTranscriptionResponseSchema = z.object({
|
|
|
554
554
|
* (`gemini-3.5-transcribe-live`) variants. Maps onto Google's
|
|
555
555
|
* `AudioTranscriptionConfig`.
|
|
556
556
|
*/
|
|
557
|
-
const googleVertexGeminiTranscriptionModelOptions = z.object({
|
|
557
|
+
const googleVertexGeminiTranscriptionModelOptions = lazySchema(() => zodSchema(z.object({
|
|
558
558
|
/**
|
|
559
559
|
* BCP-47 language codes providing hints about the languages present in the
|
|
560
560
|
* audio. If omitted or empty, defaults to automatic language detection.
|
|
@@ -583,7 +583,7 @@ const googleVertexGeminiTranscriptionModelOptions = z.object({
|
|
|
583
583
|
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
|
|
584
584
|
*/
|
|
585
585
|
mode: z.enum(["SMART", "VERBATIM"]).optional()
|
|
586
|
-
});
|
|
586
|
+
})));
|
|
587
587
|
//#endregion
|
|
588
588
|
//#region src/gemini-transcription/google-vertex-gemini-transcription-model.ts
|
|
589
589
|
const liveWebSocketPath = "google.cloud.aiplatform.v1.LlmBidiService/BidiGenerateContent";
|
|
@@ -952,23 +952,23 @@ function parseOffsetSeconds(offset) {
|
|
|
952
952
|
const parsed = Number.parseFloat(offset);
|
|
953
953
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
954
954
|
}
|
|
955
|
-
const googleVertexGeminiTranscriptionWordSchema = z.object({
|
|
955
|
+
const googleVertexGeminiTranscriptionWordSchema = () => z.object({
|
|
956
956
|
word: z.string().nullish(),
|
|
957
957
|
startOffset: z.string().nullish(),
|
|
958
958
|
endOffset: z.string().nullish()
|
|
959
959
|
});
|
|
960
|
-
const googleVertexGeminiTranscriptionResponseSchema = z.object({
|
|
960
|
+
const googleVertexGeminiTranscriptionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
961
961
|
candidates: z.array(z.object({ content: z.object({ parts: z.array(z.object({
|
|
962
962
|
text: z.string().nullish(),
|
|
963
963
|
audioTranscription: z.object({
|
|
964
964
|
text: z.string().nullish(),
|
|
965
965
|
languageCode: z.string().nullish(),
|
|
966
966
|
speakerLabel: z.string().nullish(),
|
|
967
|
-
words: z.array(googleVertexGeminiTranscriptionWordSchema).nullish()
|
|
967
|
+
words: z.array(googleVertexGeminiTranscriptionWordSchema()).nullish()
|
|
968
968
|
}).nullish()
|
|
969
969
|
})).nullish() }).nullish() })).nullish(),
|
|
970
970
|
usageMetadata: z.record(z.string(), z.unknown()).nullish()
|
|
971
|
-
});
|
|
971
|
+
})));
|
|
972
972
|
//#endregion
|
|
973
973
|
//#region src/google-vertex-video-model-options.ts
|
|
974
974
|
const googleVertexVideoModelOptionsSchema = lazySchema(() => zodSchema(z.looseObject({
|
|
@@ -1218,7 +1218,7 @@ var GoogleVertexVideoModel = class {
|
|
|
1218
1218
|
});
|
|
1219
1219
|
}
|
|
1220
1220
|
};
|
|
1221
|
-
const googleVertexOperationSchema = z.object({
|
|
1221
|
+
const googleVertexOperationSchema = lazySchema(() => zodSchema(z.object({
|
|
1222
1222
|
name: z.string().nullish(),
|
|
1223
1223
|
done: z.boolean().nullish(),
|
|
1224
1224
|
error: z.object({
|
|
@@ -1234,7 +1234,7 @@ const googleVertexOperationSchema = z.object({
|
|
|
1234
1234
|
})).nullish(),
|
|
1235
1235
|
raiMediaFilteredCount: z.number().nullish()
|
|
1236
1236
|
}).nullish()
|
|
1237
|
-
});
|
|
1237
|
+
})));
|
|
1238
1238
|
//#endregion
|
|
1239
1239
|
//#region src/google-vertex-provider-base.ts
|
|
1240
1240
|
const EXPRESS_MODE_BASE_URL = "https://aiplatform.googleapis.com/v1/publishers/google";
|