diff --git a/lib/utils/transcription-utils.js b/lib/utils/transcription-utils.js index 60965c11..2211bcf6 100644 --- a/lib/utils/transcription-utils.js +++ b/lib/utils/transcription-utils.js @@ -142,7 +142,6 @@ const optimalDeepramModels = { tr: ['nova-2', 'nova-2'], uk: ['nova-2', 'nova-2'] }; - const selectDefaultDeepgramModel = (task, language) => { if (language in optimalDeepramModels) { const [gather, transcribe] = optimalDeepramModels[language]; @@ -151,6 +150,24 @@ const selectDefaultDeepgramModel = (task, language) => { return 'base'; }; +const optimalGoogleModels = { + 'v1' : { + 'en-IN':['telephony', 'latest_long'] + }, + 'v2' : { + 'en-IN':['telephony', 'long'] + } +}; +const selectDefaultGoogleModel = (task, language, version) => { + const useV2 = version === 'v2'; + if (language in optimalGoogleModels[version]) { + const [gather, transcribe] = optimalGoogleModels[version][language]; + return task.name === TaskName.Gather ? gather : transcribe; + } + return task.name === TaskName.Gather ? + (useV2 ? 'telephony_short' : 'command_and_search') : + (useV2 ? 'long' : 'latest_long'); +}; const consolidateTranscripts = (bufferedTranscripts, channel, language, vendor) => { if (bufferedTranscripts.length === 1) return bufferedTranscripts[0]; let totalConfidence = 0; @@ -497,9 +514,9 @@ module.exports = (logger) => { if ('google' === vendor) { const useV2 = rOpts.googleOptions?.serviceVersion === 'v2'; - const model = task.name === TaskName.Gather ? - (useV2 ? 'telephony_short' : 'command_and_search') : - (useV2 ? 'long' : 'latest_long'); + const version = useV2 ? 'v2' : 'v1'; + let {model} = rOpts; + model = model || selectDefaultGoogleModel(task, language, version); opts = { ...opts, ...(sttCredentials && {GOOGLE_APPLICATION_CREDENTIALS: JSON.stringify(sttCredentials.credentials)}),