Feat/assemblyai testing (#516)

* handle errors from assemblyai

* wip

* fix alert

* normalizeAssemblyai
This commit is contained in:
Dave Horton
2023-11-02 17:05:28 -04:00
committed by GitHub
parent 7fee2ba2dc
commit 6d625d87ad
5 changed files with 68 additions and 35 deletions

View File

@@ -380,6 +380,24 @@ const normalizeAws = (evt, channel, language) => {
};
};
const normalizeAssemblyAi = (evt, channel, language) => {
const copy = JSON.parse(JSON.stringify(evt));
return {
language_code: language,
channel_tag: channel,
is_final: evt.message_type === 'FinalTranscript',
alternatives: [
{
confidence: evt.confidence,
transcript: evt.text,
}
],
vendor: {
name: 'ASSEMBLYAI',
evt: copy
}
};
};
module.exports = (logger) => {
const normalizeTranscription = (evt, vendor, channel, language, shortUtterance) => {
@@ -404,6 +422,8 @@ module.exports = (logger) => {
return normalizeSoniox(evt, channel, language);
case 'cobalt':
return normalizeCobalt(evt, channel, language);
case 'assemblyai':
return normalizeAssemblyAi(evt, channel, language, shortUtterance);
default:
if (vendor.startsWith('custom:')) {
return normalizeCustom(evt, channel, language, vendor);