mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-14 18:30:59 +00:00
Compare commits
7 Commits
v0.9.6-rc3
...
feat/eleve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85b1166194 | ||
|
|
5d8ea34716 | ||
|
|
cf7e89914b | ||
|
|
225d1039db | ||
|
|
14c5bc18cd | ||
|
|
e8817814bf | ||
|
|
cd9f9632ba |
@@ -1141,6 +1141,7 @@ class CallSession extends Emitter {
|
||||
return {
|
||||
api_key: credential.api_key,
|
||||
model_id: credential.model_id,
|
||||
stt_model_id: credential.stt_model_id,
|
||||
api_uri: credential.api_uri,
|
||||
options: credential.options
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ const {
|
||||
AwsTranscriptionEvents,
|
||||
AzureTranscriptionEvents,
|
||||
DeepgramTranscriptionEvents,
|
||||
ElevenlabsTranscriptionEvents,
|
||||
GladiaTranscriptionEvents,
|
||||
SonioxTranscriptionEvents,
|
||||
CobaltTranscriptionEvents,
|
||||
@@ -492,6 +493,17 @@ class TaskGather extends SttTask {
|
||||
this.addCustomEventListener(ep, DeepgramfluxTranscriptionEvents.Error, this._onVendorError.bind(this, cs, ep));
|
||||
break;
|
||||
|
||||
case 'elevenlabs':
|
||||
this.bugname = `${this.bugname_prefix}elevenlabs_transcribe`;
|
||||
this.addCustomEventListener(
|
||||
ep, ElevenlabsTranscriptionEvents.Transcription, this._onTranscription.bind(this, cs, ep));
|
||||
this.addCustomEventListener(
|
||||
ep, ElevenlabsTranscriptionEvents.Connect, this._onVendorConnect.bind(this, cs, ep));
|
||||
this.addCustomEventListener(ep, ElevenlabsTranscriptionEvents.ConnectFailure,
|
||||
this._onVendorConnectFailure.bind(this, cs, ep));
|
||||
this.addCustomEventListener(ep, ElevenlabsTranscriptionEvents.Error, this._onVendorError.bind(this, cs, ep));
|
||||
break;
|
||||
|
||||
case 'gladia':
|
||||
this.bugname = `${this.bugname_prefix}gladia_transcribe`;
|
||||
this.addCustomEventListener(
|
||||
|
||||
@@ -103,6 +103,12 @@
|
||||
"Connect": "deepgramflux_transcribe::connect",
|
||||
"Error": "deepgramflux_transcribe::error"
|
||||
},
|
||||
"ElevenlabsTranscriptionEvents": {
|
||||
"Transcription": "elevenlabs_transcribe::transcription",
|
||||
"ConnectFailure": "elevenlabs_transcribe::connect_failed",
|
||||
"Connect": "elevenlabs_transcribe::connect",
|
||||
"Error": "elevenlabs_transcribe::error"
|
||||
},
|
||||
"GladiaTranscriptionEvents": {
|
||||
"Transcription": "gladia_transcribe::transcription",
|
||||
"ConnectFailure": "gladia_transcribe::connect_failed",
|
||||
|
||||
@@ -106,6 +106,7 @@ const speechMapper = (cred) => {
|
||||
const o = JSON.parse(decrypt(credential));
|
||||
obj.api_key = o.api_key;
|
||||
obj.model_id = o.model_id;
|
||||
obj.stt_model_id = o.stt_model_id;
|
||||
obj.api_uri = o.api_uri;
|
||||
obj.options = o.options;
|
||||
}
|
||||
|
||||
@@ -545,6 +545,23 @@ const normalizeVerbio = (evt, channel, language) => {
|
||||
};
|
||||
};
|
||||
|
||||
const normalizeElevenlabs = (evt, channel, language) => {
|
||||
const copy = JSON.parse(JSON.stringify(evt));
|
||||
return {
|
||||
language_code: language,
|
||||
channel_tag: channel,
|
||||
is_final: evt.message_type === 'committed_transcript',
|
||||
alternatives: [{
|
||||
confidence: 1.0,
|
||||
transcript: evt.text,
|
||||
}],
|
||||
vendor: {
|
||||
name: 'elevenlabs',
|
||||
evt: copy
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const normalizeMicrosoft = (evt, channel, language, punctuation = true) => {
|
||||
const copy = JSON.parse(JSON.stringify(evt));
|
||||
const nbest = evt.NBest;
|
||||
@@ -770,6 +787,8 @@ module.exports = (logger) => {
|
||||
return normalizeGladia(evt, channel, language, shortUtterance);
|
||||
case 'deepgramflux':
|
||||
return normalizeDeepgramFlux(evt, channel, language, shortUtterance);
|
||||
case 'elevenlabs':
|
||||
return normalizeElevenlabs(evt, channel, language);
|
||||
case 'microsoft':
|
||||
return normalizeMicrosoft(evt, channel, language, punctuation);
|
||||
case 'google':
|
||||
@@ -1085,6 +1104,24 @@ module.exports = (logger) => {
|
||||
...(keyterms && keyterms.length > 0 && {DEEPGRAMFLUX_SPEECH_KEYTERMS: keyterms.join(',')}),
|
||||
};
|
||||
}
|
||||
else if ('elevenlabs' === vendor) {
|
||||
const {api_key, stt_model_id} = sttCredentials;
|
||||
const {includeTimestamps, commitStrategy, vadSilenceThresholdSecs, vadThreshold,
|
||||
minSpeechDurationMs, minSilenceDurationMs, enableLogging} = rOpts.elevenlabsOptions || {};
|
||||
|
||||
opts = {
|
||||
...opts,
|
||||
ELEVENLABS_API_KEY: api_key,
|
||||
ELEVENLABS_MODEL_ID: stt_model_id,
|
||||
ELEVENLABS_INCLUDE_TIMESTAMPS: includeTimestamps === true ? true : false,
|
||||
...(commitStrategy && {ELEVENLABS_COMMIT_STRATEGY: commitStrategy}),
|
||||
...(vadSilenceThresholdSecs && {ELEVENLABS_VAD_SILENCE_THRESHOLD_SECS: vadSilenceThresholdSecs}),
|
||||
...(vadThreshold && {ELEVENLABS_VAD_THRESHOLD: vadThreshold}),
|
||||
...(minSpeechDurationMs && {ELEVENLABS_MIN_SPEECH_DURATION_MS: minSpeechDurationMs}),
|
||||
...(minSilenceDurationMs && {ELEVENLABS_MIN_SILENCE_DURATION_MS: minSilenceDurationMs}),
|
||||
...(enableLogging && {ELEVENLABS_ENABLE_LOGGING: enableLogging ? 1 : 0}),
|
||||
};
|
||||
}
|
||||
else if ('gladia' === vendor) {
|
||||
const {host, path} = sttCredentials;
|
||||
opts = {
|
||||
|
||||
1
package-lock.json
generated
1
package-lock.json
generated
@@ -8752,6 +8752,7 @@
|
||||
},
|
||||
"node_modules/unix-dgram": {
|
||||
"version": "2.0.6",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user