@ai-sdk/google-vertex 5.0.142 → 5.0.144
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 +26 -0
- package/dist/anthropic/edge/index.d.ts +1 -1
- package/dist/anthropic/edge/index.d.ts.map +1 -1
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/anthropic/index.d.ts +1 -1
- package/dist/anthropic/index.d.ts.map +1 -1
- package/dist/edge/index.d.ts +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +54 -12
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -12
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.d.ts +1 -1
- package/dist/maas/edge/index.d.ts.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/maas/index.d.ts +1 -1
- package/dist/maas/index.d.ts.map +1 -1
- package/dist/xai/edge/index.d.ts +1 -1
- package/dist/xai/edge/index.d.ts.map +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/dist/xai/index.d.ts +1 -1
- package/dist/xai/index.d.ts.map +1 -1
- package/docs/16-google-vertex.mdx +36 -0
- package/package.json +7 -7
- package/src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts +23 -0
- package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +90 -8
- package/src/google-vertex-model-catalog.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 5.0.144
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 378af05: fix(google, google-vertex): finish live transcription streams without the 3-second grace period
|
|
8
|
+
|
|
9
|
+
`gemini-3.5-transcribe-live` ends each segment with `generationComplete` and never sends `turnComplete`, so live transcription streams always waited out the 3-second finish grace period and merged all segments into one `transcript-final` without separating whitespace. Segments now complete on `generationComplete`, and streams finish as soon as server voice activity detection shows that all sent audio has been transcribed.
|
|
10
|
+
|
|
11
|
+
Adds `providerOptions.google.streaming.automaticActivityDetection.disabled` (`googleVertex` on Vertex) for push-to-talk input: the audio stream is transcribed as a single turn without splitting at pauses, and the transcript is finalized as soon as the audio input closes.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [378af05]
|
|
14
|
+
- @ai-sdk/google@4.0.124
|
|
15
|
+
|
|
16
|
+
## 5.0.143
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 875de7b: feat(google): add the `gemini-4-neon` model ID with `xhigh` thinking support
|
|
21
|
+
- Updated dependencies [1d2c2ff]
|
|
22
|
+
- Updated dependencies [875de7b]
|
|
23
|
+
- Updated dependencies [1f53cc2]
|
|
24
|
+
- @ai-sdk/provider-utils@5.0.83
|
|
25
|
+
- @ai-sdk/anthropic@4.0.107
|
|
26
|
+
- @ai-sdk/google@4.0.123
|
|
27
|
+
- @ai-sdk/openai-compatible@3.0.94
|
|
28
|
+
|
|
3
29
|
## 5.0.142
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -21,7 +21,7 @@ interface GoogleCredentials {
|
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/google-vertex-model-catalog.d.ts
|
|
24
|
-
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "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"];
|
|
24
|
+
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-4-neon", "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"];
|
|
25
25
|
declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
|
|
26
26
|
declare const embeddingModelIds: readonly ["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"];
|
|
27
27
|
declare const videoModelIds: readonly ["veo-2.0-generate-preview", "veo-2.0-generate-exp", "veo-2.0-generate-001", "veo-3.0-generate-001", "veo-3.0-fast-generate-001", "veo-3.0-generate-preview", "veo-3.0-fast-generate-preview", "veo-3.1-generate-001", "veo-3.1-fast-generate-001", "veo-3.1-generate-preview", "veo-3.1-fast-generate-preview"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../../src/edge/google-vertex-auth-edge.ts","../../../src/google-vertex-model-catalog.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"mappings":";;;;UAQiB;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../../src/edge/google-vertex-auth-edge.ts","../../../src/google-vertex-model-catalog.ts","../../../src/anthropic/google-vertex-anthropic-options.ts","../../../src/anthropic/google-vertex-anthropic-provider.ts","../../../src/anthropic/edge/google-vertex-anthropic-provider-edge.ts"],"mappings":";;;;UAQiB;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;cCqTI;cAuCA;cAOA;cAcA;cAcA;cAQA;cAEA;cA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GA;;;;;;;;;;;;;;cA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCM;EACV,kBAAkB;EAClB,eAAe;EACf,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,wBAAwB;EACxB,kBAAkB;EAClB,mBAAmB;;;;KCtnBT,+BACR;;;KCUC,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC7KO,8CAA8CC;;;;;;EAM7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAgBU,uBAAqB"}
|
|
@@ -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.144";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/edge/google-vertex-auth-edge.ts
|
|
9
9
|
const loadCredentials = async () => {
|
|
@@ -3,7 +3,7 @@ import { GoogleAuthOptions } from "google-auth-library";
|
|
|
3
3
|
import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
4
4
|
import { anthropicTools } from "@ai-sdk/anthropic/internal";
|
|
5
5
|
//#region src/google-vertex-model-catalog.d.ts
|
|
6
|
-
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "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"];
|
|
6
|
+
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-4-neon", "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"];
|
|
7
7
|
declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
|
|
8
8
|
declare const embeddingModelIds: readonly ["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"];
|
|
9
9
|
declare const videoModelIds: readonly ["veo-2.0-generate-preview", "veo-2.0-generate-exp", "veo-2.0-generate-001", "veo-3.0-generate-001", "veo-3.0-fast-generate-001", "veo-3.0-generate-preview", "veo-3.0-fast-generate-preview", "veo-3.1-generate-001", "veo-3.1-fast-generate-001", "veo-3.1-generate-preview", "veo-3.1-fast-generate-preview"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../src/google-vertex-model-catalog.ts","../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["GoogleVertexAnthropicProviderSettings","GoogleVertexAnthropicProviderSettingsOriginal"],"sources":["../../src/google-vertex-model-catalog.ts","../../src/anthropic/google-vertex-anthropic-options.ts","../../src/anthropic/google-vertex-anthropic-provider.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts"],"mappings":";;;;;cA8UM;cAuCA;cAOA;cAcA;cAcA;cAQA;cAEA;cA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GA;;;;;;;;;;;;;;cA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCM;EACV,kBAAkB;EAClB,eAAe;EACf,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,wBAAwB;EACxB,kBAAkB;EAClB,mBAAmB;;;;KCtnBT,+BACR;;;KCUC,6BAA6B,YACzB;;;;;cAiBI,4BAA4B;UAkFxB,sCAAsC;;;;GAIpD,SAAS,+BAA+B;;;;EAKzC,cAAc,SAAS,+BAA+B;;;;;;;;;EAUtD,cAAc;;;;EAKd,mBAAmB;;UAGJA;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;EAKA,UAAU,WAAW;;;;;EAMrB,QAAQ;;;;UC/KO,8CAA8CC;;;;;;;EAO7D,oBAAoB;;;;;EAKpB,0BAA0B;;wBAGZ,4BACd,UAAS,wCACR;;;;qBAiBU,uBAAqB"}
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { GoogleInteractionsAgentName, GoogleInteractionsModelId } from "@ai-sdk/
|
|
|
3
3
|
import { EmbeddingModelV4, Experimental_VideoModelV4, ImageModelV4, LanguageModelV4, ProviderV4, SpeechModelV4, TranscriptionModelV4 } from "@ai-sdk/provider";
|
|
4
4
|
import "@ai-sdk/google";
|
|
5
5
|
//#region src/google-vertex-model-catalog.d.ts
|
|
6
|
-
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "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"];
|
|
6
|
+
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-4-neon", "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"];
|
|
7
7
|
declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
|
|
8
8
|
declare const embeddingModelIds: readonly ["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"];
|
|
9
9
|
declare const videoModelIds: readonly ["veo-2.0-generate-preview", "veo-2.0-generate-exp", "veo-2.0-generate-001", "veo-3.0-generate-001", "veo-3.0-fast-generate-001", "veo-3.0-generate-preview", "veo-3.0-fast-generate-preview", "veo-3.1-generate-001", "veo-3.1-fast-generate-001", "veo-3.1-generate-preview", "veo-3.1-fast-generate-preview"];
|
package/dist/edge/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal"],"sources":["../../src/google-vertex-model-catalog.ts","../../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-model-catalog.ts","../../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":";;;;;cA8UM;cAuCA;cAOA;cAcA;cAcA;cAQA;cAEA;cA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GA;;;;;;;;;;;;;;cA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCM;EACV,kBAAkB;EAClB,eAAe;EACf,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,6BAA6B;EAC7B,wBAAwB;EACxB,kBAAkB;EAClB,mBAAmB;;;;KC1nBT,+BACR;;;UCRa;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;cCmBG,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;;;;KCrEX,2BACR;;;KCEQ,sBACR;;;cCJS;;;;MAUw8pC,YAAC;MAAsD,cAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCFjgqC,mCACR;;;KCTQ,2BACR;;;KCIQ,4BACR;;;UC6Ea,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;;;;;;;EAOf,SAAS;;;;EAKT;;;;EAKA;;;;;;;;EASA,UAAU,WAAW;;;;;EAMrB,QAAQ;EAGR;;;;EAKA;;;;;;EAOA,YAAY;;;;;EAMZ;;;;IAIE;;;;;UCjNa;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;UCbe,qCAAqCC;;;;;;EAMpD,oBAAoB;;wBAGN,mBACd,UAAS,+BACR;;;;qBA2BU,cAAY"}
|
package/dist/edge/index.js
CHANGED
|
@@ -27,7 +27,7 @@ function getGoogleVertexRequestConfig(modelId) {
|
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/version.ts
|
|
30
|
-
const VERSION = "5.0.
|
|
30
|
+
const VERSION = "5.0.144";
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/google-vertex-error.ts
|
|
33
33
|
const googleVertexErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
|
|
@@ -303,7 +303,8 @@ const googleVertexProviderOptions = {
|
|
|
303
303
|
customVocabulary: { description: "Vocabulary hints for Gemini transcription." },
|
|
304
304
|
wordTimestamp: { description: "Include Gemini word timestamps." },
|
|
305
305
|
diarization: { description: "Enable Gemini speaker diarization." },
|
|
306
|
-
mode: { description: "Verbatim or smart Gemini transcription formatting." }
|
|
306
|
+
mode: { description: "Verbatim or smart Gemini transcription formatting." },
|
|
307
|
+
streaming: { description: "Live Gemini voice activity detection." }
|
|
307
308
|
},
|
|
308
309
|
video: {
|
|
309
310
|
pollIntervalMs: { description: "Polling interval." },
|
|
@@ -434,6 +435,7 @@ const languageModelIds = [
|
|
|
434
435
|
"gemini-4-argon",
|
|
435
436
|
"gemini-4-carbon",
|
|
436
437
|
"gemini-4-hydrogen",
|
|
438
|
+
"gemini-4-neon",
|
|
437
439
|
"gemini-3.8-flash",
|
|
438
440
|
"gemini-3.7-flash",
|
|
439
441
|
"gemini-3.6-flash",
|
|
@@ -1099,17 +1101,38 @@ const googleVertexGeminiTranscriptionModelOptions = lazySchema(() => zodSchema(z
|
|
|
1099
1101
|
* disfluency removal, inline self-corrections, structured formatting
|
|
1100
1102
|
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
|
|
1101
1103
|
*/
|
|
1102
|
-
mode: z.enum(["SMART", "VERBATIM"]).optional()
|
|
1104
|
+
mode: z.enum(["SMART", "VERBATIM"]).optional(),
|
|
1105
|
+
/**
|
|
1106
|
+
* Options for live transcription models such as
|
|
1107
|
+
* `gemini-3.5-transcribe-live`.
|
|
1108
|
+
*/
|
|
1109
|
+
streaming: z.object({
|
|
1110
|
+
/**
|
|
1111
|
+
* Server-side voice activity detection, which splits the audio into
|
|
1112
|
+
* segments at pauses (enabled by default).
|
|
1113
|
+
*
|
|
1114
|
+
* Set `disabled: true` for push-to-talk input: the whole audio
|
|
1115
|
+
* stream is then transcribed as a single turn, without splitting at
|
|
1116
|
+
* pauses, and the transcript is finalized as soon as the audio
|
|
1117
|
+
* stream ends.
|
|
1118
|
+
*/
|
|
1119
|
+
automaticActivityDetection: z.object({ disabled: z.boolean().optional() }).optional() }).optional()
|
|
1103
1120
|
})));
|
|
1104
1121
|
//#endregion
|
|
1105
1122
|
//#region src/gemini-transcription/google-vertex-gemini-transcription-model.ts
|
|
1106
1123
|
const liveWebSocketPath = "google.cloud.aiplatform.v1.LlmBidiService/BidiGenerateContent";
|
|
1107
1124
|
/**
|
|
1108
|
-
* After the input audio has ended, finish when no terminal signal
|
|
1109
|
-
*
|
|
1125
|
+
* After the input audio has ended, finish when no terminal signal (idle
|
|
1126
|
+
* `interactionStatus`, `turnComplete`, or server VAD showing that all audio
|
|
1127
|
+
* was transcribed) arrives within this window.
|
|
1110
1128
|
* Trailing transcripts reset the timer.
|
|
1111
1129
|
*/
|
|
1112
1130
|
const defaultFinishGraceMs = 3e3;
|
|
1131
|
+
/**
|
|
1132
|
+
* Speech that server VAD ended within this distance of the end of the sent
|
|
1133
|
+
* audio counts as ending at the end of the audio.
|
|
1134
|
+
*/
|
|
1135
|
+
const audioEndToleranceMs = 250;
|
|
1113
1136
|
/** Live transcription is only supported by `*-live` model variants. */
|
|
1114
1137
|
function isLiveTranscriptionModelId(modelId) {
|
|
1115
1138
|
return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
|
|
@@ -1260,9 +1283,11 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1260
1283
|
const { project, location } = this.config;
|
|
1261
1284
|
const modelResource = `projects/${project}/locations/${location}/publishers/google/models/${this.modelId}`;
|
|
1262
1285
|
const url = new URL(`wss://${vertexHost(location)}/ws/${liveWebSocketPath}`);
|
|
1286
|
+
const manualActivityDetection = googleOptions?.streaming?.automaticActivityDetection?.disabled === true;
|
|
1263
1287
|
const setup = {
|
|
1264
1288
|
model: modelResource,
|
|
1265
|
-
inputAudioTranscription: buildAudioTranscriptionConfig(googleOptions) ?? {}
|
|
1289
|
+
inputAudioTranscription: buildAudioTranscriptionConfig(googleOptions) ?? {},
|
|
1290
|
+
...manualActivityDetection ? { realtimeInputConfig: { automaticActivityDetection: { disabled: true } } } : {}
|
|
1266
1291
|
};
|
|
1267
1292
|
return {
|
|
1268
1293
|
request: { body: setup },
|
|
@@ -1276,6 +1301,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1276
1301
|
headers,
|
|
1277
1302
|
setup,
|
|
1278
1303
|
inputAudioRate: options.inputAudioFormat.rate ?? 16e3,
|
|
1304
|
+
manualActivityDetection,
|
|
1279
1305
|
finishGraceMs: this.config._internal?.finishGraceMs ?? defaultFinishGraceMs,
|
|
1280
1306
|
warnings,
|
|
1281
1307
|
audio: options.audio,
|
|
@@ -1285,7 +1311,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1285
1311
|
};
|
|
1286
1312
|
}
|
|
1287
1313
|
};
|
|
1288
|
-
function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, inputAudioRate, finishGraceMs, warnings, audio, abortSignal, includeRawChunks }) {
|
|
1314
|
+
function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, inputAudioRate, manualActivityDetection, finishGraceMs, warnings, audio, abortSignal, includeRawChunks }) {
|
|
1289
1315
|
let finished = false;
|
|
1290
1316
|
let cleanup = () => {};
|
|
1291
1317
|
return new ReadableStream({
|
|
@@ -1304,6 +1330,8 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1304
1330
|
let audioEnded = false;
|
|
1305
1331
|
let usageMetadata;
|
|
1306
1332
|
let finishTimer;
|
|
1333
|
+
let lastVoiceActivity;
|
|
1334
|
+
let sentAudioBytes = 0;
|
|
1307
1335
|
const segmentId = () => `google-segment-${segmentCounter}`;
|
|
1308
1336
|
const cancelPendingFinish = () => {
|
|
1309
1337
|
if (finishTimer != null) {
|
|
@@ -1346,6 +1374,8 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1346
1374
|
segmentBuffer = "";
|
|
1347
1375
|
segmentCounter++;
|
|
1348
1376
|
};
|
|
1377
|
+
const getSentAudioMs = () => sentAudioBytes / (inputAudioRate * 2) * 1e3;
|
|
1378
|
+
const isTranscriptionComplete = () => lastVoiceActivity?.type === "ACTIVITY_END" && segmentBuffer === "" && latestInterim === "" && (lastVoiceActivity.audioOffsetMs ?? 0) >= getSentAudioMs() - audioEndToleranceMs;
|
|
1349
1379
|
const finish = () => {
|
|
1350
1380
|
if (finished) return;
|
|
1351
1381
|
completeSegment();
|
|
@@ -1365,13 +1395,17 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1365
1395
|
cleanup(1e3);
|
|
1366
1396
|
};
|
|
1367
1397
|
const sendAudio = async (socket) => {
|
|
1398
|
+
if (manualActivityDetection) socket.send(JSON.stringify({ realtimeInput: { activityStart: {} } }));
|
|
1368
1399
|
audioReader = audio.getReader();
|
|
1369
1400
|
try {
|
|
1370
1401
|
while (true) {
|
|
1371
1402
|
const { done, value } = await audioReader.read();
|
|
1372
1403
|
if (done || finished) break;
|
|
1404
|
+
const data = convertToBase64(value);
|
|
1405
|
+
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
1406
|
+
sentAudioBytes += data.length * 3 / 4 - padding;
|
|
1373
1407
|
socket.send(JSON.stringify({ realtimeInput: { audio: {
|
|
1374
|
-
data
|
|
1408
|
+
data,
|
|
1375
1409
|
mimeType: `audio/pcm;rate=${inputAudioRate}`
|
|
1376
1410
|
} } }));
|
|
1377
1411
|
await waitForWebSocketBufferDrain(socket);
|
|
@@ -1381,9 +1415,10 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1381
1415
|
audioReader = void 0;
|
|
1382
1416
|
}
|
|
1383
1417
|
if (!finished) {
|
|
1384
|
-
socket.send(JSON.stringify({ realtimeInput: { audioStreamEnd: true } }));
|
|
1418
|
+
socket.send(JSON.stringify({ realtimeInput: manualActivityDetection ? { activityEnd: {} } : { audioStreamEnd: true } }));
|
|
1385
1419
|
audioEnded = true;
|
|
1386
|
-
|
|
1420
|
+
if (isTranscriptionComplete()) finish();
|
|
1421
|
+
else schedulePendingFinish();
|
|
1387
1422
|
}
|
|
1388
1423
|
};
|
|
1389
1424
|
connection = connectToWebSocket({
|
|
@@ -1412,6 +1447,13 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1412
1447
|
});
|
|
1413
1448
|
if (message.setupComplete != null) resolveSetupComplete();
|
|
1414
1449
|
if (message.usageMetadata != null) usageMetadata = message.usageMetadata;
|
|
1450
|
+
if (message.voiceActivity?.type != null) {
|
|
1451
|
+
const audioOffsetSeconds = parseOffsetSeconds(message.voiceActivity.audioOffset);
|
|
1452
|
+
lastVoiceActivity = {
|
|
1453
|
+
type: message.voiceActivity.type,
|
|
1454
|
+
audioOffsetMs: audioOffsetSeconds != null ? audioOffsetSeconds * 1e3 : void 0
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1415
1457
|
if (message.error != null) {
|
|
1416
1458
|
finishWithError(new Error(message.error.message ?? "Vertex Live API error"));
|
|
1417
1459
|
return;
|
|
@@ -1442,9 +1484,9 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1442
1484
|
}
|
|
1443
1485
|
if (transcription.finished === true) completeSegment();
|
|
1444
1486
|
}
|
|
1445
|
-
if (serverContent?.turnComplete) completeSegment();
|
|
1487
|
+
if (serverContent?.generationComplete || serverContent?.turnComplete) completeSegment();
|
|
1446
1488
|
const interactionStatus = serverContent?.interactionStatus;
|
|
1447
|
-
if (audioEnded && (interactionStatus === "IDLE" || interactionStatus === "REQUIRES_ACTION" || serverContent?.turnComplete === true && interactionStatus == null)) finish();
|
|
1489
|
+
if (audioEnded && (interactionStatus === "IDLE" || interactionStatus === "REQUIRES_ACTION" || serverContent?.turnComplete === true && interactionStatus == null || isTranscriptionComplete())) finish();
|
|
1448
1490
|
},
|
|
1449
1491
|
onSocketError: () => {
|
|
1450
1492
|
finishWithError(/* @__PURE__ */ new Error("Vertex Live transcription error." + (webSocket == null ? " Note: the native WebSocket implementation cannot send the Authorization header required by Vertex. Pass a header-capable WebSocket implementation (e.g. the 'ws' package) via createVertex({ webSocket })." : "")));
|