agora-agents 2.0.1 → 2.1.1
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/AgoraPoolClient.js +7 -2
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.js +16 -8
- package/dist/cjs/agentkit/Agent.d.ts +56 -11
- package/dist/cjs/agentkit/Agent.js +114 -15
- package/dist/cjs/agentkit/AgentSession.d.ts +4 -3
- package/dist/cjs/agentkit/AgentSession.js +39 -10
- 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/presets.d.ts +30 -0
- package/dist/cjs/agentkit/presets.js +9 -2
- 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/core/base64.js +5 -1
- 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/AgoraPoolClient.mjs +7 -2
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.mjs +16 -8
- package/dist/esm/agentkit/Agent.d.mts +56 -11
- package/dist/esm/agentkit/Agent.mjs +114 -15
- package/dist/esm/agentkit/AgentSession.d.mts +4 -3
- package/dist/esm/agentkit/AgentSession.mjs +40 -11
- 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/presets.d.mts +30 -0
- package/dist/esm/agentkit/presets.mjs +9 -6
- 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/core/base64.mjs +5 -1
- 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 +2 -1
|
@@ -36,8 +36,8 @@ const token_js_1 = require("./token.js");
|
|
|
36
36
|
* });
|
|
37
37
|
*
|
|
38
38
|
* const agent = new Agent({ name: 'support-assistant', instructions: 'You are a helpful voice assistant.' })
|
|
39
|
-
* .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini' }))
|
|
40
|
-
* .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
|
|
39
|
+
* .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
|
|
40
|
+
* .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
|
|
41
41
|
* .withStt(new DeepgramSTT({ apiKey: '...', language: 'en-US' }));
|
|
42
42
|
*
|
|
43
43
|
* const session = agent.createSession(client, {
|
|
@@ -295,6 +295,35 @@ class AgentSession {
|
|
|
295
295
|
"Pass agoraToken on the avatar vendor or provide appCertificate for automatic token generation.");
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
+
_vendorValidationCategories(pipelineId) {
|
|
299
|
+
const skipVendorValidationCategories = new Set();
|
|
300
|
+
const allowMissingVendorCategories = new Set();
|
|
301
|
+
if (pipelineId) {
|
|
302
|
+
allowMissingVendorCategories.add("asr");
|
|
303
|
+
allowMissingVendorCategories.add("llm");
|
|
304
|
+
allowMissingVendorCategories.add("tts");
|
|
305
|
+
}
|
|
306
|
+
const normalizedPreset = (0, presets_js_1.normalizePresetInput)(this._preset);
|
|
307
|
+
if (normalizedPreset) {
|
|
308
|
+
for (const item of normalizedPreset.split(",")) {
|
|
309
|
+
const category = (0, presets_js_1.getPresetCategory)(item);
|
|
310
|
+
if (category) {
|
|
311
|
+
skipVendorValidationCategories.add(category);
|
|
312
|
+
allowMissingVendorCategories.add(category);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if ((0, presets_js_1.inferAsrPreset)(this._agent.stt)) {
|
|
317
|
+
skipVendorValidationCategories.add("asr");
|
|
318
|
+
}
|
|
319
|
+
if ((0, presets_js_1.inferLlmPreset)(this._agent.llm)) {
|
|
320
|
+
skipVendorValidationCategories.add("llm");
|
|
321
|
+
}
|
|
322
|
+
if ((0, presets_js_1.inferTtsPreset)(this._agent.tts)) {
|
|
323
|
+
skipVendorValidationCategories.add("tts");
|
|
324
|
+
}
|
|
325
|
+
return { skipVendorValidationCategories, allowMissingVendorCategories };
|
|
326
|
+
}
|
|
298
327
|
/**
|
|
299
328
|
* Start the agent session.
|
|
300
329
|
*
|
|
@@ -305,7 +334,7 @@ class AgentSession {
|
|
|
305
334
|
*/
|
|
306
335
|
start() {
|
|
307
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
-
var _a, _b;
|
|
337
|
+
var _a, _b, _c;
|
|
309
338
|
if (this._status !== "idle" && this._status !== "stopped" && this._status !== "error") {
|
|
310
339
|
throw new Error(`Cannot start session in ${this._status} state`);
|
|
311
340
|
}
|
|
@@ -318,6 +347,7 @@ class AgentSession {
|
|
|
318
347
|
}
|
|
319
348
|
this._status = "starting";
|
|
320
349
|
try {
|
|
350
|
+
const pipelineId = (_a = this._pipelineId) !== null && _a !== void 0 ? _a : this._agent.pipelineId;
|
|
321
351
|
// appCertificate presence is guaranteed by the guard above when no token is provided.
|
|
322
352
|
let expiresIn = this._expiresIn;
|
|
323
353
|
if (expiresIn !== undefined) {
|
|
@@ -330,10 +360,9 @@ class AgentSession {
|
|
|
330
360
|
appCertificate: this._appCertificate,
|
|
331
361
|
expiresIn,
|
|
332
362
|
};
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
skipVendorValidation: !!(this._preset || this._pipelineId) }, tokenOpts));
|
|
363
|
+
const { skipVendorValidationCategories, allowMissingVendorCategories } = this._vendorValidationCategories(pipelineId);
|
|
364
|
+
const properties = this._agent.toProperties(Object.assign({ channel: this._channel, agentUid: this._agentUid, remoteUids: this._remoteUids, idleTimeout: this._idleTimeout, enableStringUid: this._enableStringUid, skipVendorValidationCategories,
|
|
365
|
+
allowMissingVendorCategories }, tokenOpts));
|
|
337
366
|
const resolved = (0, presets_js_1.resolveSessionPresets)({
|
|
338
367
|
preset: this._preset,
|
|
339
368
|
properties,
|
|
@@ -344,7 +373,7 @@ class AgentSession {
|
|
|
344
373
|
appid: this._appId,
|
|
345
374
|
name: this._name,
|
|
346
375
|
preset: resolved.preset,
|
|
347
|
-
pipeline_id:
|
|
376
|
+
pipeline_id: pipelineId,
|
|
348
377
|
properties: enrichedProperties,
|
|
349
378
|
};
|
|
350
379
|
if (this._debug) {
|
|
@@ -355,10 +384,10 @@ class AgentSession {
|
|
|
355
384
|
console.log("[Agora Debug] Request:", JSON.stringify(request, null, 2));
|
|
356
385
|
}
|
|
357
386
|
const response = yield this._client.agents.start(request, { headers: this._convoAIHeaders() });
|
|
358
|
-
this._agentId = (
|
|
387
|
+
this._agentId = (_b = response.agent_id) !== null && _b !== void 0 ? _b : null;
|
|
359
388
|
this._status = "running";
|
|
360
389
|
this._emit("started", { agentId: this._agentId });
|
|
361
|
-
return (
|
|
390
|
+
return (_c = this._agentId) !== null && _c !== void 0 ? _c : "";
|
|
362
391
|
}
|
|
363
392
|
catch (error) {
|
|
364
393
|
this._status = "error";
|
|
@@ -28,6 +28,7 @@ function _validExample1() {
|
|
|
28
28
|
key: "test",
|
|
29
29
|
modelId: "eleven_flash_v2_5",
|
|
30
30
|
voiceId: "test",
|
|
31
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
31
32
|
sampleRate: 24000,
|
|
32
33
|
}))
|
|
33
34
|
.withAvatar(new avatar_js_1.LiveAvatarAvatar({
|
|
@@ -43,6 +44,7 @@ function _validExample2() {
|
|
|
43
44
|
key: "test",
|
|
44
45
|
modelId: "eleven_flash_v2_5",
|
|
45
46
|
voiceId: "test",
|
|
47
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
46
48
|
sampleRate: 16000,
|
|
47
49
|
}))
|
|
48
50
|
.withAvatar(new avatar_js_1.AkoolAvatar({
|
|
@@ -70,6 +72,8 @@ function _validExample4() {
|
|
|
70
72
|
.withTts(new tts_js_1.OpenAITTS({
|
|
71
73
|
apiKey: "test",
|
|
72
74
|
voice: "alloy",
|
|
75
|
+
model: "gpt-4o-mini-tts",
|
|
76
|
+
baseUrl: "https://api.openai.com/v1",
|
|
73
77
|
}))
|
|
74
78
|
.withAvatar(new avatar_js_1.LiveAvatarAvatar({
|
|
75
79
|
apiKey: "test",
|
|
@@ -83,6 +87,7 @@ function _validExample5() {
|
|
|
83
87
|
.withTts(new tts_js_1.CartesiaTTS({
|
|
84
88
|
apiKey: "test",
|
|
85
89
|
voiceId: "test",
|
|
90
|
+
modelId: "sonic-2",
|
|
86
91
|
sampleRate: 16000,
|
|
87
92
|
}))
|
|
88
93
|
.withAvatar(new avatar_js_1.AkoolAvatar({
|
|
@@ -93,7 +98,12 @@ function _validExample5() {
|
|
|
93
98
|
new stt_js_1.DeepgramSTT({ model: "nova-3" });
|
|
94
99
|
new llm_js_1.OpenAI({ model: "gpt-5-mini" });
|
|
95
100
|
new tts_js_1.OpenAITTS({ voice: "alloy" });
|
|
96
|
-
new llm_js_1.OpenAI({
|
|
101
|
+
new llm_js_1.OpenAI({
|
|
102
|
+
apiKey: "test",
|
|
103
|
+
model: "gpt-5-mini",
|
|
104
|
+
url: "https://api.openai.com/v1/chat/completions",
|
|
105
|
+
vendor: "custom",
|
|
106
|
+
});
|
|
97
107
|
new tts_js_1.MiniMaxTTS({
|
|
98
108
|
model: "speech-2.6-turbo",
|
|
99
109
|
});
|
|
@@ -127,6 +137,7 @@ function invalidMismatch1(): Agent<24000> {
|
|
|
127
137
|
key: "test",
|
|
128
138
|
modelId: "eleven_flash_v2_5",
|
|
129
139
|
voiceId: "test",
|
|
140
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
130
141
|
sampleRate: 16000, // ❌ Wrong rate for HeyGen
|
|
131
142
|
})
|
|
132
143
|
)
|
|
@@ -148,6 +159,7 @@ function invalidMismatch2(): Agent<16000> {
|
|
|
148
159
|
key: "test",
|
|
149
160
|
modelId: "eleven_flash_v2_5",
|
|
150
161
|
voiceId: "test",
|
|
162
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
151
163
|
sampleRate: 24000, // ❌ Wrong rate for Akool
|
|
152
164
|
})
|
|
153
165
|
)
|
|
@@ -191,7 +203,8 @@ function invalidEnum1() {
|
|
|
191
203
|
key: "test",
|
|
192
204
|
modelId: "eleven_flash_v2_5",
|
|
193
205
|
voiceId: "test",
|
|
194
|
-
|
|
206
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
207
|
+
sampleRate: 25000, // ❌ Not in enum: 16000, 22050, 24000, 44100
|
|
195
208
|
})
|
|
196
209
|
);
|
|
197
210
|
}
|
|
@@ -216,7 +229,8 @@ function invalidEnum3() {
|
|
|
216
229
|
new CartesiaTTS({
|
|
217
230
|
key: "test",
|
|
218
231
|
voiceId: "test",
|
|
219
|
-
|
|
232
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
233
|
+
sampleRate: 32000, // ❌ Not in enum: 8000-48000 (specific values)
|
|
220
234
|
})
|
|
221
235
|
);
|
|
222
236
|
}
|
|
@@ -238,6 +252,7 @@ function _edgeCase2() {
|
|
|
238
252
|
key: "test",
|
|
239
253
|
modelId: "eleven_flash_v2_5",
|
|
240
254
|
voiceId: "test",
|
|
255
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
241
256
|
sampleRate: 16000,
|
|
242
257
|
}));
|
|
243
258
|
}
|
|
@@ -248,6 +263,7 @@ function _edgeCase3() {
|
|
|
248
263
|
key: "test",
|
|
249
264
|
modelId: "eleven_flash_v2_5",
|
|
250
265
|
voiceId: "test",
|
|
266
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
251
267
|
sampleRate: 24000,
|
|
252
268
|
}))
|
|
253
269
|
.withInstructions("Updated instructions")
|
|
@@ -266,6 +282,7 @@ function _typeInference1() {
|
|
|
266
282
|
key: "test",
|
|
267
283
|
modelId: "eleven_flash_v2_5",
|
|
268
284
|
voiceId: "test",
|
|
285
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
269
286
|
sampleRate: 24000,
|
|
270
287
|
}));
|
|
271
288
|
// Verify: Type should be Agent<24000>
|
|
@@ -277,6 +294,7 @@ function _typeInference2() {
|
|
|
277
294
|
key: "test",
|
|
278
295
|
modelId: "eleven_flash_v2_5",
|
|
279
296
|
voiceId: "test",
|
|
297
|
+
baseUrl: "wss://api.elevenlabs.io/v1",
|
|
280
298
|
sampleRate: 16000,
|
|
281
299
|
}));
|
|
282
300
|
// Verify: Type should be Agent<16000>
|
|
@@ -287,6 +305,8 @@ function _typeInference3() {
|
|
|
287
305
|
const openAIAgent = new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.OpenAITTS({
|
|
288
306
|
apiKey: "test",
|
|
289
307
|
voice: "alloy",
|
|
308
|
+
model: "gpt-4o-mini-tts",
|
|
309
|
+
baseUrl: "https://api.openai.com/v1",
|
|
290
310
|
}));
|
|
291
311
|
// Verify: OpenAI is fixed at 24kHz, so type should be Agent<24000>
|
|
292
312
|
const _typeCheck = openAIAgent;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { AgentThinkAgentManagementRequest as AgentThinkRequestNS } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js";
|
|
6
6
|
import { SpeakAgentsRequest as SpeakAgentsRequestNS } from "../api/resources/agents/client/requests/SpeakAgentsRequest.js";
|
|
7
7
|
import { StartAgentsRequest as StartAgentsRequestNS } from "../api/resources/agents/client/requests/StartAgentsRequest.js";
|
|
8
|
+
import { MllmTurnDetection as MllmTurnDetectionNS } from "../api/types/MllmTurnDetection.js";
|
|
8
9
|
/** Data channel: `"rtm"` | `"datastream"` */
|
|
9
10
|
export declare const DataChannel: typeof StartAgentsRequestNS.Properties.Parameters.DataChannel;
|
|
10
11
|
/** RTC audio scenario: `"default"` | `"chorus"` | `"aiserver"` */
|
|
@@ -45,13 +46,13 @@ export declare const SpeakPriorityAppend: SpeakAgentsRequestNS.Priority;
|
|
|
45
46
|
/** Drop the message if the agent is busy. */
|
|
46
47
|
export declare const SpeakPriorityIgnore: SpeakAgentsRequestNS.Priority;
|
|
47
48
|
/** MLLM turn-detection mode: `"agora_vad"` | `"server_vad"` | `"semantic_vad"` */
|
|
48
|
-
export declare const MllmTurnDetectionModeValues: typeof
|
|
49
|
+
export declare const MllmTurnDetectionModeValues: typeof MllmTurnDetectionNS.Mode;
|
|
49
50
|
/** MLLM turn-detection mode: Agora VAD. */
|
|
50
|
-
export declare const MllmTurnDetectionModeAgoraVad:
|
|
51
|
+
export declare const MllmTurnDetectionModeAgoraVad: MllmTurnDetectionNS.Mode;
|
|
51
52
|
/** MLLM turn-detection mode: server/vendor VAD. */
|
|
52
|
-
export declare const MllmTurnDetectionModeServerVad:
|
|
53
|
+
export declare const MllmTurnDetectionModeServerVad: MllmTurnDetectionNS.Mode;
|
|
53
54
|
/** MLLM turn-detection mode: semantic VAD. */
|
|
54
|
-
export declare const MllmTurnDetectionModeSemanticVad:
|
|
55
|
+
export declare const MllmTurnDetectionModeSemanticVad: MllmTurnDetectionNS.Mode;
|
|
55
56
|
/** Think action when the agent is listening: inject custom text without interrupting. */
|
|
56
57
|
export declare const ThinkOnListeningActionInject: AgentThinkRequestNS.OnListeningAction;
|
|
57
58
|
/** Think action when the agent is listening: interrupt and start a new turn. */
|
|
@@ -9,6 +9,7 @@ exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = e
|
|
|
9
9
|
const AgentThinkAgentManagementRequest_js_1 = require("../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js");
|
|
10
10
|
const SpeakAgentsRequest_js_1 = require("../api/resources/agents/client/requests/SpeakAgentsRequest.js");
|
|
11
11
|
const StartAgentsRequest_js_1 = require("../api/resources/agents/client/requests/StartAgentsRequest.js");
|
|
12
|
+
const MllmTurnDetection_js_1 = require("../api/types/MllmTurnDetection.js");
|
|
12
13
|
/** Data channel: `"rtm"` | `"datastream"` */
|
|
13
14
|
exports.DataChannel = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Parameters.DataChannel;
|
|
14
15
|
/** RTC audio scenario: `"default"` | `"chorus"` | `"aiserver"` */
|
|
@@ -49,13 +50,13 @@ exports.SpeakPriorityAppend = SpeakAgentsRequest_js_1.SpeakAgentsRequest.Priorit
|
|
|
49
50
|
/** Drop the message if the agent is busy. */
|
|
50
51
|
exports.SpeakPriorityIgnore = SpeakAgentsRequest_js_1.SpeakAgentsRequest.Priority.Ignore;
|
|
51
52
|
/** MLLM turn-detection mode: `"agora_vad"` | `"server_vad"` | `"semantic_vad"` */
|
|
52
|
-
exports.MllmTurnDetectionModeValues =
|
|
53
|
+
exports.MllmTurnDetectionModeValues = MllmTurnDetection_js_1.MllmTurnDetection.Mode;
|
|
53
54
|
/** MLLM turn-detection mode: Agora VAD. */
|
|
54
|
-
exports.MllmTurnDetectionModeAgoraVad =
|
|
55
|
+
exports.MllmTurnDetectionModeAgoraVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.AgoraVad;
|
|
55
56
|
/** MLLM turn-detection mode: server/vendor VAD. */
|
|
56
|
-
exports.MllmTurnDetectionModeServerVad =
|
|
57
|
+
exports.MllmTurnDetectionModeServerVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.ServerVad;
|
|
57
58
|
/** MLLM turn-detection mode: semantic VAD. */
|
|
58
|
-
exports.MllmTurnDetectionModeSemanticVad =
|
|
59
|
+
exports.MllmTurnDetectionModeSemanticVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.SemanticVad;
|
|
59
60
|
/** Think action when the agent is listening: inject custom text without interrupting. */
|
|
60
61
|
exports.ThinkOnListeningActionInject = AgentThinkAgentManagementRequest_js_1.AgentThinkAgentManagementRequest.OnListeningAction.Inject;
|
|
61
62
|
/** Think action when the agent is listening: interrupt and start a new turn. */
|
|
@@ -30,7 +30,7 @@ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPre
|
|
|
30
30
|
export { AgentPresets, normalizePresetInput } from "./presets.js";
|
|
31
31
|
export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
|
|
32
32
|
export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.js";
|
|
33
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig, AvatarVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, SttVendor, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
|
|
33
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig, AvatarVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, SttVendor, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
|
|
34
34
|
export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.js";
|
|
35
35
|
export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.js";
|
|
36
36
|
export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.js";
|
|
@@ -29,6 +29,35 @@ export type DeepgramPresetModel = (typeof DeepgramPresetModels)[number];
|
|
|
29
29
|
export type OpenAIPresetModel = (typeof OpenAIPresetModels)[number];
|
|
30
30
|
export type OpenAITtsPresetModel = (typeof OpenAITtsPresetModels)[number];
|
|
31
31
|
export type MiniMaxPresetModel = (typeof MiniMaxPresetModels)[number];
|
|
32
|
+
export type PresetCategory = "asr" | "llm" | "tts";
|
|
33
|
+
type AsrInference = {
|
|
34
|
+
category: "asr";
|
|
35
|
+
preset: AsrPreset;
|
|
36
|
+
stripModel: boolean;
|
|
37
|
+
};
|
|
38
|
+
type LlmInference = {
|
|
39
|
+
category: "llm";
|
|
40
|
+
preset: LlmPreset;
|
|
41
|
+
stripModel: boolean;
|
|
42
|
+
stripDefaultUrl: boolean;
|
|
43
|
+
};
|
|
44
|
+
type OpenAITtsInference = {
|
|
45
|
+
category: "tts";
|
|
46
|
+
preset: typeof AgentPresets.tts.openaiTts1;
|
|
47
|
+
vendor: "openai";
|
|
48
|
+
stripModel: boolean;
|
|
49
|
+
};
|
|
50
|
+
type MiniMaxTtsInference = {
|
|
51
|
+
category: "tts";
|
|
52
|
+
preset: TtsPreset;
|
|
53
|
+
vendor: "minimax";
|
|
54
|
+
stripModel: boolean;
|
|
55
|
+
};
|
|
56
|
+
type TtsInference = OpenAITtsInference | MiniMaxTtsInference;
|
|
57
|
+
export declare function getPresetCategory(preset: string): PresetCategory | undefined;
|
|
58
|
+
export declare function inferAsrPreset(asr?: Agora.Asr): AsrInference | undefined;
|
|
59
|
+
export declare function inferLlmPreset(llm?: Agora.Llm): LlmInference | undefined;
|
|
60
|
+
export declare function inferTtsPreset(tts?: Agora.Tts): TtsInference | undefined;
|
|
32
61
|
export declare function normalizePresetInput(preset?: PresetInput | readonly string[]): string | undefined;
|
|
33
62
|
export declare function resolveSessionPresets(args: {
|
|
34
63
|
preset?: PresetInput;
|
|
@@ -37,3 +66,4 @@ export declare function resolveSessionPresets(args: {
|
|
|
37
66
|
preset?: string;
|
|
38
67
|
properties: Agora.StartAgentsRequest.Properties;
|
|
39
68
|
};
|
|
69
|
+
export {};
|
|
@@ -12,6 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.MiniMaxPresetModels = exports.OpenAITtsPresetModels = exports.OpenAIPresetModels = exports.DeepgramPresetModels = exports.AgentPresets = void 0;
|
|
15
|
+
exports.getPresetCategory = getPresetCategory;
|
|
16
|
+
exports.inferAsrPreset = inferAsrPreset;
|
|
17
|
+
exports.inferLlmPreset = inferLlmPreset;
|
|
18
|
+
exports.inferTtsPreset = inferTtsPreset;
|
|
15
19
|
exports.normalizePresetInput = normalizePresetInput;
|
|
16
20
|
exports.resolveSessionPresets = resolveSessionPresets;
|
|
17
21
|
exports.AgentPresets = {
|
|
@@ -58,7 +62,10 @@ const minimaxModelToPreset = {
|
|
|
58
62
|
speech_2_8_turbo: exports.AgentPresets.tts.minimaxSpeech28Turbo,
|
|
59
63
|
};
|
|
60
64
|
function normalizeModelName(value) {
|
|
61
|
-
|
|
65
|
+
if (typeof value !== "string")
|
|
66
|
+
return undefined;
|
|
67
|
+
const normalized = value.trim().toLowerCase();
|
|
68
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
62
69
|
}
|
|
63
70
|
function getPresetCategory(preset) {
|
|
64
71
|
if (Object.values(exports.AgentPresets.asr).includes(preset))
|
|
@@ -171,7 +178,7 @@ function stripInferredPresetFields(properties, inferred) {
|
|
|
171
178
|
tts = Object.assign(Object.assign({}, tts), { params: omitUndefinedKeys(Object.assign(Object.assign({}, tts.params), { key: undefined, group_id: undefined, url: undefined, model: ttsInference.stripModel ? undefined : (_d = tts.params) === null || _d === void 0 ? void 0 : _d.model })) });
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
|
-
return Object.assign(Object.assign({}, properties), { asr, llm, tts });
|
|
181
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, properties), (asr && { asr })), (llm && { llm })), (tts && { tts }));
|
|
175
182
|
}
|
|
176
183
|
function normalizePresetInput(preset) {
|
|
177
184
|
const entries = parsePresetInput(preset);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Clean type aliases for the Agora Conversational AI SDK.
|
|
3
3
|
* These provide shorter, more intuitive names for the verbose Fern-generated types.
|
|
4
4
|
*/
|
|
5
|
-
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest } from "../api/index.js";
|
|
5
|
+
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, Llm, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest } from "../api/index.js";
|
|
6
6
|
import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js";
|
|
7
7
|
import type { PresetInput } from "./presets.js";
|
|
8
8
|
/** LLM request style (openai, gemini, anthropic, dify) */
|
|
9
|
-
export type LlmStyle =
|
|
9
|
+
export type LlmStyle = Llm.Style;
|
|
10
10
|
/**
|
|
11
11
|
* STT/ASR (Speech-to-Text) configuration with vendor-specific typed parameters.
|
|
12
12
|
* This discriminated union provides type safety and auto-complete for vendor params.
|
|
@@ -14,55 +14,57 @@ export type LlmStyle = StartAgentsRequest.Properties.Llm.Style;
|
|
|
14
14
|
*/
|
|
15
15
|
export type SttConfig = {
|
|
16
16
|
vendor: "speechmatics";
|
|
17
|
-
language?:
|
|
17
|
+
language?: TurnDetectionLanguage;
|
|
18
18
|
params: SpeechmaticsParams;
|
|
19
19
|
} | {
|
|
20
20
|
vendor: "deepgram";
|
|
21
|
-
language?:
|
|
22
|
-
params
|
|
21
|
+
language?: TurnDetectionLanguage;
|
|
22
|
+
params: DeepgramParams;
|
|
23
23
|
} | {
|
|
24
24
|
vendor: "microsoft";
|
|
25
|
-
language?:
|
|
25
|
+
language?: TurnDetectionLanguage;
|
|
26
26
|
params: MicrosoftAsrParams;
|
|
27
27
|
} | {
|
|
28
28
|
vendor: "openai";
|
|
29
|
-
language?:
|
|
29
|
+
language?: TurnDetectionLanguage;
|
|
30
30
|
params: OpenAiAsrParams;
|
|
31
31
|
} | {
|
|
32
32
|
vendor: "google";
|
|
33
|
-
language?:
|
|
33
|
+
language?: TurnDetectionLanguage;
|
|
34
34
|
params: GoogleAsrParams;
|
|
35
35
|
} | {
|
|
36
36
|
vendor: "amazon";
|
|
37
|
-
language?:
|
|
37
|
+
language?: TurnDetectionLanguage;
|
|
38
38
|
params: AmazonAsrParams;
|
|
39
39
|
} | {
|
|
40
40
|
vendor: "assemblyai";
|
|
41
|
-
language?:
|
|
42
|
-
params
|
|
41
|
+
language?: TurnDetectionLanguage;
|
|
42
|
+
params: AssemblyAiParams;
|
|
43
43
|
} | {
|
|
44
44
|
vendor: "ares";
|
|
45
|
-
language?:
|
|
45
|
+
language?: TurnDetectionLanguage;
|
|
46
46
|
params?: AresParams;
|
|
47
47
|
} | {
|
|
48
48
|
vendor: "sarvam";
|
|
49
|
-
language?:
|
|
50
|
-
params
|
|
51
|
-
} |
|
|
49
|
+
language?: TurnDetectionLanguage;
|
|
50
|
+
params: SarvamAsrParams;
|
|
51
|
+
} | Asr;
|
|
52
52
|
/** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
|
|
53
53
|
export type AsrConfig = SttConfig;
|
|
54
54
|
/** STT vendor (ares, microsoft, deepgram, openai, etc.) */
|
|
55
|
-
export type SttVendor =
|
|
55
|
+
export type SttVendor = string;
|
|
56
56
|
/** TTS (Text-to-Speech) configuration - discriminated union */
|
|
57
57
|
export type TtsConfig = Tts;
|
|
58
58
|
/** MLLM (Multimodal LLM) configuration */
|
|
59
|
-
export type MllmConfig =
|
|
59
|
+
export type MllmConfig = Mllm;
|
|
60
60
|
/** MLLM vendor (openai, gemini, vertexai, xai) */
|
|
61
|
-
export type MllmVendor =
|
|
61
|
+
export type MllmVendor = Mllm.Vendor;
|
|
62
62
|
/** Avatar configuration */
|
|
63
63
|
export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
|
|
64
64
|
/** Avatar vendor (akool, liveavatar, anam, generic, deprecated heygen) */
|
|
65
65
|
export type AvatarVendor = StartAgentsRequest.Properties.Avatar.Vendor;
|
|
66
|
+
/** BCP-47 language tag used by `turn_detection.language`. */
|
|
67
|
+
export type TurnDetectionLanguage = AsrLanguage;
|
|
66
68
|
/** Turn detection configuration */
|
|
67
69
|
export type TurnDetectionConfig = StartAgentsRequest.Properties.TurnDetection;
|
|
68
70
|
/** Detailed nested config for turn detection (`turn_detection.config`) */
|
|
@@ -132,9 +134,9 @@ export type InterruptionConfig = StartAgentsRequest.Properties.Interruption;
|
|
|
132
134
|
/** Interruption trigger mode: `"start_of_speech"` | `"keywords"` */
|
|
133
135
|
export type InterruptionMode = StartAgentsRequest.Properties.Interruption.Mode;
|
|
134
136
|
/** MLLM turn-detection configuration (`mllm.turn_detection`) */
|
|
135
|
-
export type MllmTurnDetectionConfig =
|
|
137
|
+
export type MllmTurnDetectionConfig = MllmTurnDetection;
|
|
136
138
|
/** MLLM turn-detection mode (`agora_vad` | `server_vad` | `semantic_vad`) */
|
|
137
|
-
export type MllmTurnDetectionMode =
|
|
139
|
+
export type MllmTurnDetectionMode = MllmTurnDetectionNS.Mode;
|
|
138
140
|
/** Options for `AgentSession.think()` */
|
|
139
141
|
export type ThinkOnListeningAction = AgentThinkAgentManagementRequest.OnListeningAction;
|
|
140
142
|
export type ThinkOnThinkingAction = AgentThinkAgentManagementRequest.OnThinkingAction;
|
|
@@ -178,11 +180,11 @@ export type FillerWordsContentSelectionRule = StartAgentsRequest.Properties.Fill
|
|
|
178
180
|
/** Custom business labels attached to the agent (returned in notification callbacks) */
|
|
179
181
|
export type Labels = Record<string, string>;
|
|
180
182
|
/** LLM greeting broadcast configuration (`llm.greeting_configs`) */
|
|
181
|
-
export type LlmGreetingConfigs =
|
|
183
|
+
export type LlmGreetingConfigs = Record<string, unknown>;
|
|
182
184
|
/** Greeting broadcast mode: `"single_every"` | `"single_first"` */
|
|
183
|
-
export type LlmGreetingConfigsMode =
|
|
185
|
+
export type LlmGreetingConfigsMode = string;
|
|
184
186
|
/** MCP server config item (`llm.mcp_servers[]`) */
|
|
185
|
-
export type McpServersItem =
|
|
187
|
+
export type McpServersItem = Record<string, unknown>;
|
|
186
188
|
/** Full agent configuration (alias for StartAgentsRequest.Properties) */
|
|
187
189
|
export type AgentConfig = StartAgentsRequest.Properties;
|
|
188
190
|
/** Agent configuration update (for runtime updates) */
|
|
@@ -205,7 +207,7 @@ export interface SessionOptions {
|
|
|
205
207
|
enableStringUid?: boolean;
|
|
206
208
|
/** Preset IDs to use as the base ASR/LLM/TTS configuration for this session */
|
|
207
209
|
preset?: PresetInput;
|
|
208
|
-
/** Published AI Studio pipeline ID to use as
|
|
210
|
+
/** Published AI Studio pipeline ID to use as this session's base configuration. Overrides agent.pipelineId. */
|
|
209
211
|
pipelineId?: string;
|
|
210
212
|
/**
|
|
211
213
|
* Token lifetime in seconds (default: 86400 = 24 hours, Agora maximum).
|
|
@@ -371,7 +373,7 @@ export type LlmConfig = (BaseLlmConfig & {
|
|
|
371
373
|
}) | (BaseLlmConfig & {
|
|
372
374
|
style?: undefined;
|
|
373
375
|
params?: Record<string, unknown>;
|
|
374
|
-
}) |
|
|
376
|
+
}) | Llm;
|
|
375
377
|
/**
|
|
376
378
|
* Speechmatics STT parameters
|
|
377
379
|
* @see https://docs.agora.io/en/conversational-ai/models/asr/speechmatics
|
|
@@ -381,6 +383,8 @@ export interface SpeechmaticsParams {
|
|
|
381
383
|
api_key: string;
|
|
382
384
|
/** Language code for transcription (e.g., 'en', 'es', 'fr') (required) */
|
|
383
385
|
language: string;
|
|
386
|
+
/** Speechmatics streaming WebSocket URL */
|
|
387
|
+
uri?: string;
|
|
384
388
|
/** Additional Speechmatics-specific parameters passed directly to Speechmatics API */
|
|
385
389
|
[key: string]: unknown;
|
|
386
390
|
}
|
|
@@ -390,7 +394,7 @@ export interface SpeechmaticsParams {
|
|
|
390
394
|
*/
|
|
391
395
|
export interface DeepgramParams {
|
|
392
396
|
/** Deepgram API key */
|
|
393
|
-
|
|
397
|
+
key?: string;
|
|
394
398
|
/** Model to use (e.g., 'nova-2', 'enhanced', 'base') */
|
|
395
399
|
model?: string;
|
|
396
400
|
/** Language code (e.g., 'en-US', 'es', 'fr') */
|
|
@@ -423,8 +427,13 @@ export interface MicrosoftAsrParams {
|
|
|
423
427
|
export interface OpenAiAsrParams {
|
|
424
428
|
/** OpenAI API key (required) */
|
|
425
429
|
api_key: string;
|
|
426
|
-
/**
|
|
427
|
-
|
|
430
|
+
/** OpenAI transcription settings */
|
|
431
|
+
input_audio_transcription?: {
|
|
432
|
+
model?: string;
|
|
433
|
+
prompt?: string;
|
|
434
|
+
language?: string;
|
|
435
|
+
[key: string]: unknown;
|
|
436
|
+
};
|
|
428
437
|
/** Additional OpenAI-specific parameters */
|
|
429
438
|
[key: string]: unknown;
|
|
430
439
|
}
|
|
@@ -433,10 +442,16 @@ export interface OpenAiAsrParams {
|
|
|
433
442
|
* @see https://docs.agora.io/en/conversational-ai/models/asr/google
|
|
434
443
|
*/
|
|
435
444
|
export interface GoogleAsrParams {
|
|
436
|
-
/** Google Cloud
|
|
437
|
-
|
|
445
|
+
/** Google Cloud project ID where Speech-to-Text is enabled (required) */
|
|
446
|
+
project_id: string;
|
|
447
|
+
/** Google Cloud region for the recognizer (required) */
|
|
448
|
+
location: string;
|
|
449
|
+
/** Google service account credentials JSON string (required) */
|
|
450
|
+
adc_credentials_string: string;
|
|
438
451
|
/** Language code (e.g., 'en-US', 'es-ES') */
|
|
439
452
|
language?: string;
|
|
453
|
+
/** Recognition model to use */
|
|
454
|
+
model?: string;
|
|
440
455
|
/** Additional Google Speech-to-Text parameters */
|
|
441
456
|
[key: string]: unknown;
|
|
442
457
|
}
|
|
@@ -446,13 +461,13 @@ export interface GoogleAsrParams {
|
|
|
446
461
|
*/
|
|
447
462
|
export interface AmazonAsrParams {
|
|
448
463
|
/** AWS Access Key ID (required) */
|
|
449
|
-
|
|
464
|
+
access_key_id: string;
|
|
450
465
|
/** AWS Secret Access Key (required) */
|
|
451
|
-
|
|
466
|
+
secret_access_key: string;
|
|
452
467
|
/** AWS region (e.g., 'us-east-1') (required) */
|
|
453
468
|
region: string;
|
|
454
469
|
/** Language code */
|
|
455
|
-
|
|
470
|
+
language_code?: string;
|
|
456
471
|
/** Additional Amazon Transcribe parameters */
|
|
457
472
|
[key: string]: unknown;
|
|
458
473
|
}
|
|
@@ -465,6 +480,8 @@ export interface AssemblyAiParams {
|
|
|
465
480
|
api_key: string;
|
|
466
481
|
/** Language code */
|
|
467
482
|
language?: string;
|
|
483
|
+
/** AssemblyAI streaming WebSocket URL */
|
|
484
|
+
uri?: string;
|
|
468
485
|
/** Additional AssemblyAI-specific parameters */
|
|
469
486
|
[key: string]: unknown;
|
|
470
487
|
}
|
|
@@ -473,8 +490,6 @@ export interface AssemblyAiParams {
|
|
|
473
490
|
* @see https://docs.agora.io/en/conversational-ai/models/asr/ares
|
|
474
491
|
*/
|
|
475
492
|
export interface AresParams {
|
|
476
|
-
/** Language code for ARES ASR */
|
|
477
|
-
language?: string;
|
|
478
493
|
/** Additional ARES-specific parameters */
|
|
479
494
|
[key: string]: unknown;
|
|
480
495
|
}
|
|
@@ -63,6 +63,7 @@ export interface AkoolAvatarOptions {
|
|
|
63
63
|
* key: process.env.ELEVENLABS_API_KEY,
|
|
64
64
|
* modelId: 'eleven_flash_v2_5',
|
|
65
65
|
* voiceId: 'voice-id',
|
|
66
|
+
* baseUrl: 'wss://api.elevenlabs.io/v1',
|
|
66
67
|
* sampleRate: 16000, // Required for Akool
|
|
67
68
|
* });
|
|
68
69
|
*
|
|
@@ -100,9 +101,10 @@ export declare class AkoolAvatar extends BaseAvatar<AkoolSampleRate> {
|
|
|
100
101
|
* });
|
|
101
102
|
*
|
|
102
103
|
* const tts = new ElevenLabsTTS({
|
|
103
|
-
*
|
|
104
|
+
* key: process.env.ELEVENLABS_API_KEY,
|
|
104
105
|
* modelId: 'eleven_flash_v2_5',
|
|
105
106
|
* voiceId: 'voice-id',
|
|
107
|
+
* baseUrl: 'wss://api.elevenlabs.io/v1',
|
|
106
108
|
* sampleRate: 24000, // Required for LiveAvatar
|
|
107
109
|
* });
|
|
108
110
|
*
|
|
@@ -28,6 +28,7 @@ const base_js_1 = require("./base.js");
|
|
|
28
28
|
* key: process.env.ELEVENLABS_API_KEY,
|
|
29
29
|
* modelId: 'eleven_flash_v2_5',
|
|
30
30
|
* voiceId: 'voice-id',
|
|
31
|
+
* baseUrl: 'wss://api.elevenlabs.io/v1',
|
|
31
32
|
* sampleRate: 16000, // Required for Akool
|
|
32
33
|
* });
|
|
33
34
|
*
|
|
@@ -83,9 +84,10 @@ exports.AkoolAvatar = AkoolAvatar;
|
|
|
83
84
|
* });
|
|
84
85
|
*
|
|
85
86
|
* const tts = new ElevenLabsTTS({
|
|
86
|
-
*
|
|
87
|
+
* key: process.env.ELEVENLABS_API_KEY,
|
|
87
88
|
* modelId: 'eleven_flash_v2_5',
|
|
88
89
|
* voiceId: 'voice-id',
|
|
90
|
+
* baseUrl: 'wss://api.elevenlabs.io/v1',
|
|
89
91
|
* sampleRate: 24000, // Required for LiveAvatar
|
|
90
92
|
* });
|
|
91
93
|
*
|