agora-agents 2.12.0 → 2.13.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.
Files changed (100) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/agentkit/Agent.js +10 -3
  4. package/dist/cjs/agentkit/AgentSession.js +6 -2
  5. package/dist/cjs/agentkit/avatar-types.d.ts +6 -0
  6. package/dist/cjs/agentkit/index.d.ts +7 -9
  7. package/dist/cjs/agentkit/index.js +8 -5
  8. package/dist/cjs/agentkit/presets.js +3 -3
  9. package/dist/cjs/agentkit/preview/client.d.ts +6 -5
  10. package/dist/cjs/agentkit/preview/client.js +7 -7
  11. package/dist/cjs/agentkit/preview/gemini-tts.d.ts +3 -31
  12. package/dist/cjs/agentkit/preview/gemini-tts.js +4 -30
  13. package/dist/cjs/agentkit/preview/index.d.ts +2 -2
  14. package/dist/cjs/agentkit/preview/index.js +4 -4
  15. package/dist/cjs/agentkit/token.d.ts +43 -7
  16. package/dist/cjs/agentkit/token.js +34 -6
  17. package/dist/cjs/agentkit/types.d.ts +12 -3
  18. package/dist/cjs/agentkit/vendors/avatar.d.ts +30 -12
  19. package/dist/cjs/agentkit/vendors/avatar.js +62 -5
  20. package/dist/cjs/agentkit/vendors/stt.d.ts +35 -0
  21. package/dist/cjs/agentkit/vendors/stt.js +19 -2
  22. package/dist/cjs/agentkit/vendors/tts.d.ts +72 -18
  23. package/dist/cjs/agentkit/vendors/tts.js +60 -11
  24. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +13 -0
  25. package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.d.ts +3 -1
  26. package/dist/cjs/api/types/Asr.d.ts +4 -1
  27. package/dist/cjs/api/types/CartesiaTts.d.ts +10 -0
  28. package/dist/cjs/api/types/CartesiaTts.js +9 -0
  29. package/dist/cjs/api/types/CartesiaTtsParams.d.ts +1 -1
  30. package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
  31. package/dist/cjs/api/types/FishAudioTts.d.ts +10 -0
  32. package/dist/cjs/api/types/FishAudioTts.js +9 -0
  33. package/dist/cjs/api/types/FishAudioTtsParams.d.ts +1 -1
  34. package/dist/cjs/api/types/GeminiTts.d.ts +9 -0
  35. package/dist/cjs/api/types/GeminiTts.js +3 -0
  36. package/dist/cjs/api/types/GeminiTtsParams.d.ts +15 -0
  37. package/dist/cjs/api/types/GeminiTtsParams.js +3 -0
  38. package/dist/cjs/api/types/RtzrAsr.d.ts +10 -0
  39. package/dist/cjs/api/types/RtzrAsr.js +3 -0
  40. package/dist/cjs/api/types/RtzrAsrParams.d.ts +31 -0
  41. package/dist/cjs/api/types/RtzrAsrParams.js +3 -0
  42. package/dist/cjs/api/types/SarvamTtsParams.d.ts +12 -8
  43. package/dist/cjs/api/types/SarvamTtsParams.js +1 -1
  44. package/dist/cjs/api/types/Tts.d.ts +4 -1
  45. package/dist/cjs/api/types/index.d.ts +4 -0
  46. package/dist/cjs/api/types/index.js +4 -0
  47. package/dist/cjs/index.d.ts +4 -4
  48. package/dist/cjs/index.js +9 -6
  49. package/dist/cjs/version.d.ts +1 -1
  50. package/dist/cjs/version.js +1 -1
  51. package/dist/esm/BaseClient.mjs +2 -2
  52. package/dist/esm/agentkit/Agent.mjs +10 -3
  53. package/dist/esm/agentkit/AgentSession.mjs +6 -2
  54. package/dist/esm/agentkit/avatar-types.d.mts +6 -0
  55. package/dist/esm/agentkit/index.d.mts +7 -9
  56. package/dist/esm/agentkit/index.mjs +3 -4
  57. package/dist/esm/agentkit/presets.mjs +3 -3
  58. package/dist/esm/agentkit/preview/client.d.mts +6 -5
  59. package/dist/esm/agentkit/preview/client.mjs +7 -7
  60. package/dist/esm/agentkit/preview/gemini-tts.d.mts +3 -31
  61. package/dist/esm/agentkit/preview/gemini-tts.mjs +1 -28
  62. package/dist/esm/agentkit/preview/index.d.mts +2 -2
  63. package/dist/esm/agentkit/preview/index.mjs +1 -1
  64. package/dist/esm/agentkit/token.d.mts +43 -7
  65. package/dist/esm/agentkit/token.mjs +33 -6
  66. package/dist/esm/agentkit/types.d.mts +12 -3
  67. package/dist/esm/agentkit/vendors/avatar.d.mts +30 -12
  68. package/dist/esm/agentkit/vendors/avatar.mjs +59 -8
  69. package/dist/esm/agentkit/vendors/stt.d.mts +35 -0
  70. package/dist/esm/agentkit/vendors/stt.mjs +17 -1
  71. package/dist/esm/agentkit/vendors/tts.d.mts +72 -18
  72. package/dist/esm/agentkit/vendors/tts.mjs +58 -10
  73. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +13 -0
  74. package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.d.mts +3 -1
  75. package/dist/esm/api/types/Asr.d.mts +4 -1
  76. package/dist/esm/api/types/CartesiaTts.d.mts +10 -0
  77. package/dist/esm/api/types/CartesiaTts.mjs +8 -1
  78. package/dist/esm/api/types/CartesiaTtsParams.d.mts +1 -1
  79. package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
  80. package/dist/esm/api/types/FishAudioTts.d.mts +10 -0
  81. package/dist/esm/api/types/FishAudioTts.mjs +8 -1
  82. package/dist/esm/api/types/FishAudioTtsParams.d.mts +1 -1
  83. package/dist/esm/api/types/GeminiTts.d.mts +9 -0
  84. package/dist/esm/api/types/GeminiTts.mjs +2 -0
  85. package/dist/esm/api/types/GeminiTtsParams.d.mts +15 -0
  86. package/dist/esm/api/types/GeminiTtsParams.mjs +2 -0
  87. package/dist/esm/api/types/RtzrAsr.d.mts +10 -0
  88. package/dist/esm/api/types/RtzrAsr.mjs +2 -0
  89. package/dist/esm/api/types/RtzrAsrParams.d.mts +31 -0
  90. package/dist/esm/api/types/RtzrAsrParams.mjs +2 -0
  91. package/dist/esm/api/types/SarvamTtsParams.d.mts +12 -8
  92. package/dist/esm/api/types/SarvamTtsParams.mjs +1 -1
  93. package/dist/esm/api/types/Tts.d.mts +4 -1
  94. package/dist/esm/api/types/index.d.mts +4 -0
  95. package/dist/esm/api/types/index.mjs +4 -0
  96. package/dist/esm/index.d.mts +4 -4
  97. package/dist/esm/index.mjs +3 -3
  98. package/dist/esm/version.d.mts +1 -1
  99. package/dist/esm/version.mjs +1 -1
  100. package/package.json +2 -2
@@ -153,6 +153,12 @@ export interface AnamAvatarOptions {
153
153
  apiKey: string;
154
154
  /** Anam avatar ID */
155
155
  avatarId?: string;
156
+ /** Anam avatar model, such as `cara_mk4` for Cara 4 portrait mode */
157
+ avatarModel?: string;
158
+ /** Output video width in pixels. Set together with `videoHeight`. */
159
+ videoWidth?: number;
160
+ /** Output video height in pixels. Set together with `videoWidth`. */
161
+ videoHeight?: number;
156
162
  /** Enable avatar (default: true) */
157
163
  enable?: boolean;
158
164
  /** Additional vendor-specific parameters */
@@ -228,15 +234,27 @@ export declare class GenericAvatar extends BaseAvatar<number> {
228
234
  constructor(options: GenericAvatarOptions);
229
235
  toConfig(): AvatarConfig;
230
236
  }
231
- /** Tavus branding for GenericAvatar; uses the generic wire vendor. */
232
- export { GenericAvatar as Tavus };
233
- /** Protoface branding for GenericAvatar; uses the generic wire vendor. */
234
- export { GenericAvatar as Protoface };
235
- /** LemonSlice branding for GenericAvatar; uses the generic wire vendor. */
236
- export { GenericAvatar as LemonSlice };
237
- /** Constructor options shared with GenericAvatar. */
238
- export type TavusOptions = GenericAvatarOptions;
239
- /** Constructor options shared with GenericAvatar. */
240
- export type ProtofaceOptions = GenericAvatarOptions;
241
- /** Constructor options shared with GenericAvatar. */
242
- export type LemonSliceOptions = GenericAvatarOptions;
237
+ /** Tavus options with an optional provider endpoint override. */
238
+ export type TavusOptions = Omit<GenericAvatarOptions, "apiBaseUrl"> & {
239
+ apiBaseUrl?: string;
240
+ };
241
+ /** Protoface options with an optional provider endpoint override. */
242
+ export type ProtofaceOptions = TavusOptions;
243
+ export declare class Tavus extends GenericAvatar {
244
+ constructor(options: TavusOptions);
245
+ }
246
+ export declare class Protoface extends GenericAvatar {
247
+ constructor(options: ProtofaceOptions);
248
+ }
249
+ export interface LemonSliceOptions extends Omit<TavusOptions, "avatarId"> {
250
+ /** Provider-recommended fixed ID is lemonslice. Explicit overrides remain supported. */
251
+ avatarId?: string;
252
+ agentImageUrl?: string;
253
+ agentId?: string;
254
+ agentImageBase64?: string;
255
+ /** Omit to use the provider default of 2x3. */
256
+ aspectRatio?: "2x3" | "9x16" | "1x1";
257
+ }
258
+ export declare class LemonSlice extends GenericAvatar {
259
+ constructor(options: LemonSliceOptions);
260
+ }
@@ -183,6 +183,7 @@ exports.HeyGenAvatar = HeyGenAvatar;
183
183
  */
184
184
  class AnamAvatar extends base_js_1.BaseAvatar {
185
185
  constructor(options) {
186
+ var _a, _b;
186
187
  super();
187
188
  /**
188
189
  * Anam does not enforce a specific TTS sample rate. Consult Anam documentation
@@ -193,13 +194,24 @@ class AnamAvatar extends base_js_1.BaseAvatar {
193
194
  if (!options.apiKey) {
194
195
  throw new Error("Anam avatar requires apiKey");
195
196
  }
197
+ const hasVideoWidth = options.videoWidth !== undefined || ((_a = options.additionalParams) === null || _a === void 0 ? void 0 : _a.video_width) != null;
198
+ const hasVideoHeight = options.videoHeight !== undefined || ((_b = options.additionalParams) === null || _b === void 0 ? void 0 : _b.video_height) != null;
199
+ if (hasVideoWidth !== hasVideoHeight) {
200
+ throw new Error("Anam avatar requires videoWidth and videoHeight together");
201
+ }
196
202
  }
197
203
  toConfig() {
198
- const { apiKey, avatarId, enable = true, additionalParams } = this.options;
204
+ const { apiKey, avatarId, avatarModel, videoWidth, videoHeight, enable = true, additionalParams, } = this.options;
205
+ const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (avatarId && { avatar_id: avatarId })), (avatarModel && { avatar_model: avatarModel })), (videoWidth !== undefined && { video_width: videoWidth })), (videoHeight !== undefined && { video_height: videoHeight }));
206
+ const hasVideoWidth = params.video_width != null;
207
+ const hasVideoHeight = params.video_height != null;
208
+ if (hasVideoWidth !== hasVideoHeight) {
209
+ throw new Error("Anam avatar requires videoWidth and videoHeight together");
210
+ }
199
211
  return {
200
212
  enable,
201
213
  vendor: "anam",
202
- params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (avatarId && { avatar_id: avatarId })),
214
+ params,
203
215
  };
204
216
  }
205
217
  }
@@ -244,6 +256,51 @@ class GenericAvatar extends base_js_1.BaseAvatar {
244
256
  }
245
257
  }
246
258
  exports.GenericAvatar = GenericAvatar;
247
- exports.Tavus = GenericAvatar;
248
- exports.Protoface = GenericAvatar;
249
- exports.LemonSlice = GenericAvatar;
259
+ class Tavus extends GenericAvatar {
260
+ constructor(options) {
261
+ var _a;
262
+ super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://tavusapi.com/v2/conversations/agora" }));
263
+ }
264
+ }
265
+ exports.Tavus = Tavus;
266
+ class Protoface extends GenericAvatar {
267
+ constructor(options) {
268
+ var _a;
269
+ super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://api.protoface.com/v1/agora" }));
270
+ }
271
+ }
272
+ exports.Protoface = Protoface;
273
+ class LemonSlice extends GenericAvatar {
274
+ constructor(options) {
275
+ var _a, _b;
276
+ const params = Object.assign({}, options.additionalParams);
277
+ for (const [key, value] of [
278
+ ["agent_image_url", options.agentImageUrl],
279
+ ["agent_id", options.agentId],
280
+ ["agent_image_base64", options.agentImageBase64],
281
+ ["aspect_ratio", options.aspectRatio],
282
+ ]) {
283
+ if (value !== undefined)
284
+ params[key] = value;
285
+ }
286
+ let selectors = 0;
287
+ for (const key of ["agent_id", "agent_image_url", "agent_image_base64"]) {
288
+ if (Object.keys(params).includes(key)) {
289
+ const value = params[key];
290
+ if (typeof value !== "string" || !value.trim()) {
291
+ throw new Error(`LemonSlice ${key} must be a nonempty string`);
292
+ }
293
+ selectors++;
294
+ }
295
+ }
296
+ if (selectors !== 1) {
297
+ throw new Error("LemonSlice requires exactly one of agent_id, agent_image_url, agent_image_base64");
298
+ }
299
+ if (Object.keys(params).includes("aspect_ratio") &&
300
+ !["2x3", "9x16", "1x1"].includes(params.aspect_ratio)) {
301
+ throw new Error("LemonSlice aspect_ratio must be 2x3, 9x16, or 1x1");
302
+ }
303
+ super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://lemonslice.com/api/liveai/agora", avatarId: (_b = options.avatarId) !== null && _b !== void 0 ? _b : "lemonslice", additionalParams: params }));
304
+ }
305
+ }
306
+ exports.LemonSlice = LemonSlice;
@@ -338,6 +338,41 @@ export declare class SarvamSTT extends BaseSTT {
338
338
  constructor(options: SarvamSTTOptions);
339
339
  toConfig(): SttConfig;
340
340
  }
341
+ /** Constructor options for RTZR STT. */
342
+ export interface RTZRSTTOptions {
343
+ /** RTZR client ID. */
344
+ clientId: string;
345
+ /** RTZR client secret. */
346
+ clientSecret: string;
347
+ /** RTZR API base URL. */
348
+ apiBase?: string;
349
+ /** RTZR recognition model name. */
350
+ modelName?: string;
351
+ /** Recognition language code. Defaults server-side to Korean (`ko`). */
352
+ language?: string;
353
+ /** Input audio sample rate in Hz. */
354
+ sampleRate?: number;
355
+ /** Input audio encoding. */
356
+ encoding?: string;
357
+ /** Whether to enable inverse text normalization. */
358
+ useItn?: boolean;
359
+ /** Whether to filter disfluencies such as stuttering. */
360
+ useDisfluencyFilter?: boolean;
361
+ /** Whether to filter profanity. */
362
+ useProfanityFilter?: boolean;
363
+ /** Whether to add punctuation to recognized text. */
364
+ usePunctuation?: boolean;
365
+ /** Keywords used to improve recognition accuracy. */
366
+ keywords?: string[];
367
+ /** Additional RTZR parameters. Explicit options take precedence. */
368
+ additionalParams?: Partial<import("../types.js").RtzrAsrParams>;
369
+ }
370
+ /** RTZR streaming STT vendor. */
371
+ export declare class RTZRSTT extends BaseSTT {
372
+ private readonly options;
373
+ constructor(options: RTZRSTTOptions);
374
+ toConfig(): SttConfig;
375
+ }
341
376
  /**
342
377
  * Constructor options for xAI STT.
343
378
  */
@@ -3,7 +3,7 @@
3
3
  * Type-safe STT (Speech-to-Text) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SmallestAISTT = exports.XAiSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = exports.GeminiSTT = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = void 0;
6
+ exports.SmallestAISTT = exports.XAiSTT = exports.RTZRSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = exports.GeminiSTT = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = void 0;
7
7
  const presets_js_1 = require("../presets.js");
8
8
  const base_js_1 = require("./base.js");
9
9
  function _requireString(value, field, vendor) {
@@ -113,7 +113,7 @@ class DeepgramSTT extends base_js_1.BaseSTT {
113
113
  const { apiKey, model, language, smartFormat, punctuation, keyterm, additionalParams } = this.options;
114
114
  return {
115
115
  vendor: "deepgram",
116
- params: Object.assign(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 })), (keyterm && { keyterm })),
116
+ params: Object.assign(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 })), (keyterm && { keyterm })),
117
117
  };
118
118
  }
119
119
  }
@@ -304,6 +304,23 @@ class SarvamSTT extends base_js_1.BaseSTT {
304
304
  }
305
305
  }
306
306
  exports.SarvamSTT = SarvamSTT;
307
+ /** RTZR streaming STT vendor. */
308
+ class RTZRSTT extends base_js_1.BaseSTT {
309
+ constructor(options) {
310
+ super();
311
+ this.options = options;
312
+ _requireString(options.clientId, "clientId", "RTZRSTT");
313
+ _requireString(options.clientSecret, "clientSecret", "RTZRSTT");
314
+ }
315
+ toConfig() {
316
+ const o = this.options;
317
+ return {
318
+ vendor: "rtzr",
319
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, o.additionalParams), { client_id: o.clientId, client_secret: o.clientSecret }), (o.apiBase !== undefined && { api_base: o.apiBase })), (o.modelName !== undefined && { model_name: o.modelName })), (o.language !== undefined && { language: o.language })), (o.sampleRate !== undefined && { sample_rate: o.sampleRate })), (o.encoding !== undefined && { encoding: o.encoding })), (o.useItn !== undefined && { use_itn: o.useItn })), (o.useDisfluencyFilter !== undefined && { use_disfluency_filter: o.useDisfluencyFilter })), (o.useProfanityFilter !== undefined && { use_profanity_filter: o.useProfanityFilter })), (o.usePunctuation !== undefined && { use_punctuation: o.usePunctuation })), (o.keywords !== undefined && { keywords: o.keywords })),
320
+ };
321
+ }
322
+ }
323
+ exports.RTZRSTT = RTZRSTT;
307
324
  /**
308
325
  * xAI STT vendor.
309
326
  *
@@ -1,11 +1,39 @@
1
1
  /**
2
2
  * Type-safe TTS (Text-to-Speech) vendor classes.
3
3
  */
4
+ import type { Tts as GeneratedTts } from "../../api/index.js";
5
+ import { SarvamTtsParams as SarvamTtsParamsNS } from "../../api/types/SarvamTtsParams.js";
4
6
  import { CredentialMode } from "../constants.js";
5
7
  import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.js";
6
8
  import type { TtsConfig } from "../types.js";
7
9
  import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.js";
8
10
  import { BaseTTS } from "./base.js";
11
+ /** Gemini 3.8 Flash TTS model. */
12
+ export declare const GeminiTTSModels: {
13
+ readonly Flash38: "gemini-3.8-flash-tts";
14
+ };
15
+ export type GeminiTTSModel = (typeof GeminiTTSModels)[keyof typeof GeminiTTSModels] | (string & {});
16
+ export interface GeminiTTSOptions {
17
+ apiKey: string;
18
+ /** Sent verbatim; defaults to Gemini 3.8 Flash TTS. */
19
+ model?: GeminiTTSModel;
20
+ /** Defaults to Puck. */
21
+ voice?: string;
22
+ /** Natural-language speaking instructions. Omitted unless supplied. */
23
+ style?: string;
24
+ /** Additional provider-specific parameters merged into `tts.params`. */
25
+ additionalParams?: Record<string, unknown>;
26
+ /** Skip patterns for bracketed content. */
27
+ skipPatterns?: number[];
28
+ }
29
+ /** Production Gemini TTS wire shape from the generated schema. */
30
+ export type GeminiTTSConfig = GeneratedTts.Gemini;
31
+ /** Gemini TTS uses the client's configured regional production endpoint. */
32
+ export declare class GeminiTTS extends BaseTTS {
33
+ private readonly options;
34
+ constructor(options: GeminiTTSOptions);
35
+ toConfig(): GeminiTTSConfig;
36
+ }
9
37
  /**
10
38
  * Constructor options for ElevenLabs TTS.
11
39
  */
@@ -148,9 +176,7 @@ export declare class OpenAITTS extends BaseTTS<24000> {
148
176
  /**
149
177
  * Constructor options for Cartesia TTS.
150
178
  */
151
- export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSampleRate> {
152
- /** Cartesia API key */
153
- apiKey: string;
179
+ type CartesiaTTSCommonOptions<SR extends CartesiaSampleRate> = {
154
180
  /** Voice ID */
155
181
  voiceId: string;
156
182
  /** Model ID */
@@ -166,7 +192,16 @@ export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSamp
166
192
  sampleRate?: SR;
167
193
  /** Skip patterns for bracketed content */
168
194
  skipPatterns?: number[];
169
- }
195
+ };
196
+ export type CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSampleRate> = CartesiaTTSCommonOptions<SR> & ({
197
+ /** Use Agora-managed credentials; the API key is optional. */
198
+ credentialMode: typeof CredentialMode.Managed;
199
+ apiKey?: string;
200
+ } | {
201
+ /** Bring your own credentials (default when omitted). */
202
+ credentialMode?: typeof CredentialMode.Byok;
203
+ apiKey: string;
204
+ });
170
205
  /**
171
206
  * Cartesia TTS vendor.
172
207
  *
@@ -175,6 +210,7 @@ export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSamp
175
210
  * const tts = new CartesiaTTS({
176
211
  * apiKey: process.env.CARTESIA_API_KEY,
177
212
  * voiceId: 'voice-id-here',
213
+ * modelId: 'sonic-2',
178
214
  * sampleRate: 24000,
179
215
  * });
180
216
  * ```
@@ -443,16 +479,23 @@ export declare class RimeTTS extends BaseTTS {
443
479
  /**
444
480
  * Constructor options for Fish Audio TTS.
445
481
  */
446
- export interface FishAudioTTSOptions {
447
- /** Fish Audio API key */
448
- key: string;
482
+ type FishAudioTTSCommonOptions = {
449
483
  /** Reference ID */
450
484
  referenceId: string;
451
485
  /** Backend used by Fish Audio */
452
486
  backend: string;
453
487
  /** Skip patterns for bracketed content */
454
488
  skipPatterns?: number[];
455
- }
489
+ };
490
+ export type FishAudioTTSOptions = FishAudioTTSCommonOptions & ({
491
+ /** Use Agora-managed credentials; the API key is optional. */
492
+ credentialMode: typeof CredentialMode.Managed;
493
+ key?: string;
494
+ } | {
495
+ /** Bring your own credentials (default when omitted). */
496
+ credentialMode?: typeof CredentialMode.Byok;
497
+ key: string;
498
+ });
456
499
  /**
457
500
  * Fish Audio TTS vendor.
458
501
  *
@@ -518,21 +561,32 @@ export declare class MiniMaxTTS extends BaseTTS {
518
561
  /**
519
562
  * Constructor options for Sarvam TTS (Beta).
520
563
  */
521
- export interface SarvamTTSOptions {
564
+ export declare const SarvamTTSLanguage: typeof SarvamTtsParamsNS.TargetLanguageCode;
565
+ /** Target language supported by Sarvam TTS. */
566
+ export type SarvamTTSLanguage = (typeof SarvamTTSLanguage)[keyof typeof SarvamTTSLanguage];
567
+ export interface SarvamTTSOptions<SR extends number = number> {
522
568
  /** Sarvam API subscription key */
523
569
  key: string;
524
570
  /** Speaker/voice ID (e.g., 'anushka', 'abhilash', 'karun', 'hitesh', 'manisha', 'vidya', 'arya') */
525
571
  speaker: string;
526
- /** Target language code (e.g., 'en-IN', 'hi-IN', 'ta-IN') */
527
- targetLanguageCode: import("../types.js").SarvamTtsParams["target_language_code"];
528
- /** Pitch adjustment for the voice */
572
+ /** Target language code. Use `SarvamTTSLanguage` for discoverable values. */
573
+ targetLanguageCode: SarvamTTSLanguage;
574
+ /** Pitch control for the `bulbul:v2` model. */
529
575
  pitch?: number;
530
- /** Speed of speech */
576
+ /** Speech speed. Defaults server-side to `1.0`. */
531
577
  pace?: number;
532
- /** Volume level of the speech */
578
+ /** Audio loudness control for the `bulbul:v2` model. */
533
579
  loudness?: number;
534
- /** Audio sample rate in Hz */
535
- sampleRate?: number;
580
+ /** Output speech sample rate in Hz. Defaults server-side to 24000. */
581
+ speechSampleRate?: SR;
582
+ /** @deprecated Use `speechSampleRate` instead. */
583
+ sampleRate?: SR;
584
+ /** Whether to normalize English words and numeric entities. */
585
+ enablePreprocessing?: boolean;
586
+ /** TTS model to use. Defaults server-side to `bulbul:v3`. */
587
+ model?: string;
588
+ /** Additional vendor-specific parameters. Explicit options take precedence. */
589
+ additionalParams?: Record<string, unknown>;
536
590
  /** Skip patterns for bracketed content */
537
591
  skipPatterns?: number[];
538
592
  }
@@ -548,9 +602,9 @@ export interface SarvamTTSOptions {
548
602
  * });
549
603
  * ```
550
604
  */
551
- export declare class SarvamTTS extends BaseTTS {
605
+ export declare class SarvamTTS<SR extends number = number> extends BaseTTS<SR> {
552
606
  private readonly options;
553
- constructor(options: SarvamTTSOptions);
607
+ constructor(options: SarvamTTSOptions<SR>);
554
608
  toConfig(): TtsConfig;
555
609
  }
556
610
  /**
@@ -3,10 +3,37 @@
3
3
  * Type-safe TTS (Text-to-Speech) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SmallestAITTS = 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;
6
+ exports.SmallestAITTS = exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.SarvamTTSLanguage = 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 = exports.GeminiTTS = exports.GeminiTTSModels = void 0;
7
+ const SarvamTtsParams_js_1 = require("../../api/types/SarvamTtsParams.js");
7
8
  const constants_js_1 = require("../constants.js");
8
9
  const presets_js_1 = require("../presets.js");
9
10
  const base_js_1 = require("./base.js");
11
+ /** Gemini 3.8 Flash TTS model. */
12
+ exports.GeminiTTSModels = {
13
+ Flash38: "gemini-3.8-flash-tts",
14
+ };
15
+ /** Gemini TTS uses the client's configured regional production endpoint. */
16
+ class GeminiTTS extends base_js_1.BaseTTS {
17
+ constructor(options) {
18
+ super();
19
+ for (const field of ["apiKey", "model", "voice"]) {
20
+ const value = options[field];
21
+ if ((field === "apiKey" || value !== undefined) && (typeof value !== "string" || !value.trim())) {
22
+ throw new Error(`GeminiTTS requires ${field}`);
23
+ }
24
+ }
25
+ if (options.style !== undefined && typeof options.style !== "string") {
26
+ throw new Error("GeminiTTS style must be a string");
27
+ }
28
+ this.options = Object.assign({}, options);
29
+ }
30
+ toConfig() {
31
+ const { apiKey, model = exports.GeminiTTSModels.Flash38, voice = "Puck", style, additionalParams, skipPatterns, } = this.options;
32
+ return Object.assign({ vendor: "gemini", params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, model,
33
+ voice }), (style !== undefined && { style })) }, (skipPatterns !== undefined && { skip_patterns: skipPatterns }));
34
+ }
35
+ }
36
+ exports.GeminiTTS = GeminiTTS;
10
37
  function requireString(value, field, vendor) {
11
38
  if (typeof value !== "string" || value.length === 0) {
12
39
  throw new Error(`${vendor} requires ${field}`);
@@ -120,6 +147,7 @@ exports.OpenAITTS = OpenAITTS;
120
147
  * const tts = new CartesiaTTS({
121
148
  * apiKey: process.env.CARTESIA_API_KEY,
122
149
  * voiceId: 'voice-id-here',
150
+ * modelId: 'sonic-2',
123
151
  * sampleRate: 24000,
124
152
  * });
125
153
  * ```
@@ -127,11 +155,21 @@ exports.OpenAITTS = OpenAITTS;
127
155
  class CartesiaTTS extends base_js_1.BaseTTS {
128
156
  constructor(options) {
129
157
  super();
158
+ if (options.credentialMode !== undefined &&
159
+ options.credentialMode !== constants_js_1.CredentialMode.Managed &&
160
+ options.credentialMode !== constants_js_1.CredentialMode.Byok) {
161
+ throw new Error("CartesiaTTS credentialMode must be one of: managed, byok");
162
+ }
163
+ if (options.credentialMode !== constants_js_1.CredentialMode.Managed) {
164
+ requireString(options.apiKey, "apiKey", "CartesiaTTS");
165
+ }
166
+ requireString(options.voiceId, "voiceId", "CartesiaTTS");
167
+ requireString(options.modelId, "modelId", "CartesiaTTS");
130
168
  this.options = options;
131
169
  }
132
170
  toConfig() {
133
- const { apiKey, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
134
- return Object.assign({ vendor: "cartesia", params: Object.assign(Object.assign(Object.assign({ api_key: apiKey, voice: { mode: "id", id: voiceId }, model_id: modelId }, (baseUrl && { base_url: baseUrl })), (sampleRate && { output_format: { container: "raw", sample_rate: sampleRate } })), (language && { language })) }, (skipPatterns && { skip_patterns: skipPatterns }));
171
+ const { apiKey, credentialMode, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
172
+ return Object.assign(Object.assign(Object.assign({ vendor: "cartesia" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (apiKey && { api_key: apiKey })), { voice: { mode: "id", id: voiceId }, model_id: modelId }), (baseUrl && { base_url: baseUrl })), (sampleRate && { output_format: { container: "raw", sample_rate: sampleRate } })), (language && { language })) }), (skipPatterns && { skip_patterns: skipPatterns }));
135
173
  }
136
174
  }
137
175
  exports.CartesiaTTS = CartesiaTTS;
@@ -322,15 +360,21 @@ exports.RimeTTS = RimeTTS;
322
360
  class FishAudioTTS extends base_js_1.BaseTTS {
323
361
  constructor(options) {
324
362
  super();
363
+ if (options.credentialMode !== undefined &&
364
+ options.credentialMode !== constants_js_1.CredentialMode.Managed &&
365
+ options.credentialMode !== constants_js_1.CredentialMode.Byok) {
366
+ throw new Error("FishAudioTTS credentialMode must be one of: managed, byok");
367
+ }
368
+ if (options.credentialMode !== constants_js_1.CredentialMode.Managed) {
369
+ requireString(options.key, "key", "FishAudioTTS");
370
+ }
371
+ requireString(options.referenceId, "referenceId", "FishAudioTTS");
372
+ requireString(options.backend, "backend", "FishAudioTTS");
325
373
  this.options = options;
326
374
  }
327
375
  toConfig() {
328
- const { key, referenceId, backend, skipPatterns } = this.options;
329
- return Object.assign({ vendor: "fishaudio", params: {
330
- api_key: key,
331
- reference_id: referenceId,
332
- backend,
333
- } }, (skipPatterns && { skip_patterns: skipPatterns }));
376
+ const { key, credentialMode, referenceId, backend, skipPatterns } = this.options;
377
+ return Object.assign(Object.assign(Object.assign({ vendor: "fishaudio" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign(Object.assign({}, (key && { api_key: key })), { reference_id: referenceId, backend }) }), (skipPatterns && { skip_patterns: skipPatterns }));
334
378
  }
335
379
  }
336
380
  exports.FishAudioTTS = FishAudioTTS;
@@ -368,6 +412,10 @@ class MiniMaxTTS extends base_js_1.BaseTTS {
368
412
  }
369
413
  }
370
414
  exports.MiniMaxTTS = MiniMaxTTS;
415
+ /**
416
+ * Constructor options for Sarvam TTS (Beta).
417
+ */
418
+ exports.SarvamTTSLanguage = SarvamTtsParams_js_1.SarvamTtsParams.TargetLanguageCode;
371
419
  /**
372
420
  * Sarvam TTS vendor (Beta).
373
421
  *
@@ -386,8 +434,9 @@ class SarvamTTS extends base_js_1.BaseTTS {
386
434
  this.options = options;
387
435
  }
388
436
  toConfig() {
389
- const { key, speaker, targetLanguageCode, pitch, pace, loudness, sampleRate, skipPatterns } = this.options;
390
- return Object.assign({ vendor: "sarvam", params: Object.assign(Object.assign(Object.assign(Object.assign({ api_subscription_key: key, speaker, target_language_code: targetLanguageCode }, (pitch !== undefined && { pitch })), (pace !== undefined && { pace })), (loudness !== undefined && { loudness })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
437
+ const { key, speaker, targetLanguageCode, pitch, pace, loudness, speechSampleRate, sampleRate, enablePreprocessing, model, additionalParams, skipPatterns, } = this.options;
438
+ const resolvedSampleRate = speechSampleRate !== null && speechSampleRate !== void 0 ? speechSampleRate : sampleRate;
439
+ return Object.assign({ vendor: "sarvam", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_subscription_key: key, speaker, target_language_code: targetLanguageCode }), (pitch !== undefined && { pitch })), (pace !== undefined && { pace })), (loudness !== undefined && { loudness })), (resolvedSampleRate !== undefined && { speech_sample_rate: resolvedSampleRate })), (enablePreprocessing !== undefined && { enable_preprocessing: enablePreprocessing })), (model !== undefined && { model })) }, (skipPatterns && { skip_patterns: skipPatterns }));
391
440
  }
392
441
  }
393
442
  exports.SarvamTTS = SarvamTTS;
@@ -688,6 +688,8 @@ export declare namespace StartAgentsRequest {
688
688
  * Agent configuration parameters.
689
689
  */
690
690
  interface Parameters {
691
+ /** Settings for the agent's speak behavior. */
692
+ speak?: Parameters.Speak;
691
693
  /** Settings related to agent silence behavior. Does not apply when you integrate a `mllm`. */
692
694
  silence_config?: Parameters.SilenceConfig;
693
695
  /** Graceful hang-up settings for the agent. */
@@ -717,6 +719,17 @@ export declare namespace StartAgentsRequest {
717
719
  opt_out?: boolean;
718
720
  }
719
721
  namespace Parameters {
722
+ /**
723
+ * Settings for the agent's speak behavior.
724
+ */
725
+ interface Speak {
726
+ /**
727
+ * Whether to skip sentence segmentation for speak requests:
728
+ * - `false`: Skip sentence segmentation.
729
+ * - Omitted or `true`: Preserve sentence segmentation.
730
+ */
731
+ batch?: boolean | null;
732
+ }
720
733
  /**
721
734
  * Settings related to agent silence behavior. Does not apply when you integrate a `mllm`.
722
735
  */
@@ -133,8 +133,10 @@ export declare namespace GetTurnsAgentsResponse {
133
133
  * Additional context about the turn end event. Included fields depend on the value of the `type` field.
134
134
  */
135
135
  interface Metadata {
136
- /** The audio playback duration in milliseconds. Included only when `type` is `ok`. */
136
+ /** The actual audio playback duration in milliseconds. Included when `type` is `ok` or `interrupted`. */
137
137
  playback_duration_ms?: number;
138
+ /** The intended audio playback duration in milliseconds. Included only when `type` is `interrupted`. */
139
+ intended_playback_duration_ms?: number;
138
140
  /**
139
141
  * The cause of the turn ending.
140
142
  *
@@ -1,5 +1,5 @@
1
1
  import type * as Agora from "../index.js";
2
- export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai;
2
+ export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Rtzr | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai;
3
3
  export declare namespace Asr {
4
4
  interface Ares extends Agora.AresAsr {
5
5
  vendor: "ares";
@@ -37,6 +37,9 @@ export declare namespace Asr {
37
37
  interface Sarvam extends Agora.SarvamAsr {
38
38
  vendor: "sarvam";
39
39
  }
40
+ interface Rtzr extends Agora.RtzrAsr {
41
+ vendor: "rtzr";
42
+ }
40
43
  interface Xai extends Agora.XAiAsr {
41
44
  vendor: "xai";
42
45
  }
@@ -3,7 +3,17 @@ import type * as Agora from "../index.js";
3
3
  * Cartesia Text-to-Speech configuration (Beta).
4
4
  */
5
5
  export interface CartesiaTts {
6
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
7
+ credential_mode?: CartesiaTts.CredentialMode;
6
8
  params: Agora.CartesiaTtsParams;
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 CartesiaTts {
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
+ }
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CartesiaTts = void 0;
5
+ var CartesiaTts;
6
+ (function (CartesiaTts) {
7
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
8
+ CartesiaTts.CredentialMode = {
9
+ Managed: "managed",
10
+ Byok: "byok",
11
+ };
12
+ })(CartesiaTts || (exports.CartesiaTts = CartesiaTts = {}));
@@ -4,7 +4,7 @@ import type * as Agora from "../index.js";
4
4
  */
5
5
  export interface CartesiaTtsParams {
6
6
  /** Cartesia API key */
7
- api_key: string;
7
+ api_key?: string;
8
8
  /** Model ID (for example, sonic-2) */
9
9
  model_id: string;
10
10
  /** WebSocket URL for the Cartesia streaming API */
@@ -5,7 +5,7 @@ export interface DeepgramAsrParams {
5
5
  /** WebSocket URL for Deepgram's streaming API */
6
6
  url?: string | null;
7
7
  /** Deepgram API key */
8
- key: string;
8
+ api_key: string;
9
9
  /** Speech recognition model */
10
10
  model?: string | null;
11
11
  /** Language code for speech recognition */
@@ -3,7 +3,17 @@ import type * as Agora from "../index.js";
3
3
  * Fish Audio Text-to-Speech configuration (Beta).
4
4
  */
5
5
  export interface FishAudioTts {
6
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
7
+ credential_mode?: FishAudioTts.CredentialMode;
6
8
  params: Agora.FishAudioTtsParams;
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 FishAudioTts {
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
+ }
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FishAudioTts = void 0;
5
+ var FishAudioTts;
6
+ (function (FishAudioTts) {
7
+ /** Credential mode. When provided, must be "managed" (Agora managed mode) or "byok" (BYOK mode). */
8
+ FishAudioTts.CredentialMode = {
9
+ Managed: "managed",
10
+ Byok: "byok",
11
+ };
12
+ })(FishAudioTts || (exports.FishAudioTts = FishAudioTts = {}));