google STT: when altLanguges are used default to a model that supports it

This commit is contained in:
Dave Horton
2023-03-31 12:31:14 -04:00
parent a29795839d
commit 2ebfbfb3d8

View File

@@ -1,4 +1,5 @@
const {
TaskName,
AzureTranscriptionEvents,
GoogleTranscriptionEvents,
AwsTranscriptionEvents,
@@ -335,6 +336,11 @@ module.exports = (logger) => {
};
if ('google' === vendor) {
const altLanguages = [...new Set(rOpts.altLanguages)];
let model = 'phone_call';
if (altLanguages.length) {
model = task.name === TaskName.Gather ? 'command_and_search' : 'latest_long';
}
opts = {
...opts,
...(sttCredentials && {GOOGLE_APPLICATION_CREDENTIALS: JSON.stringify(sttCredentials.credentials)}),
@@ -363,7 +369,7 @@ module.exports = (logger) => {
{GOOGLE_SPEECH_ALTERNATIVE_LANGUAGE_CODES: [...new Set(rOpts.altLanguages)].join(',')}),
...(rOpts.interactionType &&
{GOOGLE_SPEECH_METADATA_INTERACTION_TYPE: rOpts.interactionType}),
...{GOOGLE_SPEECH_MODEL: rOpts.model || 'phone_call'},
...{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',
};