From cd06fa20499a48f8edf07a5b669e687e9e668eb3 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 17 Apr 2024 14:10:10 -0400 Subject: [PATCH] gather: do not set utterance_end_ms on Deepgram if endpointing is explicitly turned off, and also in that case return transcripts when is_final is true --- lib/tasks/gather.js | 3 ++- lib/utils/transcription-utils.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 85a9fc29..2bd67abe 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -351,7 +351,8 @@ class TaskGather extends SttTask { /* some special deepgram logic */ if (this.vendor === 'deepgram') { if (this.isContinuousAsr) this._doContinuousAsrWithDeepgram(this.asrTimeout); - if (this.data.recognizer?.deepgramOptions?.shortUtterance) this.shortUtterance = true; + if (this.data.recognizer?.deepgramOptions?.shortUtterance || + this.data.recognizer?.deepgramOptions?.endpointing === false) this.shortUtterance = true; } const opts = this.setChannelVarsForStt(this, this.sttCredentials, this.language, this.data.recognizer); diff --git a/lib/utils/transcription-utils.js b/lib/utils/transcription-utils.js index e83aa99f..5889775c 100644 --- a/lib/utils/transcription-utils.js +++ b/lib/utils/transcription-utils.js @@ -692,7 +692,7 @@ module.exports = (logger) => { ...('endpointing' in deepgramOptions) && {DEEPGRAM_SPEECH_ENDPOINTING: deepgramOptions.endpointing === false ? 'false' : deepgramOptions.endpointing, // default DEEPGRAM_SPEECH_UTTERANCE_END_MS is 1000, will be override by user settings later if there is. - DEEPGRAM_SPEECH_UTTERANCE_END_MS: 1000}, + DEEPGRAM_SPEECH_UTTERANCE_END_MS: deepgramOptions.endpointing === false ? null : 1000}, ...(deepgramOptions.utteranceEndMs) && {DEEPGRAM_SPEECH_UTTERANCE_END_MS: deepgramOptions.utteranceEndMs}, ...(deepgramOptions.vadTurnoff) &&