agora-agents 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/agentkit/Agent.d.ts +49 -9
- package/dist/cjs/agentkit/Agent.js +92 -7
- package/dist/cjs/agentkit/AgentSession.d.ts +3 -3
- package/dist/cjs/agentkit/AgentSession.js +8 -7
- package/dist/cjs/agentkit/__tests__/type-safety.test.js +23 -3
- package/dist/cjs/agentkit/constants.d.ts +5 -4
- package/dist/cjs/agentkit/constants.js +5 -4
- package/dist/cjs/agentkit/index.d.ts +1 -1
- package/dist/cjs/agentkit/types.d.ts +50 -35
- package/dist/cjs/agentkit/vendors/avatar.d.ts +3 -1
- package/dist/cjs/agentkit/vendors/avatar.js +3 -1
- package/dist/cjs/agentkit/vendors/llm.d.ts +18 -8
- package/dist/cjs/agentkit/vendors/llm.js +83 -15
- package/dist/cjs/agentkit/vendors/mllm.d.ts +16 -0
- package/dist/cjs/agentkit/vendors/mllm.js +11 -7
- package/dist/cjs/agentkit/vendors/stt.d.ts +29 -11
- package/dist/cjs/agentkit/vendors/stt.js +74 -53
- package/dist/cjs/agentkit/vendors/tts.d.ts +70 -22
- package/dist/cjs/agentkit/vendors/tts.js +67 -34
- package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/agents/client/Client.js +3 -2
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +8 -331
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +0 -107
- package/dist/cjs/api/types/AmazonAsr.d.ts +10 -0
- package/dist/cjs/api/types/AmazonAsr.js +3 -0
- package/dist/cjs/api/types/AmazonAsrParams.d.ts +19 -0
- package/dist/cjs/api/types/AmazonAsrParams.js +3 -0
- package/dist/cjs/api/types/AmazonTtsParams.d.ts +19 -5
- package/dist/cjs/api/types/AmazonTtsParams.js +11 -0
- package/dist/cjs/api/types/AresAsr.d.ts +10 -0
- package/dist/cjs/api/types/AresAsr.js +3 -0
- package/dist/cjs/api/types/AresAsrParams.d.ts +4 -0
- package/dist/cjs/api/types/AresAsrParams.js +3 -0
- package/dist/cjs/api/types/Asr.d.ts +31 -0
- package/dist/cjs/api/types/Asr.js +3 -0
- package/dist/cjs/api/types/AsrLanguage.d.ts +36 -0
- package/dist/cjs/api/types/AsrLanguage.js +39 -0
- package/dist/cjs/api/types/AssemblyAiAsr.d.ts +10 -0
- package/dist/cjs/api/types/AssemblyAiAsr.js +3 -0
- package/dist/cjs/api/types/AssemblyAiAsrParams.d.ts +13 -0
- package/dist/cjs/api/types/AssemblyAiAsrParams.js +3 -0
- package/dist/cjs/api/types/CartesiaTtsOutputFormat.d.ts +11 -0
- package/dist/cjs/api/types/CartesiaTtsOutputFormat.js +3 -0
- package/dist/cjs/api/types/CartesiaTtsParams.d.ts +9 -4
- package/dist/cjs/api/types/CartesiaTtsVoice.d.ts +2 -0
- package/dist/cjs/api/types/DeepgramAsr.d.ts +12 -0
- package/dist/cjs/api/types/DeepgramAsr.js +3 -0
- package/dist/cjs/api/types/DeepgramAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/DeepgramAsrParams.js +3 -0
- package/dist/cjs/api/types/DeepgramTtsParams.d.ts +2 -2
- package/dist/cjs/api/types/ElevenLabsTtsParams.d.ts +13 -1
- package/dist/cjs/api/types/FishAudioTtsParams.d.ts +5 -1
- package/dist/cjs/api/types/GoogleAsr.d.ts +10 -0
- package/dist/cjs/api/types/GoogleAsr.js +3 -0
- package/dist/cjs/api/types/GoogleAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/GoogleAsrParams.js +3 -0
- package/dist/cjs/api/types/GoogleTtsAudioConfig.d.ts +11 -0
- package/dist/cjs/api/types/GoogleTtsAudioConfig.js +3 -0
- package/dist/cjs/api/types/GoogleTtsParams.d.ts +7 -8
- package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.d.ts +9 -0
- package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.js +3 -0
- package/dist/cjs/api/types/HumeAiTtsParams.d.ts +21 -1
- package/dist/cjs/api/types/HumeAiTtsParams.js +9 -0
- package/dist/cjs/api/types/Llm.d.ts +58 -0
- package/dist/cjs/api/types/Llm.js +15 -0
- package/dist/cjs/api/types/LlmParams.d.ts +11 -0
- package/dist/cjs/api/types/LlmParams.js +3 -0
- package/dist/cjs/api/types/MicrosoftAsr.d.ts +10 -0
- package/dist/cjs/api/types/MicrosoftAsr.js +3 -0
- package/dist/cjs/api/types/MicrosoftAsrParams.d.ts +15 -0
- package/dist/cjs/api/types/MicrosoftAsrParams.js +3 -0
- package/dist/cjs/api/types/MicrosoftTtsParams.d.ts +6 -0
- package/dist/cjs/api/types/MinimaxTtsParams.d.ts +4 -0
- package/dist/cjs/api/types/Mllm.d.ts +44 -0
- package/dist/cjs/api/types/Mllm.js +14 -0
- package/dist/cjs/api/types/MllmHttpOptions.d.ts +9 -0
- package/dist/cjs/api/types/MllmHttpOptions.js +3 -0
- package/dist/cjs/api/types/MllmInputAudioTranscription.d.ts +13 -0
- package/dist/cjs/api/types/MllmInputAudioTranscription.js +3 -0
- package/dist/cjs/api/types/MllmParams.d.ts +28 -0
- package/dist/cjs/api/types/MllmParams.js +3 -0
- package/dist/cjs/api/types/MllmTurnDetection.d.ts +65 -0
- package/dist/cjs/api/types/MllmTurnDetection.js +33 -0
- package/dist/cjs/api/types/MurfTtsParams.d.ts +17 -5
- package/dist/cjs/api/types/OpenAiAsr.d.ts +10 -0
- package/dist/cjs/api/types/OpenAiAsr.js +3 -0
- package/dist/cjs/api/types/OpenAiAsrParams.d.ts +11 -0
- package/dist/cjs/api/types/OpenAiAsrParams.js +3 -0
- package/dist/cjs/api/types/OpenAiInputAudioTranscription.d.ts +13 -0
- package/dist/cjs/api/types/OpenAiInputAudioTranscription.js +3 -0
- package/dist/cjs/api/types/OpenAiTtsParams.d.ts +9 -1
- package/dist/cjs/api/types/RimeTtsParams.d.ts +7 -3
- package/dist/cjs/api/types/SarvamAsr.d.ts +10 -0
- package/dist/cjs/api/types/SarvamAsr.js +3 -0
- package/dist/cjs/api/types/SarvamAsrParams.d.ts +11 -0
- package/dist/cjs/api/types/SarvamAsrParams.js +3 -0
- package/dist/cjs/api/types/SarvamTtsParams.d.ts +29 -2
- package/dist/cjs/api/types/SarvamTtsParams.js +18 -0
- package/dist/cjs/api/types/SpeechmaticsAsr.d.ts +10 -0
- package/dist/cjs/api/types/SpeechmaticsAsr.js +3 -0
- package/dist/cjs/api/types/SpeechmaticsAsrParams.d.ts +13 -0
- package/dist/cjs/api/types/SpeechmaticsAsrParams.js +3 -0
- package/dist/cjs/api/types/index.d.ts +31 -0
- package/dist/cjs/api/types/index.js +31 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/agentkit/Agent.d.mts +49 -9
- package/dist/esm/agentkit/Agent.mjs +92 -7
- package/dist/esm/agentkit/AgentSession.d.mts +3 -3
- package/dist/esm/agentkit/AgentSession.mjs +8 -7
- package/dist/esm/agentkit/__tests__/type-safety.test.mjs +23 -3
- package/dist/esm/agentkit/constants.d.mts +5 -4
- package/dist/esm/agentkit/constants.mjs +5 -4
- package/dist/esm/agentkit/index.d.mts +1 -1
- package/dist/esm/agentkit/types.d.mts +50 -35
- package/dist/esm/agentkit/vendors/avatar.d.mts +3 -1
- package/dist/esm/agentkit/vendors/avatar.mjs +3 -1
- package/dist/esm/agentkit/vendors/llm.d.mts +18 -8
- package/dist/esm/agentkit/vendors/llm.mjs +83 -15
- package/dist/esm/agentkit/vendors/mllm.d.mts +16 -0
- package/dist/esm/agentkit/vendors/mllm.mjs +11 -7
- package/dist/esm/agentkit/vendors/stt.d.mts +29 -11
- package/dist/esm/agentkit/vendors/stt.mjs +74 -53
- package/dist/esm/agentkit/vendors/tts.d.mts +70 -22
- package/dist/esm/agentkit/vendors/tts.mjs +67 -34
- package/dist/esm/api/resources/agents/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/agents/client/Client.mjs +3 -2
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +8 -331
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +0 -107
- package/dist/esm/api/types/AmazonAsr.d.mts +10 -0
- package/dist/esm/api/types/AmazonAsr.mjs +2 -0
- package/dist/esm/api/types/AmazonAsrParams.d.mts +19 -0
- package/dist/esm/api/types/AmazonAsrParams.mjs +2 -0
- package/dist/esm/api/types/AmazonTtsParams.d.mts +19 -5
- package/dist/esm/api/types/AmazonTtsParams.mjs +10 -1
- package/dist/esm/api/types/AresAsr.d.mts +10 -0
- package/dist/esm/api/types/AresAsr.mjs +2 -0
- package/dist/esm/api/types/AresAsrParams.d.mts +4 -0
- package/dist/esm/api/types/AresAsrParams.mjs +2 -0
- package/dist/esm/api/types/Asr.d.mts +31 -0
- package/dist/esm/api/types/Asr.mjs +2 -0
- package/dist/esm/api/types/AsrLanguage.d.mts +36 -0
- package/dist/esm/api/types/AsrLanguage.mjs +36 -0
- package/dist/esm/api/types/AssemblyAiAsr.d.mts +10 -0
- package/dist/esm/api/types/AssemblyAiAsr.mjs +2 -0
- package/dist/esm/api/types/AssemblyAiAsrParams.d.mts +13 -0
- package/dist/esm/api/types/AssemblyAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/CartesiaTtsOutputFormat.d.mts +11 -0
- package/dist/esm/api/types/CartesiaTtsOutputFormat.mjs +2 -0
- package/dist/esm/api/types/CartesiaTtsParams.d.mts +9 -4
- package/dist/esm/api/types/CartesiaTtsVoice.d.mts +2 -0
- package/dist/esm/api/types/DeepgramAsr.d.mts +12 -0
- package/dist/esm/api/types/DeepgramAsr.mjs +2 -0
- package/dist/esm/api/types/DeepgramAsrParams.d.mts +17 -0
- package/dist/esm/api/types/DeepgramAsrParams.mjs +2 -0
- package/dist/esm/api/types/DeepgramTtsParams.d.mts +2 -2
- package/dist/esm/api/types/ElevenLabsTtsParams.d.mts +13 -1
- package/dist/esm/api/types/FishAudioTtsParams.d.mts +5 -1
- package/dist/esm/api/types/GoogleAsr.d.mts +10 -0
- package/dist/esm/api/types/GoogleAsr.mjs +2 -0
- package/dist/esm/api/types/GoogleAsrParams.d.mts +17 -0
- package/dist/esm/api/types/GoogleAsrParams.mjs +2 -0
- package/dist/esm/api/types/GoogleTtsAudioConfig.d.mts +11 -0
- package/dist/esm/api/types/GoogleTtsAudioConfig.mjs +2 -0
- package/dist/esm/api/types/GoogleTtsParams.d.mts +7 -8
- package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.d.mts +9 -0
- package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.mjs +2 -0
- package/dist/esm/api/types/HumeAiTtsParams.d.mts +21 -1
- package/dist/esm/api/types/HumeAiTtsParams.mjs +8 -1
- package/dist/esm/api/types/Llm.d.mts +58 -0
- package/dist/esm/api/types/Llm.mjs +12 -0
- package/dist/esm/api/types/LlmParams.d.mts +11 -0
- package/dist/esm/api/types/LlmParams.mjs +2 -0
- package/dist/esm/api/types/MicrosoftAsr.d.mts +10 -0
- package/dist/esm/api/types/MicrosoftAsr.mjs +2 -0
- package/dist/esm/api/types/MicrosoftAsrParams.d.mts +15 -0
- package/dist/esm/api/types/MicrosoftAsrParams.mjs +2 -0
- package/dist/esm/api/types/MicrosoftTtsParams.d.mts +6 -0
- package/dist/esm/api/types/MinimaxTtsParams.d.mts +4 -0
- package/dist/esm/api/types/Mllm.d.mts +44 -0
- package/dist/esm/api/types/Mllm.mjs +11 -0
- package/dist/esm/api/types/MllmHttpOptions.d.mts +9 -0
- package/dist/esm/api/types/MllmHttpOptions.mjs +2 -0
- package/dist/esm/api/types/MllmInputAudioTranscription.d.mts +13 -0
- package/dist/esm/api/types/MllmInputAudioTranscription.mjs +2 -0
- package/dist/esm/api/types/MllmParams.d.mts +28 -0
- package/dist/esm/api/types/MllmParams.mjs +2 -0
- package/dist/esm/api/types/MllmTurnDetection.d.mts +65 -0
- package/dist/esm/api/types/MllmTurnDetection.mjs +30 -0
- package/dist/esm/api/types/MurfTtsParams.d.mts +17 -5
- package/dist/esm/api/types/OpenAiAsr.d.mts +10 -0
- package/dist/esm/api/types/OpenAiAsr.mjs +2 -0
- package/dist/esm/api/types/OpenAiAsrParams.d.mts +11 -0
- package/dist/esm/api/types/OpenAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/OpenAiInputAudioTranscription.d.mts +13 -0
- package/dist/esm/api/types/OpenAiInputAudioTranscription.mjs +2 -0
- package/dist/esm/api/types/OpenAiTtsParams.d.mts +9 -1
- package/dist/esm/api/types/RimeTtsParams.d.mts +7 -3
- package/dist/esm/api/types/SarvamAsr.d.mts +10 -0
- package/dist/esm/api/types/SarvamAsr.mjs +2 -0
- package/dist/esm/api/types/SarvamAsrParams.d.mts +11 -0
- package/dist/esm/api/types/SarvamAsrParams.mjs +2 -0
- package/dist/esm/api/types/SarvamTtsParams.d.mts +29 -2
- package/dist/esm/api/types/SarvamTtsParams.mjs +17 -1
- package/dist/esm/api/types/SpeechmaticsAsr.d.mts +10 -0
- package/dist/esm/api/types/SpeechmaticsAsr.mjs +2 -0
- package/dist/esm/api/types/SpeechmaticsAsrParams.d.mts +13 -0
- package/dist/esm/api/types/SpeechmaticsAsrParams.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +31 -0
- package/dist/esm/api/types/index.mjs +31 -0
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
|
@@ -15,6 +15,12 @@ export interface OpenAIRealtimeOptions {
|
|
|
15
15
|
apiKey: string;
|
|
16
16
|
/** Model name (e.g., 'gpt-4o-realtime-preview') */
|
|
17
17
|
model?: string;
|
|
18
|
+
/** Voice identifier for audio output */
|
|
19
|
+
voice?: string;
|
|
20
|
+
/** System instructions that define agent behavior */
|
|
21
|
+
instructions?: string;
|
|
22
|
+
/** Audio transcription settings */
|
|
23
|
+
inputAudioTranscription?: Record<string, unknown>;
|
|
18
24
|
/** WebSocket URL for real-time communication */
|
|
19
25
|
url?: string;
|
|
20
26
|
/** Agent greeting message */
|
|
@@ -63,6 +69,11 @@ export interface GeminiLiveOptions {
|
|
|
63
69
|
instructions?: string;
|
|
64
70
|
/** Voice name (e.g., 'Aoede', 'Charon') */
|
|
65
71
|
voice?: string;
|
|
72
|
+
affectiveDialog?: boolean;
|
|
73
|
+
proactiveAudio?: boolean;
|
|
74
|
+
transcribeAgent?: boolean;
|
|
75
|
+
transcribeUser?: boolean;
|
|
76
|
+
httpOptions?: Record<string, unknown>;
|
|
66
77
|
/** Agent greeting message */
|
|
67
78
|
greetingMessage?: string;
|
|
68
79
|
/** Input modalities (e.g., ['audio'], ['audio', 'text']) */
|
|
@@ -116,6 +127,11 @@ export interface VertexAIOptions {
|
|
|
116
127
|
instructions?: string;
|
|
117
128
|
/** Voice name (e.g., 'Aoede', 'Charon') */
|
|
118
129
|
voice?: string;
|
|
130
|
+
affectiveDialog?: boolean;
|
|
131
|
+
proactiveAudio?: boolean;
|
|
132
|
+
transcribeAgent?: boolean;
|
|
133
|
+
transcribeUser?: boolean;
|
|
134
|
+
httpOptions?: Record<string, unknown>;
|
|
119
135
|
/** Agent greeting message */
|
|
120
136
|
greetingMessage?: string;
|
|
121
137
|
/** Input modalities (e.g., ['audio'], ['audio', 'text']) */
|
|
@@ -27,13 +27,17 @@ class OpenAIRealtime extends base_js_1.BaseMLLM {
|
|
|
27
27
|
this.options = options;
|
|
28
28
|
}
|
|
29
29
|
toConfig() {
|
|
30
|
-
const { apiKey, model, url, greetingMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
30
|
+
const { apiKey, model, voice, instructions, inputAudioTranscription, url, greetingMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
31
31
|
// Build params only when there is something to include.
|
|
32
32
|
// Previously `...(model && { params: ... })` silently dropped the
|
|
33
33
|
// entire params object when model was undefined — fixed by checking
|
|
34
34
|
// either field independently.
|
|
35
|
-
const mergedParams = Object.assign(Object.assign({}, (model !== undefined && { model })), params);
|
|
36
|
-
const hasParams = model !== undefined ||
|
|
35
|
+
const mergedParams = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (model !== undefined && { model })), params), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })), (inputAudioTranscription !== undefined && { input_audio_transcription: inputAudioTranscription }));
|
|
36
|
+
const hasParams = model !== undefined ||
|
|
37
|
+
params !== undefined ||
|
|
38
|
+
voice !== undefined ||
|
|
39
|
+
instructions !== undefined ||
|
|
40
|
+
inputAudioTranscription !== undefined;
|
|
37
41
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "openai", api_key: apiKey }, (url && { url })), (hasParams && { params: mergedParams })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -59,8 +63,8 @@ class GeminiLive extends base_js_1.BaseMLLM {
|
|
|
59
63
|
this.options = options;
|
|
60
64
|
}
|
|
61
65
|
toConfig() {
|
|
62
|
-
const { apiKey, model, url, instructions, voice, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
63
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
66
|
+
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
67
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
exports.GeminiLive = GeminiLive;
|
|
@@ -87,8 +91,8 @@ class VertexAI extends base_js_1.BaseMLLM {
|
|
|
87
91
|
this.options = options;
|
|
88
92
|
}
|
|
89
93
|
toConfig() {
|
|
90
|
-
const { model, url, projectId, location, adcCredentialsString, instructions, voice, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
91
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai" }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model,
|
|
94
|
+
const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
95
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai" }, (url && { url })), { project_id: projectId, location, adc_credentials_string: adcCredentialsString, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
exports.VertexAI = VertexAI;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe STT (Speech-to-Text) vendor classes.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
5
|
-
import type { SttConfig } from "../types.js";
|
|
4
|
+
import { type DeepgramPresetModel } from "../presets.js";
|
|
5
|
+
import type { SttConfig, TurnDetectionLanguage } from "../types.js";
|
|
6
6
|
import { BaseSTT } from "./base.js";
|
|
7
7
|
/**
|
|
8
8
|
* Constructor options for Speechmatics STT.
|
|
@@ -14,6 +14,8 @@ export interface SpeechmaticsSTTOptions {
|
|
|
14
14
|
language: string;
|
|
15
15
|
/** Model name */
|
|
16
16
|
model?: string;
|
|
17
|
+
/** Speechmatics streaming WebSocket URL (for example, wss://eu2.rt.speechmatics.com/v2) */
|
|
18
|
+
uri?: string;
|
|
17
19
|
/** Additional vendor-specific parameters */
|
|
18
20
|
additionalParams?: Record<string, unknown>;
|
|
19
21
|
}
|
|
@@ -82,7 +84,7 @@ export interface MicrosoftSTTOptions {
|
|
|
82
84
|
/** Azure region (e.g., 'eastus', 'westus') */
|
|
83
85
|
region: string;
|
|
84
86
|
/** Language code (e.g., 'en-US', 'es-ES') */
|
|
85
|
-
language
|
|
87
|
+
language: string;
|
|
86
88
|
/** Additional vendor-specific parameters */
|
|
87
89
|
additionalParams?: Record<string, unknown>;
|
|
88
90
|
}
|
|
@@ -113,6 +115,10 @@ export interface OpenAISTTOptions {
|
|
|
113
115
|
model?: string;
|
|
114
116
|
/** Language code */
|
|
115
117
|
language?: string;
|
|
118
|
+
/** Prompt that guides OpenAI transcription */
|
|
119
|
+
prompt?: string;
|
|
120
|
+
/** Full OpenAI input_audio_transcription override */
|
|
121
|
+
inputAudioTranscription?: Record<string, unknown>;
|
|
116
122
|
/** Additional vendor-specific parameters */
|
|
117
123
|
additionalParams?: Record<string, unknown>;
|
|
118
124
|
}
|
|
@@ -135,10 +141,16 @@ export declare class OpenAISTT extends BaseSTT {
|
|
|
135
141
|
* Constructor options for Google Cloud Speech-to-Text STT.
|
|
136
142
|
*/
|
|
137
143
|
export interface GoogleSTTOptions {
|
|
138
|
-
/** Google Cloud
|
|
139
|
-
|
|
144
|
+
/** Google Cloud project ID where Speech-to-Text is enabled */
|
|
145
|
+
projectId: string;
|
|
146
|
+
/** Google Cloud region for the recognizer (for example, global) */
|
|
147
|
+
location: string;
|
|
148
|
+
/** Google service account credentials JSON string */
|
|
149
|
+
adcCredentialsString: string;
|
|
140
150
|
/** Language code (e.g., 'en-US', 'es-ES') */
|
|
141
|
-
language
|
|
151
|
+
language: string;
|
|
152
|
+
/** Recognition model to use */
|
|
153
|
+
model?: string;
|
|
142
154
|
/** Additional vendor-specific parameters */
|
|
143
155
|
additionalParams?: Record<string, unknown>;
|
|
144
156
|
}
|
|
@@ -148,7 +160,9 @@ export interface GoogleSTTOptions {
|
|
|
148
160
|
* @example
|
|
149
161
|
* ```typescript
|
|
150
162
|
* const stt = new GoogleSTT({
|
|
151
|
-
*
|
|
163
|
+
* projectId: process.env.GOOGLE_ASR_PROJECT_ID,
|
|
164
|
+
* location: 'global',
|
|
165
|
+
* adcCredentialsString: process.env.GOOGLE_APPLICATION_CREDENTIALS_STRING,
|
|
152
166
|
* language: 'en-US',
|
|
153
167
|
* });
|
|
154
168
|
* ```
|
|
@@ -169,7 +183,7 @@ export interface AmazonSTTOptions {
|
|
|
169
183
|
/** AWS region (e.g., 'us-east-1') */
|
|
170
184
|
region: string;
|
|
171
185
|
/** Language code */
|
|
172
|
-
language
|
|
186
|
+
language: string;
|
|
173
187
|
/** Additional vendor-specific parameters */
|
|
174
188
|
additionalParams?: Record<string, unknown>;
|
|
175
189
|
}
|
|
@@ -182,6 +196,7 @@ export interface AmazonSTTOptions {
|
|
|
182
196
|
* accessKey: process.env.AWS_ACCESS_KEY_ID,
|
|
183
197
|
* secretKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
184
198
|
* region: 'us-east-1',
|
|
199
|
+
* language: 'en-US',
|
|
185
200
|
* });
|
|
186
201
|
* ```
|
|
187
202
|
*/
|
|
@@ -197,7 +212,9 @@ export interface AssemblyAISTTOptions {
|
|
|
197
212
|
/** AssemblyAI API key */
|
|
198
213
|
apiKey: string;
|
|
199
214
|
/** Language code */
|
|
200
|
-
language
|
|
215
|
+
language: string;
|
|
216
|
+
/** AssemblyAI streaming WebSocket URL */
|
|
217
|
+
uri?: string;
|
|
201
218
|
/** Additional vendor-specific parameters */
|
|
202
219
|
additionalParams?: Record<string, unknown>;
|
|
203
220
|
}
|
|
@@ -208,6 +225,7 @@ export interface AssemblyAISTTOptions {
|
|
|
208
225
|
* ```typescript
|
|
209
226
|
* const stt = new AssemblyAISTT({
|
|
210
227
|
* apiKey: process.env.ASSEMBLYAI_API_KEY,
|
|
228
|
+
* language: 'en-US',
|
|
211
229
|
* });
|
|
212
230
|
* ```
|
|
213
231
|
*/
|
|
@@ -221,7 +239,7 @@ export declare class AssemblyAISTT extends BaseSTT {
|
|
|
221
239
|
*/
|
|
222
240
|
export interface AresSTTOptions {
|
|
223
241
|
/** Language code for ARES ASR */
|
|
224
|
-
language?:
|
|
242
|
+
language?: TurnDetectionLanguage;
|
|
225
243
|
/** Additional vendor-specific parameters */
|
|
226
244
|
additionalParams?: Record<string, unknown>;
|
|
227
245
|
}
|
|
@@ -231,7 +249,7 @@ export interface AresSTTOptions {
|
|
|
231
249
|
* @example
|
|
232
250
|
* ```typescript
|
|
233
251
|
* const stt = new AresSTT({
|
|
234
|
-
* language: 'en',
|
|
252
|
+
* language: 'en-US',
|
|
235
253
|
* });
|
|
236
254
|
* ```
|
|
237
255
|
*/
|
|
@@ -4,7 +4,50 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = void 0;
|
|
7
|
+
const presets_js_1 = require("../presets.js");
|
|
7
8
|
const base_js_1 = require("./base.js");
|
|
9
|
+
const INTERACTION_LANGUAGES = new Set([
|
|
10
|
+
"ar-EG",
|
|
11
|
+
"ar-JO",
|
|
12
|
+
"ar-SA",
|
|
13
|
+
"ar-AE",
|
|
14
|
+
"bn-IN",
|
|
15
|
+
"zh-CN",
|
|
16
|
+
"zh-HK",
|
|
17
|
+
"zh-TW",
|
|
18
|
+
"nl-NL",
|
|
19
|
+
"en-IN",
|
|
20
|
+
"en-US",
|
|
21
|
+
"fil-PH",
|
|
22
|
+
"fr-FR",
|
|
23
|
+
"de-DE",
|
|
24
|
+
"gu-IN",
|
|
25
|
+
"he-IL",
|
|
26
|
+
"hi-IN",
|
|
27
|
+
"id-ID",
|
|
28
|
+
"it-IT",
|
|
29
|
+
"ja-JP",
|
|
30
|
+
"kn-IN",
|
|
31
|
+
"ko-KR",
|
|
32
|
+
"ms-MY",
|
|
33
|
+
"fa-IR",
|
|
34
|
+
"pt-PT",
|
|
35
|
+
"ru-RU",
|
|
36
|
+
"es-ES",
|
|
37
|
+
"ta-IN",
|
|
38
|
+
"te-IN",
|
|
39
|
+
"th-TH",
|
|
40
|
+
"tr-TR",
|
|
41
|
+
"vi-VN",
|
|
42
|
+
]);
|
|
43
|
+
function toTurnDetectionLanguage(language) {
|
|
44
|
+
return language !== undefined && INTERACTION_LANGUAGES.has(language)
|
|
45
|
+
? language
|
|
46
|
+
: undefined;
|
|
47
|
+
}
|
|
48
|
+
function isDeepgramManagedModel(model) {
|
|
49
|
+
return model !== undefined && presets_js_1.DeepgramPresetModels.includes(model.trim().toLowerCase());
|
|
50
|
+
}
|
|
8
51
|
/**
|
|
9
52
|
* Speechmatics STT vendor.
|
|
10
53
|
*
|
|
@@ -22,15 +65,9 @@ class SpeechmaticsSTT extends base_js_1.BaseSTT {
|
|
|
22
65
|
this.options = options;
|
|
23
66
|
}
|
|
24
67
|
toConfig() {
|
|
25
|
-
const { apiKey, language, model, additionalParams } = this.options;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Top-level language is used by the Agora platform for routing/filtering.
|
|
29
|
-
// language inside params is forwarded directly to the Speechmatics API.
|
|
30
|
-
// Both are intentionally set to the same value.
|
|
31
|
-
language,
|
|
32
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (model !== undefined && { model })),
|
|
33
|
-
};
|
|
68
|
+
const { apiKey, language, model, uri, additionalParams } = this.options;
|
|
69
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
70
|
+
return Object.assign(Object.assign({ vendor: "speechmatics" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (model !== undefined && { model })), (uri !== undefined && { uri })) });
|
|
34
71
|
}
|
|
35
72
|
}
|
|
36
73
|
exports.SpeechmaticsSTT = SpeechmaticsSTT;
|
|
@@ -49,15 +86,15 @@ exports.SpeechmaticsSTT = SpeechmaticsSTT;
|
|
|
49
86
|
class DeepgramSTT extends base_js_1.BaseSTT {
|
|
50
87
|
constructor(options) {
|
|
51
88
|
super();
|
|
89
|
+
if (!(options === null || options === void 0 ? void 0 : options.apiKey) && !isDeepgramManagedModel(options === null || options === void 0 ? void 0 : options.model)) {
|
|
90
|
+
throw new Error("DeepgramSTT requires apiKey unless using a supported Agora-managed model");
|
|
91
|
+
}
|
|
52
92
|
this.options = options !== null && options !== void 0 ? options : {};
|
|
53
93
|
}
|
|
54
94
|
toConfig() {
|
|
55
95
|
const { apiKey, model, language, smartFormat, punctuation, additionalParams } = this.options;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
language,
|
|
59
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey && { api_key: apiKey })), (model && { model })), (language && { language })), (smartFormat !== undefined && { smart_format: smartFormat })), (punctuation !== undefined && { punctuation })),
|
|
60
|
-
};
|
|
96
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
97
|
+
return Object.assign(Object.assign({ vendor: "deepgram" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey && { key: apiKey })), (model && { model })), (language && { language })), (smartFormat !== undefined && { smart_format: smartFormat })), (punctuation !== undefined && { punctuation })) });
|
|
61
98
|
}
|
|
62
99
|
}
|
|
63
100
|
exports.DeepgramSTT = DeepgramSTT;
|
|
@@ -80,12 +117,9 @@ class MicrosoftSTT extends base_js_1.BaseSTT {
|
|
|
80
117
|
}
|
|
81
118
|
toConfig() {
|
|
82
119
|
const { key, region, language, additionalParams } = this.options;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
|
|
87
|
-
region }), (language && { language })),
|
|
88
|
-
};
|
|
120
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
121
|
+
return Object.assign(Object.assign({ vendor: "microsoft" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
|
|
122
|
+
region }), (language && { language })) });
|
|
89
123
|
}
|
|
90
124
|
}
|
|
91
125
|
exports.MicrosoftSTT = MicrosoftSTT;
|
|
@@ -105,12 +139,10 @@ class OpenAISTT extends base_js_1.BaseSTT {
|
|
|
105
139
|
this.options = options;
|
|
106
140
|
}
|
|
107
141
|
toConfig() {
|
|
108
|
-
const { apiKey, model, language, additionalParams } = this.options;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (model && { model })),
|
|
113
|
-
};
|
|
142
|
+
const { apiKey, model, language, prompt, inputAudioTranscription, additionalParams } = this.options;
|
|
143
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
144
|
+
const transcription = Object.assign(Object.assign(Object.assign(Object.assign({ model: "whisper-1" }, inputAudioTranscription), (model && { model })), (prompt && { prompt })), (language && { language }));
|
|
145
|
+
return Object.assign(Object.assign({ vendor: "openai" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, input_audio_transcription: transcription }) });
|
|
114
146
|
}
|
|
115
147
|
}
|
|
116
148
|
exports.OpenAISTT = OpenAISTT;
|
|
@@ -120,7 +152,9 @@ exports.OpenAISTT = OpenAISTT;
|
|
|
120
152
|
* @example
|
|
121
153
|
* ```typescript
|
|
122
154
|
* const stt = new GoogleSTT({
|
|
123
|
-
*
|
|
155
|
+
* projectId: process.env.GOOGLE_ASR_PROJECT_ID,
|
|
156
|
+
* location: 'global',
|
|
157
|
+
* adcCredentialsString: process.env.GOOGLE_APPLICATION_CREDENTIALS_STRING,
|
|
124
158
|
* language: 'en-US',
|
|
125
159
|
* });
|
|
126
160
|
* ```
|
|
@@ -131,12 +165,9 @@ class GoogleSTT extends base_js_1.BaseSTT {
|
|
|
131
165
|
this.options = options;
|
|
132
166
|
}
|
|
133
167
|
toConfig() {
|
|
134
|
-
const {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
language,
|
|
138
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })),
|
|
139
|
-
};
|
|
168
|
+
const { projectId, location, adcCredentialsString, language, model, additionalParams } = this.options;
|
|
169
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
170
|
+
return Object.assign(Object.assign({ vendor: "google" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { project_id: projectId, location, adc_credentials_string: adcCredentialsString }), (language && { language })), (model && { model })) });
|
|
140
171
|
}
|
|
141
172
|
}
|
|
142
173
|
exports.GoogleSTT = GoogleSTT;
|
|
@@ -149,6 +180,7 @@ exports.GoogleSTT = GoogleSTT;
|
|
|
149
180
|
* accessKey: process.env.AWS_ACCESS_KEY_ID,
|
|
150
181
|
* secretKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
151
182
|
* region: 'us-east-1',
|
|
183
|
+
* language: 'en-US',
|
|
152
184
|
* });
|
|
153
185
|
* ```
|
|
154
186
|
*/
|
|
@@ -159,11 +191,8 @@ class AmazonSTT extends base_js_1.BaseSTT {
|
|
|
159
191
|
}
|
|
160
192
|
toConfig() {
|
|
161
193
|
const { accessKey, secretKey, region, language, additionalParams } = this.options;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
language,
|
|
165
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { access_key: accessKey, secret_key: secretKey, region }), (language && { language })),
|
|
166
|
-
};
|
|
194
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
195
|
+
return Object.assign(Object.assign({ vendor: "amazon" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign({}, additionalParams), { access_key_id: accessKey, secret_access_key: secretKey, region }), (language && { language_code: language })) });
|
|
167
196
|
}
|
|
168
197
|
}
|
|
169
198
|
exports.AmazonSTT = AmazonSTT;
|
|
@@ -174,6 +203,7 @@ exports.AmazonSTT = AmazonSTT;
|
|
|
174
203
|
* ```typescript
|
|
175
204
|
* const stt = new AssemblyAISTT({
|
|
176
205
|
* apiKey: process.env.ASSEMBLYAI_API_KEY,
|
|
206
|
+
* language: 'en-US',
|
|
177
207
|
* });
|
|
178
208
|
* ```
|
|
179
209
|
*/
|
|
@@ -183,12 +213,9 @@ class AssemblyAISTT extends base_js_1.BaseSTT {
|
|
|
183
213
|
this.options = options;
|
|
184
214
|
}
|
|
185
215
|
toConfig() {
|
|
186
|
-
const { apiKey, language, additionalParams } = this.options;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
language,
|
|
190
|
-
params: Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }),
|
|
191
|
-
};
|
|
216
|
+
const { apiKey, language, uri, additionalParams } = this.options;
|
|
217
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
218
|
+
return Object.assign(Object.assign({ vendor: "assemblyai" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })), (uri && { uri })) });
|
|
192
219
|
}
|
|
193
220
|
}
|
|
194
221
|
exports.AssemblyAISTT = AssemblyAISTT;
|
|
@@ -198,7 +225,7 @@ exports.AssemblyAISTT = AssemblyAISTT;
|
|
|
198
225
|
* @example
|
|
199
226
|
* ```typescript
|
|
200
227
|
* const stt = new AresSTT({
|
|
201
|
-
* language: 'en',
|
|
228
|
+
* language: 'en-US',
|
|
202
229
|
* });
|
|
203
230
|
* ```
|
|
204
231
|
*/
|
|
@@ -231,14 +258,8 @@ class SarvamSTT extends base_js_1.BaseSTT {
|
|
|
231
258
|
}
|
|
232
259
|
toConfig() {
|
|
233
260
|
const { apiKey, language, model, additionalParams } = this.options;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// Top-level language is used by the Agora platform for routing/filtering.
|
|
237
|
-
// language inside params is forwarded directly to the Sarvam API.
|
|
238
|
-
// Both are intentionally set to the same value.
|
|
239
|
-
language,
|
|
240
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (model !== undefined && { model })),
|
|
241
|
-
};
|
|
261
|
+
const turnDetectionLanguage = toTurnDetectionLanguage(language);
|
|
262
|
+
return Object.assign(Object.assign({ vendor: "sarvam" }, (turnDetectionLanguage && { language: turnDetectionLanguage })), { params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (model !== undefined && { model })) });
|
|
242
263
|
}
|
|
243
264
|
}
|
|
244
265
|
exports.SarvamSTT = SarvamSTT;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.js";
|
|
5
5
|
import type { TtsConfig } from "../types.js";
|
|
6
6
|
import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.js";
|
|
7
7
|
import { BaseTTS } from "./base.js";
|
|
@@ -15,8 +15,8 @@ export interface ElevenLabsTTSOptions<SR extends ElevenLabsSampleRate = ElevenLa
|
|
|
15
15
|
modelId: string;
|
|
16
16
|
/** Voice ID */
|
|
17
17
|
voiceId: string;
|
|
18
|
-
/** WebSocket base URL
|
|
19
|
-
baseUrl
|
|
18
|
+
/** WebSocket base URL */
|
|
19
|
+
baseUrl: string;
|
|
20
20
|
/**
|
|
21
21
|
* Audio sample rate in Hz.
|
|
22
22
|
* - 16000 Hz: Required for Akool avatars
|
|
@@ -46,6 +46,7 @@ export interface ElevenLabsTTSOptions<SR extends ElevenLabsSampleRate = ElevenLa
|
|
|
46
46
|
* key: process.env.ELEVENLABS_API_KEY,
|
|
47
47
|
* modelId: 'eleven_flash_v2_5',
|
|
48
48
|
* voiceId: 'pNInz6obpgDQGcFmaJgB',
|
|
49
|
+
* baseUrl: 'wss://api.elevenlabs.io/v1',
|
|
49
50
|
* sampleRate: 24000, // For HeyGen avatar
|
|
50
51
|
* });
|
|
51
52
|
* ```
|
|
@@ -72,6 +73,10 @@ export interface MicrosoftTTSOptions<SR extends MicrosoftSampleRate = MicrosoftS
|
|
|
72
73
|
sampleRate?: SR;
|
|
73
74
|
/** Skip patterns for bracketed content */
|
|
74
75
|
skipPatterns?: number[];
|
|
76
|
+
/** Speaking rate multiplier. Values between 0.5 and 2.0. */
|
|
77
|
+
speed?: number;
|
|
78
|
+
/** Audio volume. Values between 0.0 and 100.0. */
|
|
79
|
+
volume?: number;
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
82
|
* Microsoft Azure TTS vendor.
|
|
@@ -101,8 +106,10 @@ type OpenAITTSCommonOptions = {
|
|
|
101
106
|
voice: string;
|
|
102
107
|
/** Model name (e.g., 'tts-1', 'tts-1-hd') */
|
|
103
108
|
model?: string;
|
|
104
|
-
/**
|
|
105
|
-
|
|
109
|
+
/** Endpoint URL for the OpenAI TTS service */
|
|
110
|
+
baseUrl?: string;
|
|
111
|
+
/** Custom instructions for voice style, accent, pace, and tone */
|
|
112
|
+
instructions?: string;
|
|
106
113
|
/** Speech speed multiplier */
|
|
107
114
|
speed?: number;
|
|
108
115
|
/** Skip patterns for bracketed content */
|
|
@@ -110,9 +117,12 @@ type OpenAITTSCommonOptions = {
|
|
|
110
117
|
};
|
|
111
118
|
export type OpenAITTSOptions = (OpenAITTSCommonOptions & {
|
|
112
119
|
apiKey: string;
|
|
113
|
-
|
|
120
|
+
model: string;
|
|
121
|
+
baseUrl: string;
|
|
122
|
+
}) | (Omit<OpenAITTSCommonOptions, "model" | "baseUrl"> & {
|
|
114
123
|
apiKey?: undefined;
|
|
115
124
|
model?: OpenAITtsPresetModel;
|
|
125
|
+
baseUrl?: undefined;
|
|
116
126
|
});
|
|
117
127
|
/**
|
|
118
128
|
* OpenAI TTS vendor.
|
|
@@ -123,6 +133,8 @@ export type OpenAITTSOptions = (OpenAITTSCommonOptions & {
|
|
|
123
133
|
* ```typescript
|
|
124
134
|
* const tts = new OpenAITTS({
|
|
125
135
|
* apiKey: process.env.OPENAI_API_KEY,
|
|
136
|
+
* model: 'gpt-4o-mini-tts',
|
|
137
|
+
* baseUrl: 'https://api.openai.com/v1',
|
|
126
138
|
* voice: 'alloy',
|
|
127
139
|
* });
|
|
128
140
|
* ```
|
|
@@ -141,7 +153,11 @@ export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSamp
|
|
|
141
153
|
/** Voice ID */
|
|
142
154
|
voiceId: string;
|
|
143
155
|
/** Model ID */
|
|
144
|
-
modelId
|
|
156
|
+
modelId: string;
|
|
157
|
+
/** WebSocket URL for the Cartesia streaming API */
|
|
158
|
+
baseUrl?: string;
|
|
159
|
+
/** Target language for speech synthesis */
|
|
160
|
+
language?: string;
|
|
145
161
|
/**
|
|
146
162
|
* Audio sample rate in Hz.
|
|
147
163
|
* Supported values: 8000, 16000, 22050, 24000, 44100, 48000
|
|
@@ -171,7 +187,7 @@ export declare class CartesiaTTS<SR extends CartesiaSampleRate = CartesiaSampleR
|
|
|
171
187
|
* Constructor options for Google TTS.
|
|
172
188
|
*/
|
|
173
189
|
export interface GoogleTTSOptions<SR extends GoogleTTSSampleRate = GoogleTTSSampleRate> {
|
|
174
|
-
/** Google Cloud
|
|
190
|
+
/** Google Cloud service account credentials JSON string */
|
|
175
191
|
key: string;
|
|
176
192
|
/** Voice name */
|
|
177
193
|
voiceName: string;
|
|
@@ -214,6 +230,8 @@ export interface AmazonTTSOptions {
|
|
|
214
230
|
region: string;
|
|
215
231
|
/** Amazon Polly voice ID */
|
|
216
232
|
voiceId: string;
|
|
233
|
+
/** Amazon Polly engine type */
|
|
234
|
+
engine: "standard" | "neural" | "long-form" | "generative";
|
|
217
235
|
/** Skip patterns for bracketed content */
|
|
218
236
|
skipPatterns?: number[];
|
|
219
237
|
}
|
|
@@ -227,6 +245,7 @@ export interface AmazonTTSOptions {
|
|
|
227
245
|
* secretKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
228
246
|
* region: 'us-east-1',
|
|
229
247
|
* voiceId: 'Joanna',
|
|
248
|
+
* engine: 'neural',
|
|
230
249
|
* });
|
|
231
250
|
* ```
|
|
232
251
|
*/
|
|
@@ -247,8 +266,8 @@ export interface DeepgramTTSOptions {
|
|
|
247
266
|
baseUrl?: string;
|
|
248
267
|
/** Audio sample rate in Hz */
|
|
249
268
|
sampleRate?: number;
|
|
250
|
-
/** Additional Deepgram TTS parameters */
|
|
251
|
-
|
|
269
|
+
/** Additional Deepgram TTS parameters, flattened into tts.params */
|
|
270
|
+
additionalParams?: Record<string, unknown>;
|
|
252
271
|
/** Skip patterns for bracketed content */
|
|
253
272
|
skipPatterns?: number[];
|
|
254
273
|
}
|
|
@@ -268,6 +287,16 @@ export interface HumeAITTSOptions {
|
|
|
268
287
|
key: string;
|
|
269
288
|
/** Configuration ID */
|
|
270
289
|
configId?: string;
|
|
290
|
+
/** Hume AI voice ID */
|
|
291
|
+
voiceId: string;
|
|
292
|
+
/** Base URL for the Hume AI API */
|
|
293
|
+
baseUrl?: string;
|
|
294
|
+
/** Voice provider type */
|
|
295
|
+
provider: "HUME_AI" | "CUSTOM_VOICE";
|
|
296
|
+
/** Playback speed of the generated speech */
|
|
297
|
+
speed?: number;
|
|
298
|
+
/** Duration of silence in seconds to add at the end of each utterance */
|
|
299
|
+
trailingSilence?: number;
|
|
271
300
|
/** Skip patterns for bracketed content */
|
|
272
301
|
skipPatterns?: number[];
|
|
273
302
|
}
|
|
@@ -278,6 +307,8 @@ export interface HumeAITTSOptions {
|
|
|
278
307
|
* ```typescript
|
|
279
308
|
* const tts = new HumeAITTS({
|
|
280
309
|
* key: process.env.HUME_API_KEY,
|
|
310
|
+
* voiceId: 'voice-id',
|
|
311
|
+
* provider: 'CUSTOM_VOICE',
|
|
281
312
|
* });
|
|
282
313
|
* ```
|
|
283
314
|
*/
|
|
@@ -295,13 +326,9 @@ export interface RimeTTSOptions {
|
|
|
295
326
|
/** Speaker ID */
|
|
296
327
|
speaker: string;
|
|
297
328
|
/** Model ID */
|
|
298
|
-
modelId
|
|
299
|
-
/**
|
|
300
|
-
|
|
301
|
-
/** Sampling rate in Hz */
|
|
302
|
-
samplingRate?: number;
|
|
303
|
-
/** Speed multiplier */
|
|
304
|
-
speedAlpha?: number;
|
|
329
|
+
modelId: string;
|
|
330
|
+
/** WebSocket URL for the Rime streaming API */
|
|
331
|
+
baseUrl?: string;
|
|
305
332
|
/** Skip patterns for bracketed content */
|
|
306
333
|
skipPatterns?: number[];
|
|
307
334
|
}
|
|
@@ -313,6 +340,7 @@ export interface RimeTTSOptions {
|
|
|
313
340
|
* const tts = new RimeTTS({
|
|
314
341
|
* key: process.env.RIME_API_KEY,
|
|
315
342
|
* speaker: 'speaker-id',
|
|
343
|
+
* modelId: 'mist',
|
|
316
344
|
* });
|
|
317
345
|
* ```
|
|
318
346
|
*/
|
|
@@ -329,6 +357,8 @@ export interface FishAudioTTSOptions {
|
|
|
329
357
|
key: string;
|
|
330
358
|
/** Reference ID */
|
|
331
359
|
referenceId: string;
|
|
360
|
+
/** Backend used by Fish Audio */
|
|
361
|
+
backend: string;
|
|
332
362
|
/** Skip patterns for bracketed content */
|
|
333
363
|
skipPatterns?: number[];
|
|
334
364
|
}
|
|
@@ -340,6 +370,7 @@ export interface FishAudioTTSOptions {
|
|
|
340
370
|
* const tts = new FishAudioTTS({
|
|
341
371
|
* key: process.env.FISH_AUDIO_API_KEY,
|
|
342
372
|
* referenceId: 'reference-id',
|
|
373
|
+
* backend: 'speech-1.5',
|
|
343
374
|
* });
|
|
344
375
|
* ```
|
|
345
376
|
*/
|
|
@@ -402,7 +433,15 @@ export interface SarvamTTSOptions {
|
|
|
402
433
|
/** Speaker/voice ID (e.g., 'anushka', 'abhilash', 'karun', 'hitesh', 'manisha', 'vidya', 'arya') */
|
|
403
434
|
speaker: string;
|
|
404
435
|
/** Target language code (e.g., 'en-IN', 'hi-IN', 'ta-IN') */
|
|
405
|
-
targetLanguageCode:
|
|
436
|
+
targetLanguageCode: import("../types.js").SarvamTtsParams["target_language_code"];
|
|
437
|
+
/** Pitch adjustment for the voice */
|
|
438
|
+
pitch?: number;
|
|
439
|
+
/** Speed of speech */
|
|
440
|
+
pace?: number;
|
|
441
|
+
/** Volume level of the speech */
|
|
442
|
+
loudness?: number;
|
|
443
|
+
/** Audio sample rate in Hz */
|
|
444
|
+
sampleRate?: number;
|
|
406
445
|
/** Skip patterns for bracketed content */
|
|
407
446
|
skipPatterns?: number[];
|
|
408
447
|
}
|
|
@@ -430,9 +469,19 @@ export interface MurfTTSOptions {
|
|
|
430
469
|
/** Murf API key */
|
|
431
470
|
key: string;
|
|
432
471
|
/** Voice ID (e.g., 'Ariana', 'Natalie', 'Ken') */
|
|
433
|
-
voiceId
|
|
434
|
-
/**
|
|
435
|
-
|
|
472
|
+
voiceId?: string;
|
|
473
|
+
/** WebSocket endpoint for streaming TTS output */
|
|
474
|
+
baseUrl?: string;
|
|
475
|
+
/** Locale for the selected voice */
|
|
476
|
+
locale?: string;
|
|
477
|
+
/** Speech rate adjustment */
|
|
478
|
+
rate?: number;
|
|
479
|
+
/** Pitch adjustment */
|
|
480
|
+
pitch?: number;
|
|
481
|
+
/** TTS model to use */
|
|
482
|
+
model?: string;
|
|
483
|
+
/** Audio sample rate in Hz */
|
|
484
|
+
sampleRate?: number;
|
|
436
485
|
/** Skip patterns for bracketed content */
|
|
437
486
|
skipPatterns?: number[];
|
|
438
487
|
}
|
|
@@ -444,7 +493,6 @@ export interface MurfTTSOptions {
|
|
|
444
493
|
* const tts = new MurfTTS({
|
|
445
494
|
* key: process.env.MURF_API_KEY,
|
|
446
495
|
* voiceId: 'Ariana',
|
|
447
|
-
* style: 'Conversational',
|
|
448
496
|
* });
|
|
449
497
|
* ```
|
|
450
498
|
*/
|