@ai-sdk/google-vertex 5.0.143 → 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 +13 -0
- package/dist/anthropic/edge/index.d.ts.map +1 -1
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/anthropic/index.d.ts.map +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +53 -12
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -12
- package/dist/index.js.map +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.map +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.map +1 -1
- package/docs/16-google-vertex.mdx +35 -0
- package/package.json +2 -2
- 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 +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
3
16
|
## 5.0.143
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -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 () => {
|
|
@@ -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.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." },
|
|
@@ -1100,17 +1101,38 @@ const googleVertexGeminiTranscriptionModelOptions = lazySchema(() => zodSchema(z
|
|
|
1100
1101
|
* disfluency removal, inline self-corrections, structured formatting
|
|
1101
1102
|
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
|
|
1102
1103
|
*/
|
|
1103
|
-
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()
|
|
1104
1120
|
})));
|
|
1105
1121
|
//#endregion
|
|
1106
1122
|
//#region src/gemini-transcription/google-vertex-gemini-transcription-model.ts
|
|
1107
1123
|
const liveWebSocketPath = "google.cloud.aiplatform.v1.LlmBidiService/BidiGenerateContent";
|
|
1108
1124
|
/**
|
|
1109
|
-
* After the input audio has ended, finish when no terminal signal
|
|
1110
|
-
*
|
|
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.
|
|
1111
1128
|
* Trailing transcripts reset the timer.
|
|
1112
1129
|
*/
|
|
1113
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;
|
|
1114
1136
|
/** Live transcription is only supported by `*-live` model variants. */
|
|
1115
1137
|
function isLiveTranscriptionModelId(modelId) {
|
|
1116
1138
|
return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
|
|
@@ -1261,9 +1283,11 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1261
1283
|
const { project, location } = this.config;
|
|
1262
1284
|
const modelResource = `projects/${project}/locations/${location}/publishers/google/models/${this.modelId}`;
|
|
1263
1285
|
const url = new URL(`wss://${vertexHost(location)}/ws/${liveWebSocketPath}`);
|
|
1286
|
+
const manualActivityDetection = googleOptions?.streaming?.automaticActivityDetection?.disabled === true;
|
|
1264
1287
|
const setup = {
|
|
1265
1288
|
model: modelResource,
|
|
1266
|
-
inputAudioTranscription: buildAudioTranscriptionConfig(googleOptions) ?? {}
|
|
1289
|
+
inputAudioTranscription: buildAudioTranscriptionConfig(googleOptions) ?? {},
|
|
1290
|
+
...manualActivityDetection ? { realtimeInputConfig: { automaticActivityDetection: { disabled: true } } } : {}
|
|
1267
1291
|
};
|
|
1268
1292
|
return {
|
|
1269
1293
|
request: { body: setup },
|
|
@@ -1277,6 +1301,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1277
1301
|
headers,
|
|
1278
1302
|
setup,
|
|
1279
1303
|
inputAudioRate: options.inputAudioFormat.rate ?? 16e3,
|
|
1304
|
+
manualActivityDetection,
|
|
1280
1305
|
finishGraceMs: this.config._internal?.finishGraceMs ?? defaultFinishGraceMs,
|
|
1281
1306
|
warnings,
|
|
1282
1307
|
audio: options.audio,
|
|
@@ -1286,7 +1311,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
1286
1311
|
};
|
|
1287
1312
|
}
|
|
1288
1313
|
};
|
|
1289
|
-
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 }) {
|
|
1290
1315
|
let finished = false;
|
|
1291
1316
|
let cleanup = () => {};
|
|
1292
1317
|
return new ReadableStream({
|
|
@@ -1305,6 +1330,8 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1305
1330
|
let audioEnded = false;
|
|
1306
1331
|
let usageMetadata;
|
|
1307
1332
|
let finishTimer;
|
|
1333
|
+
let lastVoiceActivity;
|
|
1334
|
+
let sentAudioBytes = 0;
|
|
1308
1335
|
const segmentId = () => `google-segment-${segmentCounter}`;
|
|
1309
1336
|
const cancelPendingFinish = () => {
|
|
1310
1337
|
if (finishTimer != null) {
|
|
@@ -1347,6 +1374,8 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1347
1374
|
segmentBuffer = "";
|
|
1348
1375
|
segmentCounter++;
|
|
1349
1376
|
};
|
|
1377
|
+
const getSentAudioMs = () => sentAudioBytes / (inputAudioRate * 2) * 1e3;
|
|
1378
|
+
const isTranscriptionComplete = () => lastVoiceActivity?.type === "ACTIVITY_END" && segmentBuffer === "" && latestInterim === "" && (lastVoiceActivity.audioOffsetMs ?? 0) >= getSentAudioMs() - audioEndToleranceMs;
|
|
1350
1379
|
const finish = () => {
|
|
1351
1380
|
if (finished) return;
|
|
1352
1381
|
completeSegment();
|
|
@@ -1366,13 +1395,17 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1366
1395
|
cleanup(1e3);
|
|
1367
1396
|
};
|
|
1368
1397
|
const sendAudio = async (socket) => {
|
|
1398
|
+
if (manualActivityDetection) socket.send(JSON.stringify({ realtimeInput: { activityStart: {} } }));
|
|
1369
1399
|
audioReader = audio.getReader();
|
|
1370
1400
|
try {
|
|
1371
1401
|
while (true) {
|
|
1372
1402
|
const { done, value } = await audioReader.read();
|
|
1373
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;
|
|
1374
1407
|
socket.send(JSON.stringify({ realtimeInput: { audio: {
|
|
1375
|
-
data
|
|
1408
|
+
data,
|
|
1376
1409
|
mimeType: `audio/pcm;rate=${inputAudioRate}`
|
|
1377
1410
|
} } }));
|
|
1378
1411
|
await waitForWebSocketBufferDrain(socket);
|
|
@@ -1382,9 +1415,10 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1382
1415
|
audioReader = void 0;
|
|
1383
1416
|
}
|
|
1384
1417
|
if (!finished) {
|
|
1385
|
-
socket.send(JSON.stringify({ realtimeInput: { audioStreamEnd: true } }));
|
|
1418
|
+
socket.send(JSON.stringify({ realtimeInput: manualActivityDetection ? { activityEnd: {} } : { audioStreamEnd: true } }));
|
|
1386
1419
|
audioEnded = true;
|
|
1387
|
-
|
|
1420
|
+
if (isTranscriptionComplete()) finish();
|
|
1421
|
+
else schedulePendingFinish();
|
|
1388
1422
|
}
|
|
1389
1423
|
};
|
|
1390
1424
|
connection = connectToWebSocket({
|
|
@@ -1413,6 +1447,13 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1413
1447
|
});
|
|
1414
1448
|
if (message.setupComplete != null) resolveSetupComplete();
|
|
1415
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
|
+
}
|
|
1416
1457
|
if (message.error != null) {
|
|
1417
1458
|
finishWithError(new Error(message.error.message ?? "Vertex Live API error"));
|
|
1418
1459
|
return;
|
|
@@ -1443,9 +1484,9 @@ function createVertexLiveTranscriptionStream({ webSocket, url, headers, setup, i
|
|
|
1443
1484
|
}
|
|
1444
1485
|
if (transcription.finished === true) completeSegment();
|
|
1445
1486
|
}
|
|
1446
|
-
if (serverContent?.turnComplete) completeSegment();
|
|
1487
|
+
if (serverContent?.generationComplete || serverContent?.turnComplete) completeSegment();
|
|
1447
1488
|
const interactionStatus = serverContent?.interactionStatus;
|
|
1448
|
-
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();
|
|
1449
1490
|
},
|
|
1450
1491
|
onSocketError: () => {
|
|
1451
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 })." : "")));
|