mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feat/882: default model setting for en-IN language (#888)
* feat/882: default model setting for en-IN language * feat/882: refactored if into ||
This commit is contained in:
@@ -142,7 +142,6 @@ const optimalDeepramModels = {
|
|||||||
tr: ['nova-2', 'nova-2'],
|
tr: ['nova-2', 'nova-2'],
|
||||||
uk: ['nova-2', 'nova-2']
|
uk: ['nova-2', 'nova-2']
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectDefaultDeepgramModel = (task, language) => {
|
const selectDefaultDeepgramModel = (task, language) => {
|
||||||
if (language in optimalDeepramModels) {
|
if (language in optimalDeepramModels) {
|
||||||
const [gather, transcribe] = optimalDeepramModels[language];
|
const [gather, transcribe] = optimalDeepramModels[language];
|
||||||
@@ -151,6 +150,24 @@ const selectDefaultDeepgramModel = (task, language) => {
|
|||||||
return 'base';
|
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) => {
|
const consolidateTranscripts = (bufferedTranscripts, channel, language, vendor) => {
|
||||||
if (bufferedTranscripts.length === 1) return bufferedTranscripts[0];
|
if (bufferedTranscripts.length === 1) return bufferedTranscripts[0];
|
||||||
let totalConfidence = 0;
|
let totalConfidence = 0;
|
||||||
@@ -497,9 +514,9 @@ module.exports = (logger) => {
|
|||||||
|
|
||||||
if ('google' === vendor) {
|
if ('google' === vendor) {
|
||||||
const useV2 = rOpts.googleOptions?.serviceVersion === 'v2';
|
const useV2 = rOpts.googleOptions?.serviceVersion === 'v2';
|
||||||
const model = task.name === TaskName.Gather ?
|
const version = useV2 ? 'v2' : 'v1';
|
||||||
(useV2 ? 'telephony_short' : 'command_and_search') :
|
let {model} = rOpts;
|
||||||
(useV2 ? 'long' : 'latest_long');
|
model = model || selectDefaultGoogleModel(task, language, version);
|
||||||
opts = {
|
opts = {
|
||||||
...opts,
|
...opts,
|
||||||
...(sttCredentials && {GOOGLE_APPLICATION_CREDENTIALS: JSON.stringify(sttCredentials.credentials)}),
|
...(sttCredentials && {GOOGLE_APPLICATION_CREDENTIALS: JSON.stringify(sttCredentials.credentials)}),
|
||||||
|
|||||||
Reference in New Issue
Block a user