diff --git a/lib/utils/transcription-utils.js b/lib/utils/transcription-utils.js index c942c3e8..1c52da7a 100644 --- a/lib/utils/transcription-utils.js +++ b/lib/utils/transcription-utils.js @@ -487,14 +487,10 @@ module.exports = (logger) => { }; if ('google' === vendor) { - const model = task.name === TaskName.Gather ? 'command_and_search' : 'latest_long'; - /** - * When we support google v2 the models are different and we will want something like: - * const useV2 = sttCredentials?.credentials?.project_id; //TODO: v2 pref should be set in googleOptions - * const model = task.name === TaskName.Gather ? - * (useV2 ? 'telephony_short' : 'command_and_search') : - * (useV2 ? 'long' : 'latest_long'); - */ + const useV2 = rOpts.googleOptions?.serviceVersion === 'v2'; + const model = task.name === TaskName.Gather ? + (useV2 ? 'telephony_short' : 'command_and_search') : + (useV2 ? 'long' : 'latest_long'); opts = { ...opts, ...(sttCredentials && {GOOGLE_APPLICATION_CREDENTIALS: JSON.stringify(sttCredentials.credentials)}), @@ -527,12 +523,19 @@ module.exports = (logger) => { ...{GOOGLE_SPEECH_MODEL: rOpts.model || model}, ...(rOpts.naicsCode > 0 && {GOOGLE_SPEECH_METADATA_INDUSTRY_NAICS_CODE: rOpts.naicsCode}), GOOGLE_SPEECH_METADATA_RECORDING_DEVICE_TYPE: 'phone_line', - /* ...(useV2 && { GOOGLE_SPEECH_RECOGNIZER_PARENT: `projects/${sttCredentials.credentials.project_id}/locations/global`, - GOOGLE_SPEECH_CLOUD_SERVICES_VERSION: 'v2' - }), - */ + GOOGLE_SPEECH_CLOUD_SERVICES_VERSION: 'v2', + ...(rOpts.googleOptions?.speechStartTimeoutMs && { + GOOGLE_SPEECH_START_TIMEOUT_MS: rOpts.googleOptions.speechStartTimeoutMs + }), + ...(rOpts.googleOptions?.speechEndTimeoutMs && { + GOOGLE_SPEECH_END_TIMEOUT_MS: rOpts.googleOptions.speechEndTimeoutMs + }), + ...(rOpts.googleOptions?.transcriptNormalization && { + GOOGLE_SPEECH_TRANSCRIPTION_NORMALIZATION: JSON.stringify(rOpts.googleOptions.transcriptNormalization) + }) + }), }; } else if (['aws', 'polly'].includes(vendor)) { diff --git a/package-lock.json b/package-lock.json index 7b006d6f..3d803f44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@jambonz/speech-utils": "^0.0.44", "@jambonz/stats-collector": "^0.1.9", "@jambonz/time-series": "^0.2.8", - "@jambonz/verb-specifications": "^0.0.64", + "@jambonz/verb-specifications": "^0.0.66", "@opentelemetry/api": "^1.4.0", "@opentelemetry/exporter-jaeger": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.35.0", @@ -3514,9 +3514,9 @@ } }, "node_modules/@jambonz/verb-specifications": { - "version": "0.0.64", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.64.tgz", - "integrity": "sha512-cW9wci240vSkVqVhN/B0MnJYXL4vUCAOia0ccNlVDiQmrcED3hFU1IkFXHRzyY5uiD+GaoapXUOqaerjbDtmLA==", + "version": "0.0.66", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.66.tgz", + "integrity": "sha512-K1+7PCoKAEw/sOhqRFD6FjZHt/G9I0kaM24Zrh//W1zblc9jXvg8YIn1Hwx94yXemWMkqNNrmJsnyL9haOi5rg==", "dependencies": { "debug": "^4.3.4", "pino": "^8.8.0" @@ -14183,9 +14183,9 @@ } }, "@jambonz/verb-specifications": { - "version": "0.0.64", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.64.tgz", - "integrity": "sha512-cW9wci240vSkVqVhN/B0MnJYXL4vUCAOia0ccNlVDiQmrcED3hFU1IkFXHRzyY5uiD+GaoapXUOqaerjbDtmLA==", + "version": "0.0.66", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.66.tgz", + "integrity": "sha512-K1+7PCoKAEw/sOhqRFD6FjZHt/G9I0kaM24Zrh//W1zblc9jXvg8YIn1Hwx94yXemWMkqNNrmJsnyL9haOi5rg==", "requires": { "debug": "^4.3.4", "pino": "^8.8.0" diff --git a/package.json b/package.json index 8a928b53..ab2a8a46 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@jambonz/speech-utils": "^0.0.44", "@jambonz/stats-collector": "^0.1.9", "@jambonz/time-series": "^0.2.8", - "@jambonz/verb-specifications": "^0.0.64", + "@jambonz/verb-specifications": "^0.0.66", "@opentelemetry/api": "^1.4.0", "@opentelemetry/exporter-jaeger": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.35.0",