agora-agents 2.4.0 → 2.6.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.
Files changed (109) hide show
  1. package/dist/cjs/AgoraPoolClient.js +39 -1
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/agentkit/Agent.d.ts +4 -4
  4. package/dist/cjs/agentkit/Agent.js +2 -1
  5. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +30 -0
  6. package/dist/cjs/agentkit/constants.d.ts +6 -0
  7. package/dist/cjs/agentkit/constants.js +6 -1
  8. package/dist/cjs/agentkit/index.d.ts +9 -9
  9. package/dist/cjs/agentkit/index.js +10 -3
  10. package/dist/cjs/agentkit/region-vendors.d.ts +5 -2
  11. package/dist/cjs/agentkit/types.d.ts +9 -3
  12. package/dist/cjs/agentkit/vendors/base.d.ts +11 -1
  13. package/dist/cjs/agentkit/vendors/base.js +18 -2
  14. package/dist/cjs/agentkit/vendors/cn.d.ts +8 -0
  15. package/dist/cjs/agentkit/vendors/cn.js +9 -3
  16. package/dist/cjs/agentkit/vendors/mllm.d.ts +100 -2
  17. package/dist/cjs/agentkit/vendors/mllm.js +69 -2
  18. package/dist/cjs/agentkit/vendors/stt.d.ts +3 -1
  19. package/dist/cjs/agentkit/vendors/stt.js +7 -4
  20. package/dist/cjs/agentkit/vendors/tts.d.ts +100 -9
  21. package/dist/cjs/agentkit/vendors/tts.js +85 -12
  22. package/dist/cjs/api/types/AresAsrParams.d.ts +6 -1
  23. package/dist/cjs/api/types/AssemblyAiAsrParams.d.ts +1 -1
  24. package/dist/cjs/api/types/FengmingAsr.d.ts +1 -2
  25. package/dist/cjs/api/types/FengmingAsrParams.d.ts +9 -0
  26. package/dist/cjs/api/types/{GenericTts.d.ts → GenericHttpTts.d.ts} +3 -3
  27. package/dist/cjs/api/types/{GenericTtsParams.d.ts → GenericHttpTtsParams.d.ts} +3 -3
  28. package/dist/cjs/api/types/GenericHttpTtsParams.js +3 -0
  29. package/dist/cjs/api/types/GradiumTts.d.ts +9 -0
  30. package/dist/cjs/api/types/GradiumTts.js +3 -0
  31. package/dist/cjs/api/types/GradiumTtsParams.d.ts +17 -0
  32. package/dist/cjs/api/types/GradiumTtsParams.js +3 -0
  33. package/dist/cjs/api/types/MistralTts.d.ts +9 -0
  34. package/dist/cjs/api/types/MistralTts.js +3 -0
  35. package/dist/cjs/api/types/MistralTtsParams.d.ts +13 -0
  36. package/dist/cjs/api/types/MistralTtsParams.js +3 -0
  37. package/dist/cjs/api/types/Mllm.d.ts +4 -0
  38. package/dist/cjs/api/types/Mllm.js +2 -0
  39. package/dist/cjs/api/types/RimeTts.d.ts +10 -0
  40. package/dist/cjs/api/types/RimeTts.js +9 -0
  41. package/dist/cjs/api/types/RimeTtsParams.d.ts +2 -2
  42. package/dist/cjs/api/types/Tts.d.ts +12 -3
  43. package/dist/cjs/api/types/TypecastTts.d.ts +9 -0
  44. package/dist/cjs/api/types/TypecastTts.js +3 -0
  45. package/dist/cjs/api/types/TypecastTtsParams.d.ts +13 -0
  46. package/dist/cjs/api/types/TypecastTtsParams.js +3 -0
  47. package/dist/cjs/api/types/index.d.ts +9 -2
  48. package/dist/cjs/api/types/index.js +9 -2
  49. package/dist/cjs/index.d.ts +2 -2
  50. package/dist/cjs/index.js +10 -3
  51. package/dist/cjs/version.d.ts +1 -1
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/esm/AgoraPoolClient.mjs +40 -2
  54. package/dist/esm/BaseClient.mjs +2 -2
  55. package/dist/esm/agentkit/Agent.d.mts +4 -4
  56. package/dist/esm/agentkit/Agent.mjs +2 -1
  57. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +31 -1
  58. package/dist/esm/agentkit/constants.d.mts +6 -0
  59. package/dist/esm/agentkit/constants.mjs +5 -0
  60. package/dist/esm/agentkit/index.d.mts +9 -9
  61. package/dist/esm/agentkit/index.mjs +4 -4
  62. package/dist/esm/agentkit/region-vendors.d.mts +5 -2
  63. package/dist/esm/agentkit/types.d.mts +9 -3
  64. package/dist/esm/agentkit/vendors/base.d.mts +11 -1
  65. package/dist/esm/agentkit/vendors/base.mjs +16 -1
  66. package/dist/esm/agentkit/vendors/cn.d.mts +8 -0
  67. package/dist/esm/agentkit/vendors/cn.mjs +9 -3
  68. package/dist/esm/agentkit/vendors/mllm.d.mts +100 -2
  69. package/dist/esm/agentkit/vendors/mllm.mjs +67 -2
  70. package/dist/esm/agentkit/vendors/stt.d.mts +3 -1
  71. package/dist/esm/agentkit/vendors/stt.mjs +7 -4
  72. package/dist/esm/agentkit/vendors/tts.d.mts +100 -9
  73. package/dist/esm/agentkit/vendors/tts.mjs +81 -11
  74. package/dist/esm/api/types/AresAsrParams.d.mts +6 -1
  75. package/dist/esm/api/types/AssemblyAiAsrParams.d.mts +1 -1
  76. package/dist/esm/api/types/FengmingAsr.d.mts +1 -2
  77. package/dist/esm/api/types/FengmingAsrParams.d.mts +9 -0
  78. package/dist/esm/api/types/{GenericTts.d.mts → GenericHttpTts.d.mts} +3 -3
  79. package/dist/esm/api/types/{GenericTtsParams.d.mts → GenericHttpTtsParams.d.mts} +3 -3
  80. package/dist/esm/api/types/GenericHttpTtsParams.mjs +2 -0
  81. package/dist/esm/api/types/GradiumTts.d.mts +9 -0
  82. package/dist/esm/api/types/GradiumTts.mjs +2 -0
  83. package/dist/esm/api/types/GradiumTtsParams.d.mts +17 -0
  84. package/dist/esm/api/types/GradiumTtsParams.mjs +2 -0
  85. package/dist/esm/api/types/MistralTts.d.mts +9 -0
  86. package/dist/esm/api/types/MistralTts.mjs +2 -0
  87. package/dist/esm/api/types/MistralTtsParams.d.mts +13 -0
  88. package/dist/esm/api/types/MistralTtsParams.mjs +2 -0
  89. package/dist/esm/api/types/Mllm.d.mts +4 -0
  90. package/dist/esm/api/types/Mllm.mjs +2 -0
  91. package/dist/esm/api/types/RimeTts.d.mts +10 -0
  92. package/dist/esm/api/types/RimeTts.mjs +8 -1
  93. package/dist/esm/api/types/RimeTtsParams.d.mts +2 -2
  94. package/dist/esm/api/types/Tts.d.mts +12 -3
  95. package/dist/esm/api/types/TypecastTts.d.mts +9 -0
  96. package/dist/esm/api/types/TypecastTts.mjs +2 -0
  97. package/dist/esm/api/types/TypecastTtsParams.d.mts +13 -0
  98. package/dist/esm/api/types/TypecastTtsParams.mjs +2 -0
  99. package/dist/esm/api/types/index.d.mts +9 -2
  100. package/dist/esm/api/types/index.mjs +9 -2
  101. package/dist/esm/index.d.mts +2 -2
  102. package/dist/esm/index.mjs +6 -6
  103. package/dist/esm/version.d.mts +1 -1
  104. package/dist/esm/version.mjs +1 -1
  105. package/package.json +1 -1
  106. /package/dist/cjs/api/types/{GenericTts.js → FengmingAsrParams.js} +0 -0
  107. /package/dist/cjs/api/types/{GenericTtsParams.js → GenericHttpTts.js} +0 -0
  108. /package/dist/esm/api/types/{GenericTts.mjs → FengmingAsrParams.mjs} +0 -0
  109. /package/dist/esm/api/types/{GenericTtsParams.mjs → GenericHttpTts.mjs} +0 -0
@@ -7,8 +7,18 @@
7
7
  * sets `mllm.enable: true`.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.XaiGrok = exports.VertexAI = exports.GeminiLive = exports.OpenAIRealtime = void 0;
10
+ exports.QwenOmni = exports.XaiGrok = exports.VertexAI = exports.GeminiLive = exports.AzureOpenAIRealtime = exports.OpenAIRealtime = void 0;
11
11
  const base_js_1 = require("./base.js");
12
+ function requireString(value, field, vendor) {
13
+ if (typeof value !== "string" || value.length === 0) {
14
+ throw new Error(`${vendor} requires ${field}`);
15
+ }
16
+ }
17
+ function requireObject(value, field, vendor) {
18
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
19
+ throw new Error(`${vendor} requires ${field}`);
20
+ }
21
+ }
12
22
  /**
13
23
  * OpenAI Realtime API MLLM vendor.
14
24
  *
@@ -39,10 +49,40 @@ class OpenAIRealtime extends base_js_1.BaseMLLM {
39
49
  voice !== undefined ||
40
50
  instructions !== undefined ||
41
51
  inputAudioTranscription !== undefined;
42
- 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 }));
52
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "openai", api_key: apiKey, url: url || "wss://api.openai.com/v1/realtime" }, (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 }));
43
53
  }
44
54
  }
45
55
  exports.OpenAIRealtime = OpenAIRealtime;
56
+ /**
57
+ * Azure OpenAI Realtime MLLM vendor for global deployments.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const agent = new Agent({ client }).withMllm(new AzureOpenAIRealtime({
62
+ * apiKey: process.env.AZURE_OPENAI_API_KEY,
63
+ * url: 'wss://example.openai.azure.com/openai/realtime',
64
+ * model: 'gpt-4o-realtime-preview',
65
+ * maxHistory: 32,
66
+ * turnDetection: { mode: 'server_vad' },
67
+ * }));
68
+ * ```
69
+ */
70
+ class AzureOpenAIRealtime extends base_js_1.BaseMLLM {
71
+ constructor(options) {
72
+ super();
73
+ requireString(options.apiKey, "apiKey", "AzureOpenAIRealtime");
74
+ requireString(options.url, "url", "AzureOpenAIRealtime");
75
+ requireObject(options.turnDetection, "turnDetection", "AzureOpenAIRealtime");
76
+ this.options = options;
77
+ }
78
+ toConfig() {
79
+ const { apiKey, url, model, voice, instructions, maxHistory, greetingMessage, outputModalities, messages, params, turnDetection, } = this.options;
80
+ const mergedParams = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((params === null || params === void 0 ? void 0 : params.model) !== undefined && { model: params.model })), ((params === null || params === void 0 ? void 0 : params.voice) !== undefined && { voice: params.voice })), ((params === null || params === void 0 ? void 0 : params.instructions) !== undefined && { instructions: params.instructions })), (model !== undefined && { model })), (voice !== undefined && { voice })), (instructions !== undefined && { instructions }));
81
+ const hasParams = Object.keys(mergedParams).length > 0;
82
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "azure", api_key: apiKey, url }, (hasParams && { params: mergedParams })), (maxHistory !== undefined && { max_history: maxHistory })), (greetingMessage && { greeting_message: greetingMessage })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), { turn_detection: turnDetection });
83
+ }
84
+ }
85
+ exports.AzureOpenAIRealtime = AzureOpenAIRealtime;
46
86
  /**
47
87
  * Google Gemini Live MLLM vendor (direct API, non-Vertex AI).
48
88
  *
@@ -132,3 +172,30 @@ class XaiGrok extends base_js_1.BaseMLLM {
132
172
  }
133
173
  }
134
174
  exports.XaiGrok = XaiGrok;
175
+ /**
176
+ * Alibaba Cloud Qwen Omni Realtime MLLM vendor for Chinese mainland deployments.
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const agent = new Agent({ client }).withMllm(new QwenOmni({
181
+ * apiKey: process.env.DASHSCOPE_API_KEY,
182
+ * model: 'qwen3.5-omni-plus-realtime',
183
+ * url: 'wss://dashscope.aliyuncs.com/api-ws/v1/realtime',
184
+ * greetingMessage: '你好,有什么可以帮你?',
185
+ * }));
186
+ * ```
187
+ */
188
+ class QwenOmni extends base_js_1.BaseCNMLLM {
189
+ constructor(options) {
190
+ super();
191
+ requireString(options.apiKey, "apiKey", "QwenOmni");
192
+ requireString(options.model, "model", "QwenOmni");
193
+ requireString(options.url, "url", "QwenOmni");
194
+ this.options = options;
195
+ }
196
+ toConfig() {
197
+ const { apiKey, model, url, voice, instructions, greetingMessage, failureMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
198
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "qwen_omni", api_key: apiKey, url, params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { model }), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })) }, (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (turnDetection && { turn_detection: turnDetection }));
199
+ }
200
+ }
201
+ exports.QwenOmni = QwenOmni;
@@ -216,7 +216,7 @@ export interface AssemblyAISTTOptions {
216
216
  /** Language code */
217
217
  language: string;
218
218
  /** AssemblyAI streaming WebSocket URL */
219
- uri?: string;
219
+ ws_url?: string;
220
220
  /** Additional vendor-specific parameters */
221
221
  additionalParams?: Record<string, unknown>;
222
222
  }
@@ -240,6 +240,8 @@ export declare class AssemblyAISTT extends BaseSTT {
240
240
  * Constructor options for Agora ARES STT.
241
241
  */
242
242
  export interface AresSTTOptions {
243
+ /** Hotwords that improve recognition accuracy */
244
+ keywords?: string[];
243
245
  /** Additional vendor-specific parameters */
244
246
  additionalParams?: Record<string, unknown>;
245
247
  }
@@ -197,10 +197,10 @@ class AssemblyAISTT extends base_js_1.BaseSTT {
197
197
  this.options = options;
198
198
  }
199
199
  toConfig() {
200
- const { apiKey, language, uri, additionalParams } = this.options;
200
+ const { apiKey, language, ws_url, additionalParams } = this.options;
201
201
  return {
202
202
  vendor: "assemblyai",
203
- params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })), (uri && { uri })),
203
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })), (ws_url && { ws_url })),
204
204
  };
205
205
  }
206
206
  }
@@ -219,8 +219,11 @@ class AresSTT extends base_js_1.BaseSTT {
219
219
  this.options = options;
220
220
  }
221
221
  toConfig() {
222
- const { additionalParams } = this.options;
223
- return Object.assign({ vendor: "ares" }, (additionalParams && Object.keys(additionalParams).length > 0 && { params: additionalParams }));
222
+ const { keywords, additionalParams } = this.options;
223
+ const hasParams = keywords !== undefined || (additionalParams !== undefined && Object.keys(additionalParams).length > 0);
224
+ return Object.assign({ vendor: "ares" }, (hasParams && {
225
+ params: Object.assign(Object.assign({}, additionalParams), (keywords !== undefined && { keywords })),
226
+ }));
224
227
  }
225
228
  }
226
229
  exports.AresSTT = AresSTT;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Type-safe TTS (Text-to-Speech) vendor classes.
3
3
  */
4
+ import { CredentialMode } from "../constants.js";
4
5
  import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.js";
5
6
  import type { TtsConfig } from "../types.js";
6
7
  import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.js";
@@ -279,6 +280,67 @@ export declare class DeepgramTTS extends BaseTTS {
279
280
  constructor(options: DeepgramTTSOptions);
280
281
  toConfig(): TtsConfig;
281
282
  }
283
+ /** Constructor options for Gradium TTS. */
284
+ export interface GradiumTTSOptions {
285
+ /** Gradium API key */
286
+ apiKey: string;
287
+ /** WebSocket endpoint for streaming TTS output */
288
+ url?: string;
289
+ /** Gradium TTS model name (e.g., 'default') */
290
+ modelName?: string;
291
+ /** Gradium voice identifier */
292
+ voiceId?: string;
293
+ /** Audio sample rate in Hz */
294
+ sampleRate?: number;
295
+ /** Additional vendor-specific parameters */
296
+ additionalParams?: Record<string, unknown>;
297
+ /** Skip patterns for bracketed content */
298
+ skipPatterns?: number[];
299
+ }
300
+ /** Gradium TTS vendor. */
301
+ export declare class GradiumTTS extends BaseTTS {
302
+ private readonly options;
303
+ constructor(options: GradiumTTSOptions);
304
+ toConfig(): TtsConfig;
305
+ }
306
+ /** Constructor options for Mistral TTS. */
307
+ export interface MistralTTSOptions {
308
+ /** Mistral API key */
309
+ apiKey: string;
310
+ /** Mistral TTS model name (e.g., 'voxtral-mini-tts-2603') */
311
+ model?: string;
312
+ /** Mistral voice identifier */
313
+ voice?: string;
314
+ /** Additional vendor-specific parameters */
315
+ additionalParams?: Record<string, unknown>;
316
+ /** Skip patterns for bracketed content */
317
+ skipPatterns?: number[];
318
+ }
319
+ /** Mistral TTS vendor. */
320
+ export declare class MistralTTS extends BaseTTS {
321
+ private readonly options;
322
+ constructor(options: MistralTTSOptions);
323
+ toConfig(): TtsConfig;
324
+ }
325
+ /** Constructor options for Typecast TTS. */
326
+ export interface TypecastTTSOptions {
327
+ /** Typecast API key */
328
+ apiKey: string;
329
+ /** Typecast voice identifier */
330
+ voiceId: string;
331
+ /** Typecast TTS model name (e.g., 'ssfm-v30') */
332
+ model: string;
333
+ /** Additional vendor-specific parameters */
334
+ additionalParams?: Record<string, unknown>;
335
+ /** Skip patterns for bracketed content */
336
+ skipPatterns?: number[];
337
+ }
338
+ /** Typecast TTS vendor. */
339
+ export declare class TypecastTTS extends BaseTTS {
340
+ private readonly options;
341
+ constructor(options: TypecastTTSOptions);
342
+ toConfig(): TtsConfig;
343
+ }
282
344
  /**
283
345
  * Constructor options for Hume AI TTS.
284
346
  */
@@ -319,8 +381,28 @@ export declare class HumeAITTS extends BaseTTS {
319
381
  }
320
382
  /**
321
383
  * Constructor options for Rime TTS.
384
+ *
385
+ * - `credentialMode: CredentialMode.Managed` requires `baseUrl` and `modelId`
386
+ * - omitted / `CredentialMode.Byok` requires `key`, `speaker`, and `modelId`
322
387
  */
323
- export interface RimeTTSOptions {
388
+ type RimeTTSCommonOptions = {
389
+ /** Skip patterns for bracketed content */
390
+ skipPatterns?: number[];
391
+ };
392
+ export type RimeTTSOptions = (RimeTTSCommonOptions & {
393
+ /** Use Agora-managed Rime credentials */
394
+ credentialMode: typeof CredentialMode.Managed;
395
+ /** Model ID */
396
+ modelId: string;
397
+ /** WebSocket URL for the Rime streaming API */
398
+ baseUrl: string;
399
+ /** Rime API key (optional for managed credentials) */
400
+ key?: string;
401
+ /** Speaker ID (optional for managed credentials) */
402
+ speaker?: string;
403
+ }) | (RimeTTSCommonOptions & {
404
+ /** Bring-your-own Rime credentials (default when omitted) */
405
+ credentialMode?: typeof CredentialMode.Byok;
324
406
  /** Rime API key */
325
407
  key: string;
326
408
  /** Speaker ID */
@@ -329,15 +411,24 @@ export interface RimeTTSOptions {
329
411
  modelId: string;
330
412
  /** WebSocket URL for the Rime streaming API */
331
413
  baseUrl?: string;
332
- /** Skip patterns for bracketed content */
333
- skipPatterns?: number[];
334
- }
414
+ });
335
415
  /**
336
416
  * Rime TTS vendor.
337
417
  *
338
418
  * @example
419
+ * Agora-managed credentials:
420
+ * ```typescript
421
+ * const managedTts = new RimeTTS({
422
+ * credentialMode: CredentialMode.Managed,
423
+ * baseUrl: 'wss://users.rime.ai/ws',
424
+ * modelId: 'mist',
425
+ * });
426
+ * ```
427
+ *
428
+ * @example
429
+ * Bring your own credentials (the default mode):
339
430
  * ```typescript
340
- * const tts = new RimeTTS({
431
+ * const byokTts = new RimeTTS({
341
432
  * key: process.env.RIME_API_KEY,
342
433
  * speaker: 'speaker-id',
343
434
  * modelId: 'mist',
@@ -505,16 +596,16 @@ export declare class MurfTTS extends BaseTTS {
505
596
  * Constructor options for Generic OpenAI-compatible TTS.
506
597
  */
507
598
  export interface GenericTTSOptions {
508
- /** Callback address of the generic TTS service */
599
+ /** HTTP(S) endpoint of the generic TTS service */
509
600
  url: string;
510
601
  /** Custom headers to include in requests to the generic TTS service */
511
- headers: Record<string, string>;
602
+ headers?: Record<string, string>;
512
603
  /** API key for the generic TTS service */
513
604
  apiKey?: string;
514
605
  /** TTS model name */
515
- model: string;
606
+ model?: string;
516
607
  /** Voice name */
517
- voice: string;
608
+ voice?: string;
518
609
  /** Speech rate */
519
610
  speed?: number;
520
611
  /** Output audio sample rate in Hz */
@@ -3,7 +3,8 @@
3
3
  * Type-safe TTS (Text-to-Speech) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
6
+ exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.TypecastTTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
7
+ const constants_js_1 = require("../constants.js");
7
8
  const presets_js_1 = require("../presets.js");
8
9
  const base_js_1 = require("./base.js");
9
10
  function requireString(value, field, vendor) {
@@ -196,6 +197,47 @@ class DeepgramTTS extends base_js_1.BaseTTS {
196
197
  }
197
198
  }
198
199
  exports.DeepgramTTS = DeepgramTTS;
200
+ /** Gradium TTS vendor. */
201
+ class GradiumTTS extends base_js_1.BaseTTS {
202
+ constructor(options) {
203
+ super();
204
+ requireString(options.apiKey, "apiKey", "GradiumTTS");
205
+ this.options = options;
206
+ }
207
+ toConfig() {
208
+ const { apiKey, url, modelName, voiceId, sampleRate, additionalParams, skipPatterns } = this.options;
209
+ return Object.assign({ vendor: "gradium", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (url !== undefined && { url })), (modelName !== undefined && { model_name: modelName })), (voiceId !== undefined && { voice_id: voiceId })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
210
+ }
211
+ }
212
+ exports.GradiumTTS = GradiumTTS;
213
+ /** Mistral TTS vendor. */
214
+ class MistralTTS extends base_js_1.BaseTTS {
215
+ constructor(options) {
216
+ super();
217
+ requireString(options.apiKey, "apiKey", "MistralTTS");
218
+ this.options = options;
219
+ }
220
+ toConfig() {
221
+ const { apiKey, model, voice, additionalParams, skipPatterns } = this.options;
222
+ return Object.assign({ vendor: "mistral", params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (model !== undefined && { model })), (voice !== undefined && { voice })) }, (skipPatterns && { skip_patterns: skipPatterns }));
223
+ }
224
+ }
225
+ exports.MistralTTS = MistralTTS;
226
+ /** Typecast TTS vendor. */
227
+ class TypecastTTS extends base_js_1.BaseTTS {
228
+ constructor(options) {
229
+ super();
230
+ requireString(options.apiKey, "apiKey", "TypecastTTS");
231
+ requireString(options.voiceId, "voiceId", "TypecastTTS");
232
+ requireString(options.model, "model", "TypecastTTS");
233
+ this.options = options;
234
+ }
235
+ toConfig() {
236
+ const { apiKey, voiceId, model, additionalParams, skipPatterns } = this.options;
237
+ return Object.assign({ vendor: "typecast", params: Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, voice_id: voiceId, model }) }, (skipPatterns && { skip_patterns: skipPatterns }));
238
+ }
239
+ }
240
+ exports.TypecastTTS = TypecastTTS;
199
241
  /**
200
242
  * Hume AI TTS vendor.
201
243
  *
@@ -223,8 +265,19 @@ exports.HumeAITTS = HumeAITTS;
223
265
  * Rime TTS vendor.
224
266
  *
225
267
  * @example
268
+ * Agora-managed credentials:
269
+ * ```typescript
270
+ * const managedTts = new RimeTTS({
271
+ * credentialMode: CredentialMode.Managed,
272
+ * baseUrl: 'wss://users.rime.ai/ws',
273
+ * modelId: 'mist',
274
+ * });
275
+ * ```
276
+ *
277
+ * @example
278
+ * Bring your own credentials (the default mode):
226
279
  * ```typescript
227
- * const tts = new RimeTTS({
280
+ * const byokTts = new RimeTTS({
228
281
  * key: process.env.RIME_API_KEY,
229
282
  * speaker: 'speaker-id',
230
283
  * modelId: 'mist',
@@ -234,12 +287,23 @@ exports.HumeAITTS = HumeAITTS;
234
287
  class RimeTTS extends base_js_1.BaseTTS {
235
288
  constructor(options) {
236
289
  super();
290
+ requireString(options.modelId, "modelId", "RimeTTS");
291
+ if (options.credentialMode === constants_js_1.CredentialMode.Managed) {
292
+ requireString(options.baseUrl, "baseUrl", "RimeTTS");
293
+ }
294
+ else {
295
+ requireString(options.key, "key", "RimeTTS");
296
+ requireString(options.speaker, "speaker", "RimeTTS");
297
+ }
237
298
  this.options = options;
238
299
  }
239
300
  toConfig() {
240
- const { key, speaker, modelId, baseUrl, skipPatterns } = this.options;
241
- return Object.assign({ vendor: "rime", params: Object.assign({ api_key: key, speaker,
242
- modelId }, (baseUrl && { base_url: baseUrl })) }, (skipPatterns && { skip_patterns: skipPatterns }));
301
+ const { key, speaker, modelId, baseUrl, skipPatterns, credentialMode } = this.options;
302
+ if (credentialMode === constants_js_1.CredentialMode.Managed) {
303
+ return Object.assign({ vendor: "rime", credential_mode: constants_js_1.CredentialMode.Managed, params: Object.assign(Object.assign({ modelId, base_url: baseUrl }, (key !== undefined && { api_key: key })), (speaker !== undefined && { speaker })) }, (skipPatterns && { skip_patterns: skipPatterns }));
304
+ }
305
+ return Object.assign(Object.assign(Object.assign({ vendor: "rime" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign({ api_key: key, speaker,
306
+ modelId }, (baseUrl && { base_url: baseUrl })) }), (skipPatterns && { skip_patterns: skipPatterns }));
243
307
  }
244
308
  }
245
309
  exports.RimeTTS = RimeTTS;
@@ -349,23 +413,32 @@ class MurfTTS extends base_js_1.BaseTTS {
349
413
  }
350
414
  }
351
415
  exports.MurfTTS = MurfTTS;
416
+ function requireGenericTtsHttpUrl(url) {
417
+ requireString(url, "url", "GenericTTS");
418
+ let protocol;
419
+ try {
420
+ protocol = new URL(url).protocol;
421
+ }
422
+ catch (_a) {
423
+ throw new Error("GenericTTS requires url to be a valid absolute URL");
424
+ }
425
+ if (protocol === "http:" || protocol === "https:") {
426
+ return;
427
+ }
428
+ throw new Error(`GenericTTS does not support the ${protocol} protocol`);
429
+ }
352
430
  /**
353
431
  * Generic OpenAI-compatible TTS vendor.
354
432
  */
355
433
  class GenericTTS extends base_js_1.BaseTTS {
356
434
  constructor(options) {
357
435
  super();
358
- requireString(options.url, "url", "GenericTTS");
359
- requireRecord(options.headers, "headers", "GenericTTS");
360
- requireString(options.model, "model", "GenericTTS");
361
- requireString(options.voice, "voice", "GenericTTS");
436
+ requireGenericTtsHttpUrl(options.url);
362
437
  this.options = options;
363
438
  }
364
439
  toConfig() {
365
440
  const { url, headers, apiKey, model, voice, speed, sampleRate, responseFormat, instruction, additionalParams, skipPatterns, } = this.options;
366
- return Object.assign({ vendor: "generic", url,
367
- headers, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey !== undefined && { api_key: apiKey })), { model,
368
- voice }), (speed !== undefined && { speed })), (sampleRate !== undefined && { sample_rate: sampleRate })), (responseFormat !== undefined && { response_format: responseFormat })), (instruction !== undefined && { instruction })) }, (skipPatterns && { skip_patterns: skipPatterns }));
441
+ return Object.assign(Object.assign(Object.assign({ vendor: "generic_http", url }, (headers && { headers })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey !== undefined && { api_key: apiKey })), (model !== undefined && { model })), (voice !== undefined && { voice })), (speed !== undefined && { speed })), (sampleRate !== undefined && { sample_rate: sampleRate })), (responseFormat !== undefined && { response_format: responseFormat })), (instruction !== undefined && { instruction })) }), (skipPatterns && { skip_patterns: skipPatterns }));
369
442
  }
370
443
  }
371
444
  exports.GenericTTS = GenericTTS;
@@ -1,4 +1,9 @@
1
1
  /**
2
2
  * ARES ASR configuration parameters.
3
3
  */
4
- export type AresAsrParams = Record<string, unknown>;
4
+ export interface AresAsrParams {
5
+ /** A list of hotwords to improve ASR accuracy. */
6
+ keywords?: string[];
7
+ /** Accepts any additional properties */
8
+ [key: string]: any;
9
+ }
@@ -7,7 +7,7 @@ export interface AssemblyAiAsrParams {
7
7
  /** Language code for speech recognition */
8
8
  language: string;
9
9
  /** WebSocket URL for AssemblyAI's streaming API */
10
- uri?: string | null;
10
+ ws_url?: string | null;
11
11
  /** Accepts any additional properties */
12
12
  [key: string]: any;
13
13
  }
@@ -4,8 +4,7 @@ import type * as Agora from "../index.js";
4
4
  */
5
5
  export interface FengmingAsr {
6
6
  language?: Agora.AsrLanguage;
7
- /** Agora Fengming ASR configuration parameters. */
8
- params?: Record<string, unknown>;
7
+ params?: Agora.FengmingAsrParams;
9
8
  /** Accepts any additional properties */
10
9
  [key: string]: any;
11
10
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Agora Fengming ASR configuration parameters.
3
+ */
4
+ export interface FengmingAsrParams {
5
+ /** A list of hotwords to improve ASR accuracy. */
6
+ keywords?: string[];
7
+ /** Accepts any additional properties */
8
+ [key: string]: any;
9
+ }
@@ -2,12 +2,12 @@ import type * as Agora from "../index.js";
2
2
  /**
3
3
  * Generic OpenAI-compatible Text-to-Speech configuration.
4
4
  */
5
- export interface GenericTts {
5
+ export interface GenericHttpTts {
6
6
  /** Callback address of the generic TTS service. */
7
7
  url: string;
8
8
  /** Custom headers to include in requests to the generic TTS service. */
9
- headers: Record<string, string>;
10
- params: Agora.GenericTtsParams;
9
+ headers?: Record<string, string>;
10
+ params: Agora.GenericHttpTtsParams;
11
11
  /** Controls whether the TTS module skips bracketed content when reading LLM response text. */
12
12
  skip_patterns?: number[];
13
13
  }
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Generic TTS configuration parameters.
3
3
  */
4
- export interface GenericTtsParams {
4
+ export interface GenericHttpTtsParams {
5
5
  /** API key for the generic TTS service. */
6
6
  api_key?: string;
7
7
  /** TTS model name. */
8
- model: string;
8
+ model?: string;
9
9
  /** Voice name. */
10
- voice: string;
10
+ voice?: string;
11
11
  /** Speech rate. */
12
12
  speed?: number;
13
13
  /** Output audio sample rate in Hz. */
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import type * as Agora from "../index.js";
2
+ /**
3
+ * Gradium Text-to-Speech configuration.
4
+ */
5
+ export interface GradiumTts {
6
+ params: Agora.GradiumTtsParams;
7
+ /** Controls whether the TTS module skips bracketed content when reading LLM response text. */
8
+ skip_patterns?: number[];
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Gradium TTS configuration parameters.
3
+ */
4
+ export interface GradiumTtsParams {
5
+ /** Gradium API key. */
6
+ api_key: string;
7
+ /** WebSocket endpoint for streaming TTS output (for example, "wss://api.gradium.ai/api/speech/tts"). */
8
+ url?: string;
9
+ /** Gradium TTS model name (for example, "default"). */
10
+ model_name?: string;
11
+ /** Gradium voice identifier. */
12
+ voice_id?: string;
13
+ /** Audio sample rate in Hz (for example, 16000). */
14
+ sample_rate?: number;
15
+ /** Accepts any additional properties */
16
+ [key: string]: any;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import type * as Agora from "../index.js";
2
+ /**
3
+ * Mistral Text-to-Speech configuration.
4
+ */
5
+ export interface MistralTts {
6
+ params: Agora.MistralTtsParams;
7
+ /** Controls whether the TTS module skips bracketed content when reading LLM response text. */
8
+ skip_patterns?: number[];
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Mistral TTS configuration parameters.
3
+ */
4
+ export interface MistralTtsParams {
5
+ /** Mistral API key. */
6
+ api_key: string;
7
+ /** Mistral TTS model name (for example, "voxtral-mini-tts-2603"). */
8
+ model?: string;
9
+ /** Mistral voice identifier. */
10
+ voice?: string;
11
+ /** Accepts any additional properties */
12
+ [key: string]: any;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,6 +18,8 @@ export interface Mllm {
18
18
  /** Array of conversation items used for short-term memory management. */
19
19
  messages?: Record<string, unknown>[] | null;
20
20
  params?: Agora.MllmParams;
21
+ /** The number of conversation history messages cached in the MLLM. Applicable to Azure OpenAI Realtime API only. */
22
+ max_history?: number;
21
23
  /** MLLM input modalities. */
22
24
  input_modalities?: string[] | null;
23
25
  /** MLLM output modalities. */
@@ -36,9 +38,11 @@ export declare namespace Mllm {
36
38
  /** MLLM provider. */
37
39
  const Vendor: {
38
40
  readonly Openai: "openai";
41
+ readonly Azure: "azure";
39
42
  readonly Gemini: "gemini";
40
43
  readonly Vertexai: "vertexai";
41
44
  readonly Xai: "xai";
45
+ readonly QwenOmni: "qwen_omni";
42
46
  };
43
47
  type Vendor = (typeof Vendor)[keyof typeof Vendor];
44
48
  }
@@ -7,8 +7,10 @@ var Mllm;
7
7
  /** MLLM provider. */
8
8
  Mllm.Vendor = {
9
9
  Openai: "openai",
10
+ Azure: "azure",
10
11
  Gemini: "gemini",
11
12
  Vertexai: "vertexai",
12
13
  Xai: "xai",
14
+ QwenOmni: "qwen_omni",
13
15
  };
14
16
  })(Mllm || (exports.Mllm = Mllm = {}));
@@ -3,7 +3,17 @@ import type * as Agora from "../index.js";
3
3
  * Rime Text-to-Speech configuration (Beta).
4
4
  */
5
5
  export interface RimeTts {
6
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
7
+ credential_mode?: RimeTts.CredentialMode;
6
8
  params: Agora.RimeTtsParams;
7
9
  /** Controls whether the TTS module skips bracketed content when reading LLM response text. */
8
10
  skip_patterns?: number[];
9
11
  }
12
+ export declare namespace RimeTts {
13
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
14
+ const CredentialMode: {
15
+ readonly Managed: "managed";
16
+ readonly Byok: "byok";
17
+ };
18
+ type CredentialMode = (typeof CredentialMode)[keyof typeof CredentialMode];
19
+ }