agora-agents 2.2.0 → 2.3.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 (170) hide show
  1. package/README.md +48 -26
  2. package/dist/cjs/AgoraPoolClient.d.ts +9 -6
  3. package/dist/cjs/AgoraPoolClient.js +1 -0
  4. package/dist/cjs/agentkit/Agent.d.ts +52 -51
  5. package/dist/cjs/agentkit/Agent.js +40 -39
  6. package/dist/cjs/agentkit/AgentSession.d.ts +11 -10
  7. package/dist/cjs/agentkit/AgentSession.js +10 -6
  8. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.d.ts +1 -0
  9. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +57 -0
  10. package/dist/cjs/agentkit/__tests__/readme-examples.test.d.ts +1 -0
  11. package/dist/cjs/agentkit/__tests__/readme-examples.test.js +126 -0
  12. package/dist/cjs/agentkit/__tests__/type-safety.test.js +24 -17
  13. package/dist/cjs/agentkit/area.d.ts +4 -0
  14. package/dist/cjs/agentkit/area.js +2 -0
  15. package/dist/cjs/agentkit/avatar-types.d.ts +28 -2
  16. package/dist/cjs/agentkit/avatar-types.js +24 -2
  17. package/dist/cjs/agentkit/index.d.ts +8 -5
  18. package/dist/cjs/agentkit/index.js +27 -2
  19. package/dist/cjs/agentkit/region-vendors.d.ts +15 -0
  20. package/dist/cjs/agentkit/region-vendors.js +2 -0
  21. package/dist/cjs/agentkit/token.d.ts +3 -2
  22. package/dist/cjs/agentkit/token.js +3 -2
  23. package/dist/cjs/agentkit/types.d.ts +26 -5
  24. package/dist/cjs/agentkit/vendors/avatar.d.ts +6 -3
  25. package/dist/cjs/agentkit/vendors/avatar.js +6 -3
  26. package/dist/cjs/agentkit/vendors/base.d.ts +38 -5
  27. package/dist/cjs/agentkit/vendors/base.js +60 -6
  28. package/dist/cjs/agentkit/vendors/cn.d.ts +251 -0
  29. package/dist/cjs/agentkit/vendors/cn.js +293 -0
  30. package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
  31. package/dist/cjs/agentkit/vendors/mllm.js +8 -4
  32. package/dist/cjs/agentkit/vendors/stt.js +5 -0
  33. package/dist/cjs/agentkit/vendors/tts.d.ts +3 -3
  34. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +5 -2
  35. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +4 -0
  36. package/dist/cjs/api/types/Asr.d.ts +16 -1
  37. package/dist/cjs/api/types/BytedanceDuplexTts.d.ts +9 -0
  38. package/dist/cjs/api/types/BytedanceDuplexTts.js +3 -0
  39. package/dist/cjs/api/types/BytedanceDuplexTtsParams.d.ts +13 -0
  40. package/dist/cjs/api/types/BytedanceDuplexTtsParams.js +3 -0
  41. package/dist/cjs/api/types/BytedanceTts.d.ts +9 -0
  42. package/dist/cjs/api/types/BytedanceTts.js +3 -0
  43. package/dist/cjs/api/types/BytedanceTtsParams.d.ts +23 -0
  44. package/dist/cjs/api/types/BytedanceTtsParams.js +3 -0
  45. package/dist/cjs/api/types/CosyvoiceTts.d.ts +9 -0
  46. package/dist/cjs/api/types/CosyvoiceTts.js +3 -0
  47. package/dist/cjs/api/types/CosyvoiceTtsParams.d.ts +15 -0
  48. package/dist/cjs/api/types/CosyvoiceTtsParams.js +3 -0
  49. package/dist/cjs/api/types/FengmingAsr.d.ts +11 -0
  50. package/dist/cjs/api/types/FengmingAsr.js +3 -0
  51. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +52 -3
  52. package/dist/cjs/api/types/OpenAiTtsParams.d.ts +1 -1
  53. package/dist/cjs/api/types/SensetimeAvatarParams.d.ts +48 -0
  54. package/dist/cjs/api/types/SensetimeAvatarParams.js +3 -0
  55. package/dist/cjs/api/types/StepfunTts.d.ts +9 -0
  56. package/dist/cjs/api/types/StepfunTts.js +3 -0
  57. package/dist/cjs/api/types/StepfunTtsParams.d.ts +13 -0
  58. package/dist/cjs/api/types/StepfunTtsParams.js +3 -0
  59. package/dist/cjs/api/types/TencentAsr.d.ts +10 -0
  60. package/dist/cjs/api/types/TencentAsr.js +3 -0
  61. package/dist/cjs/api/types/TencentAsrParams.d.ts +17 -0
  62. package/dist/cjs/api/types/TencentAsrParams.js +3 -0
  63. package/dist/cjs/api/types/TencentTts.d.ts +9 -0
  64. package/dist/cjs/api/types/TencentTts.js +3 -0
  65. package/dist/cjs/api/types/TencentTtsParams.d.ts +23 -0
  66. package/dist/cjs/api/types/TencentTtsParams.js +3 -0
  67. package/dist/cjs/api/types/Tts.d.ts +16 -1
  68. package/dist/cjs/api/types/XfyunAsr.d.ts +10 -0
  69. package/dist/cjs/api/types/XfyunAsr.js +3 -0
  70. package/dist/cjs/api/types/XfyunAsrParams.d.ts +15 -0
  71. package/dist/cjs/api/types/XfyunAsrParams.js +3 -0
  72. package/dist/cjs/api/types/XfyunBigmodelAsr.d.ts +10 -0
  73. package/dist/cjs/api/types/XfyunBigmodelAsr.js +3 -0
  74. package/dist/cjs/api/types/XfyunBigmodelAsrParams.d.ts +17 -0
  75. package/dist/cjs/api/types/XfyunBigmodelAsrParams.js +3 -0
  76. package/dist/cjs/api/types/XfyunDialectAsr.d.ts +10 -0
  77. package/dist/cjs/api/types/XfyunDialectAsr.js +3 -0
  78. package/dist/cjs/api/types/XfyunDialectAsrParams.d.ts +15 -0
  79. package/dist/cjs/api/types/XfyunDialectAsrParams.js +3 -0
  80. package/dist/cjs/api/types/index.d.ts +20 -0
  81. package/dist/cjs/api/types/index.js +20 -0
  82. package/dist/cjs/core/domain/index.d.ts +2 -1
  83. package/dist/cjs/core/domain/index.js +5 -3
  84. package/dist/cjs/index.d.ts +3 -2
  85. package/dist/cjs/index.js +26 -2
  86. package/dist/esm/AgoraPoolClient.d.mts +9 -6
  87. package/dist/esm/AgoraPoolClient.mjs +1 -0
  88. package/dist/esm/agentkit/Agent.d.mts +52 -51
  89. package/dist/esm/agentkit/Agent.mjs +40 -39
  90. package/dist/esm/agentkit/AgentSession.d.mts +11 -10
  91. package/dist/esm/agentkit/AgentSession.mjs +11 -7
  92. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.d.mts +1 -0
  93. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +55 -0
  94. package/dist/esm/agentkit/__tests__/readme-examples.test.d.mts +1 -0
  95. package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +124 -0
  96. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +24 -17
  97. package/dist/esm/agentkit/area.d.mts +4 -0
  98. package/dist/esm/agentkit/area.mjs +1 -0
  99. package/dist/esm/agentkit/avatar-types.d.mts +28 -2
  100. package/dist/esm/agentkit/avatar-types.mjs +23 -2
  101. package/dist/esm/agentkit/index.d.mts +8 -5
  102. package/dist/esm/agentkit/index.mjs +3 -2
  103. package/dist/esm/agentkit/region-vendors.d.mts +15 -0
  104. package/dist/esm/agentkit/region-vendors.mjs +1 -0
  105. package/dist/esm/agentkit/token.d.mts +3 -2
  106. package/dist/esm/agentkit/token.mjs +3 -2
  107. package/dist/esm/agentkit/types.d.mts +26 -5
  108. package/dist/esm/agentkit/vendors/avatar.d.mts +6 -3
  109. package/dist/esm/agentkit/vendors/avatar.mjs +6 -3
  110. package/dist/esm/agentkit/vendors/base.d.mts +38 -5
  111. package/dist/esm/agentkit/vendors/base.mjs +55 -5
  112. package/dist/esm/agentkit/vendors/cn.d.mts +251 -0
  113. package/dist/esm/agentkit/vendors/cn.mjs +272 -0
  114. package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
  115. package/dist/esm/agentkit/vendors/mllm.mjs +8 -4
  116. package/dist/esm/agentkit/vendors/stt.mjs +5 -0
  117. package/dist/esm/agentkit/vendors/tts.d.mts +3 -3
  118. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +5 -2
  119. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +4 -0
  120. package/dist/esm/api/types/Asr.d.mts +16 -1
  121. package/dist/esm/api/types/BytedanceDuplexTts.d.mts +9 -0
  122. package/dist/esm/api/types/BytedanceDuplexTts.mjs +2 -0
  123. package/dist/esm/api/types/BytedanceDuplexTtsParams.d.mts +13 -0
  124. package/dist/esm/api/types/BytedanceDuplexTtsParams.mjs +2 -0
  125. package/dist/esm/api/types/BytedanceTts.d.mts +9 -0
  126. package/dist/esm/api/types/BytedanceTts.mjs +2 -0
  127. package/dist/esm/api/types/BytedanceTtsParams.d.mts +23 -0
  128. package/dist/esm/api/types/BytedanceTtsParams.mjs +2 -0
  129. package/dist/esm/api/types/CosyvoiceTts.d.mts +9 -0
  130. package/dist/esm/api/types/CosyvoiceTts.mjs +2 -0
  131. package/dist/esm/api/types/CosyvoiceTtsParams.d.mts +15 -0
  132. package/dist/esm/api/types/CosyvoiceTtsParams.mjs +2 -0
  133. package/dist/esm/api/types/FengmingAsr.d.mts +11 -0
  134. package/dist/esm/api/types/FengmingAsr.mjs +2 -0
  135. package/dist/esm/api/types/MinimaxTtsParams.d.mts +52 -3
  136. package/dist/esm/api/types/OpenAiTtsParams.d.mts +1 -1
  137. package/dist/esm/api/types/SensetimeAvatarParams.d.mts +48 -0
  138. package/dist/esm/api/types/SensetimeAvatarParams.mjs +2 -0
  139. package/dist/esm/api/types/StepfunTts.d.mts +9 -0
  140. package/dist/esm/api/types/StepfunTts.mjs +2 -0
  141. package/dist/esm/api/types/StepfunTtsParams.d.mts +13 -0
  142. package/dist/esm/api/types/StepfunTtsParams.mjs +2 -0
  143. package/dist/esm/api/types/TencentAsr.d.mts +10 -0
  144. package/dist/esm/api/types/TencentAsr.mjs +2 -0
  145. package/dist/esm/api/types/TencentAsrParams.d.mts +17 -0
  146. package/dist/esm/api/types/TencentAsrParams.mjs +2 -0
  147. package/dist/esm/api/types/TencentTts.d.mts +9 -0
  148. package/dist/esm/api/types/TencentTts.mjs +2 -0
  149. package/dist/esm/api/types/TencentTtsParams.d.mts +23 -0
  150. package/dist/esm/api/types/TencentTtsParams.mjs +2 -0
  151. package/dist/esm/api/types/Tts.d.mts +16 -1
  152. package/dist/esm/api/types/XfyunAsr.d.mts +10 -0
  153. package/dist/esm/api/types/XfyunAsr.mjs +2 -0
  154. package/dist/esm/api/types/XfyunAsrParams.d.mts +15 -0
  155. package/dist/esm/api/types/XfyunAsrParams.mjs +2 -0
  156. package/dist/esm/api/types/XfyunBigmodelAsr.d.mts +10 -0
  157. package/dist/esm/api/types/XfyunBigmodelAsr.mjs +2 -0
  158. package/dist/esm/api/types/XfyunBigmodelAsrParams.d.mts +17 -0
  159. package/dist/esm/api/types/XfyunBigmodelAsrParams.mjs +2 -0
  160. package/dist/esm/api/types/XfyunDialectAsr.d.mts +10 -0
  161. package/dist/esm/api/types/XfyunDialectAsr.mjs +2 -0
  162. package/dist/esm/api/types/XfyunDialectAsrParams.d.mts +15 -0
  163. package/dist/esm/api/types/XfyunDialectAsrParams.mjs +2 -0
  164. package/dist/esm/api/types/index.d.mts +20 -0
  165. package/dist/esm/api/types/index.mjs +20 -0
  166. package/dist/esm/core/domain/index.d.mts +2 -1
  167. package/dist/esm/core/domain/index.mjs +4 -2
  168. package/dist/esm/index.d.mts +3 -2
  169. package/dist/esm/index.mjs +6 -6
  170. package/package.json +1 -1
@@ -0,0 +1,251 @@
1
+ import type { AvatarConfig, LlmConfig, SttConfig, TtsConfig } from "../types.mjs";
2
+ import { BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, type BaseLlmOptions } from "./base.mjs";
3
+ export declare class FengmingSTT extends BaseCNSTT {
4
+ toConfig(): SttConfig;
5
+ }
6
+ export interface MicrosoftCNSTTOptions {
7
+ key: string;
8
+ region: string;
9
+ language: string;
10
+ phraseList?: string[];
11
+ additionalParams?: Record<string, unknown>;
12
+ }
13
+ export declare class MicrosoftCNSTT extends BaseCNSTT {
14
+ private readonly options;
15
+ constructor(options: MicrosoftCNSTTOptions);
16
+ toConfig(): SttConfig;
17
+ }
18
+ export interface TencentSTTOptions {
19
+ language?: string;
20
+ key: string;
21
+ appId: string;
22
+ secret: string;
23
+ engineModelType: string;
24
+ voiceId: string;
25
+ additionalParams?: Record<string, unknown>;
26
+ }
27
+ export declare class TencentSTT extends BaseCNSTT {
28
+ private readonly options;
29
+ constructor(options: TencentSTTOptions);
30
+ toConfig(): SttConfig;
31
+ }
32
+ export interface XfyunSTTOptions {
33
+ apiKey: string;
34
+ appId: string;
35
+ apiSecret: string;
36
+ language: string;
37
+ additionalParams?: Record<string, unknown>;
38
+ }
39
+ export declare class XfyunSTT extends BaseCNSTT {
40
+ private readonly options;
41
+ constructor(options: XfyunSTTOptions);
42
+ toConfig(): SttConfig;
43
+ }
44
+ export interface XfyunBigModelSTTOptions {
45
+ apiKey: string;
46
+ appId: string;
47
+ apiSecret: string;
48
+ languageName: string;
49
+ language: string;
50
+ additionalParams?: Record<string, unknown>;
51
+ }
52
+ export declare class XfyunBigModelSTT extends BaseCNSTT {
53
+ private readonly options;
54
+ constructor(options: XfyunBigModelSTTOptions);
55
+ toConfig(): SttConfig;
56
+ }
57
+ export interface XfyunDialectSTTOptions {
58
+ appId: string;
59
+ accessKeyId: string;
60
+ accessKeySecret: string;
61
+ language: string;
62
+ additionalParams?: Record<string, unknown>;
63
+ }
64
+ export declare class XfyunDialectSTT extends BaseCNSTT {
65
+ private readonly options;
66
+ constructor(options: XfyunDialectSTTOptions);
67
+ toConfig(): SttConfig;
68
+ }
69
+ export interface MiniMaxCNVoiceSetting {
70
+ voice_id: string;
71
+ speed?: number;
72
+ vol?: number;
73
+ pitch?: number;
74
+ emotion?: string;
75
+ latex_read?: boolean;
76
+ english_normalization?: boolean;
77
+ }
78
+ export interface MiniMaxCNAudioSetting {
79
+ sample_rate: number;
80
+ }
81
+ export interface MiniMaxCNPronunciationDict {
82
+ tone: string[];
83
+ }
84
+ export interface MiniMaxCNTimberWeight {
85
+ voice_id: string;
86
+ weight: number;
87
+ }
88
+ export interface MiniMaxCNTTSBaseOptions {
89
+ key: string;
90
+ model: string;
91
+ audioSetting?: MiniMaxCNAudioSetting;
92
+ pronunciationDict?: MiniMaxCNPronunciationDict;
93
+ languageBoost?: string;
94
+ skipPatterns?: number[];
95
+ additionalParams?: Record<string, unknown>;
96
+ }
97
+ export type MiniMaxCNTTSOptions = (MiniMaxCNTTSBaseOptions & {
98
+ voiceSetting: MiniMaxCNVoiceSetting;
99
+ timberWeights?: never;
100
+ }) | (MiniMaxCNTTSBaseOptions & {
101
+ voiceSetting?: never;
102
+ timberWeights: MiniMaxCNTimberWeight[];
103
+ });
104
+ export declare class MiniMaxCNTTS extends BaseCNTTS {
105
+ private readonly options;
106
+ constructor(options: MiniMaxCNTTSOptions);
107
+ toConfig(): TtsConfig;
108
+ }
109
+ export type MicrosoftCNSampleRate = 16000 | 24000 | 48000;
110
+ export interface MicrosoftCNTTSOptions<SR extends MicrosoftCNSampleRate = MicrosoftCNSampleRate> {
111
+ key: string;
112
+ region: string;
113
+ voiceName: string;
114
+ sampleRate?: SR;
115
+ speed?: number;
116
+ volume?: number;
117
+ skipPatterns?: number[];
118
+ additionalParams?: Record<string, unknown>;
119
+ }
120
+ export declare class MicrosoftCNTTS<SR extends MicrosoftCNSampleRate = MicrosoftCNSampleRate> extends BaseCNTTS<SR> {
121
+ private readonly options;
122
+ constructor(options: MicrosoftCNTTSOptions<SR>);
123
+ toConfig(): TtsConfig;
124
+ }
125
+ export interface TencentTTSOptions {
126
+ appId: string;
127
+ secretId: string;
128
+ secretKey: string;
129
+ voiceType: number;
130
+ volume?: number;
131
+ speed?: number;
132
+ emotionCategory?: string;
133
+ emotionIntensity?: number;
134
+ skipPatterns?: number[];
135
+ additionalParams?: Record<string, unknown>;
136
+ }
137
+ export declare class TencentTTS extends BaseCNTTS {
138
+ private readonly options;
139
+ constructor(options: TencentTTSOptions);
140
+ toConfig(): TtsConfig;
141
+ }
142
+ export interface BytedanceTTSOptions {
143
+ token: string;
144
+ appId: string;
145
+ cluster: string;
146
+ voiceType: string;
147
+ speedRatio?: number;
148
+ volumeRatio?: number;
149
+ pitchRatio?: number;
150
+ emotion?: string;
151
+ skipPatterns?: number[];
152
+ additionalParams?: Record<string, unknown>;
153
+ }
154
+ export declare class BytedanceTTS extends BaseCNTTS {
155
+ private readonly options;
156
+ constructor(options: BytedanceTTSOptions);
157
+ toConfig(): TtsConfig;
158
+ }
159
+ export interface CosyVoiceTTSOptions {
160
+ apiKey: string;
161
+ model: string;
162
+ sampleRate: number;
163
+ voice: string;
164
+ skipPatterns?: number[];
165
+ additionalParams?: Record<string, unknown>;
166
+ }
167
+ export declare class CosyVoiceTTS extends BaseCNTTS {
168
+ private readonly options;
169
+ constructor(options: CosyVoiceTTSOptions);
170
+ toConfig(): TtsConfig;
171
+ }
172
+ export interface BytedanceDuplexTTSOptions {
173
+ appId: string;
174
+ token: string;
175
+ speaker: string;
176
+ skipPatterns?: number[];
177
+ additionalParams?: Record<string, unknown>;
178
+ }
179
+ export declare class BytedanceDuplexTTS extends BaseCNTTS {
180
+ private readonly options;
181
+ constructor(options: BytedanceDuplexTTSOptions);
182
+ toConfig(): TtsConfig;
183
+ }
184
+ export interface StepFunTTSOptions {
185
+ apiKey: string;
186
+ model: string;
187
+ voiceId: string;
188
+ skipPatterns?: number[];
189
+ additionalParams?: Record<string, unknown>;
190
+ }
191
+ export declare class StepFunTTS extends BaseCNTTS {
192
+ private readonly options;
193
+ constructor(options: StepFunTTSOptions);
194
+ toConfig(): TtsConfig;
195
+ }
196
+ type CNLlmCommonOptions = BaseLlmOptions & {
197
+ apiKey?: string;
198
+ url: string;
199
+ model: string;
200
+ maxHistory?: number;
201
+ systemMessages?: Record<string, unknown>[];
202
+ greetingMessage?: string;
203
+ failureMessage?: string;
204
+ inputModalities?: string[];
205
+ params?: Record<string, unknown>;
206
+ headers?: Record<string, string>;
207
+ };
208
+ export interface AliyunLLMOptions extends CNLlmCommonOptions {
209
+ }
210
+ export declare class AliyunLLM extends BaseCNLLM {
211
+ private readonly options;
212
+ constructor(options: AliyunLLMOptions);
213
+ toConfig(): LlmConfig;
214
+ }
215
+ export interface BytedanceLLMOptions extends CNLlmCommonOptions {
216
+ }
217
+ export declare class BytedanceLLM extends BaseCNLLM {
218
+ private readonly options;
219
+ constructor(options: BytedanceLLMOptions);
220
+ toConfig(): LlmConfig;
221
+ }
222
+ export interface DeepSeekLLMOptions extends CNLlmCommonOptions {
223
+ }
224
+ export declare class DeepSeekLLM extends BaseCNLLM {
225
+ private readonly options;
226
+ constructor(options: DeepSeekLLMOptions);
227
+ toConfig(): LlmConfig;
228
+ }
229
+ export interface TencentLLMOptions extends CNLlmCommonOptions {
230
+ }
231
+ export declare class TencentLLM extends BaseCNLLM {
232
+ private readonly options;
233
+ constructor(options: TencentLLMOptions);
234
+ toConfig(): LlmConfig;
235
+ }
236
+ export interface SensetimeAvatarOptions {
237
+ agoraUid: string;
238
+ agoraToken?: string;
239
+ appId: string;
240
+ appKey: string;
241
+ sceneList: Record<string, unknown>[];
242
+ enable?: boolean;
243
+ additionalParams?: Record<string, unknown>;
244
+ }
245
+ export declare class SensetimeAvatar extends BaseCNAvatar<number> {
246
+ private readonly options;
247
+ readonly requiredSampleRate: number;
248
+ constructor(options: SensetimeAvatarOptions);
249
+ toConfig(): AvatarConfig;
250
+ }
251
+ export {};
@@ -0,0 +1,272 @@
1
+ import { BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS } from "./base.mjs";
2
+ function requireString(value, field, vendor) {
3
+ if (typeof value !== "string" || value.length === 0) {
4
+ throw new Error(`${vendor} requires ${field}`);
5
+ }
6
+ }
7
+ export class FengmingSTT extends BaseCNSTT {
8
+ toConfig() {
9
+ return {
10
+ vendor: "fengming",
11
+ };
12
+ }
13
+ }
14
+ export class MicrosoftCNSTT extends BaseCNSTT {
15
+ constructor(options) {
16
+ super();
17
+ this.options = options;
18
+ requireString(options.key, "key", "MicrosoftCNSTT");
19
+ requireString(options.region, "region", "MicrosoftCNSTT");
20
+ requireString(options.language, "language", "MicrosoftCNSTT");
21
+ }
22
+ toConfig() {
23
+ const { key, region, language, phraseList, additionalParams } = this.options;
24
+ return {
25
+ vendor: "microsoft",
26
+ params: Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
27
+ region,
28
+ language }), (phraseList && { phrase_list: phraseList })),
29
+ };
30
+ }
31
+ }
32
+ export class TencentSTT extends BaseCNSTT {
33
+ constructor(options) {
34
+ super();
35
+ this.options = options;
36
+ requireString(options.key, "key", "TencentSTT");
37
+ requireString(options.appId, "appId", "TencentSTT");
38
+ requireString(options.secret, "secret", "TencentSTT");
39
+ requireString(options.engineModelType, "engineModelType", "TencentSTT");
40
+ requireString(options.voiceId, "voiceId", "TencentSTT");
41
+ }
42
+ toConfig() {
43
+ const { language, key, appId, secret, engineModelType, voiceId, additionalParams } = this.options;
44
+ return {
45
+ vendor: "tencent",
46
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (key && { key })), (appId && { app_id: appId })), (secret && { secret })), (engineModelType && { engine_model_type: engineModelType })), (voiceId && { voice_id: voiceId })), (language && { language })),
47
+ };
48
+ }
49
+ }
50
+ export class XfyunSTT extends BaseCNSTT {
51
+ constructor(options) {
52
+ super();
53
+ this.options = options;
54
+ requireString(options.apiKey, "apiKey", "XfyunSTT");
55
+ requireString(options.appId, "appId", "XfyunSTT");
56
+ requireString(options.apiSecret, "apiSecret", "XfyunSTT");
57
+ requireString(options.language, "language", "XfyunSTT");
58
+ }
59
+ toConfig() {
60
+ const { apiKey, appId, apiSecret, language, additionalParams } = this.options;
61
+ return {
62
+ vendor: "xfyun",
63
+ params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, app_id: appId, api_secret: apiSecret }), (language && { language })),
64
+ };
65
+ }
66
+ }
67
+ export class XfyunBigModelSTT extends BaseCNSTT {
68
+ constructor(options) {
69
+ super();
70
+ this.options = options;
71
+ requireString(options.apiKey, "apiKey", "XfyunBigModelSTT");
72
+ requireString(options.appId, "appId", "XfyunBigModelSTT");
73
+ requireString(options.apiSecret, "apiSecret", "XfyunBigModelSTT");
74
+ requireString(options.languageName, "languageName", "XfyunBigModelSTT");
75
+ requireString(options.language, "language", "XfyunBigModelSTT");
76
+ }
77
+ toConfig() {
78
+ const { apiKey, appId, apiSecret, languageName, language, additionalParams } = this.options;
79
+ return {
80
+ vendor: "xfyun_bigmodel",
81
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, app_id: appId, api_secret: apiSecret }), (languageName && { language_name: languageName })), (language && { language })),
82
+ };
83
+ }
84
+ }
85
+ export class XfyunDialectSTT extends BaseCNSTT {
86
+ constructor(options) {
87
+ super();
88
+ this.options = options;
89
+ requireString(options.appId, "appId", "XfyunDialectSTT");
90
+ requireString(options.accessKeyId, "accessKeyId", "XfyunDialectSTT");
91
+ requireString(options.accessKeySecret, "accessKeySecret", "XfyunDialectSTT");
92
+ requireString(options.language, "language", "XfyunDialectSTT");
93
+ }
94
+ toConfig() {
95
+ const { appId, accessKeyId, accessKeySecret, language, additionalParams } = this.options;
96
+ return {
97
+ vendor: "xfyun_dialect",
98
+ params: Object.assign(Object.assign(Object.assign({}, additionalParams), { app_id: appId, access_key_id: accessKeyId, access_key_secret: accessKeySecret }), (language && { language })),
99
+ };
100
+ }
101
+ }
102
+ export class MiniMaxCNTTS extends BaseCNTTS {
103
+ constructor(options) {
104
+ super();
105
+ this.options = options;
106
+ requireString(options.key, "key", "MiniMaxCNTTS");
107
+ requireString(options.model, "model", "MiniMaxCNTTS");
108
+ if (options.voiceSetting) {
109
+ requireString(options.voiceSetting.voice_id, "voiceSetting.voice_id", "MiniMaxCNTTS");
110
+ }
111
+ else if (!options.timberWeights.length) {
112
+ throw new Error("MiniMaxCNTTS requires at least one timberWeight when voiceSetting is omitted");
113
+ }
114
+ }
115
+ toConfig() {
116
+ const { key, model, voiceSetting, audioSetting, pronunciationDict, timberWeights, languageBoost, skipPatterns, additionalParams, } = this.options;
117
+ return Object.assign({ vendor: "minimax", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (key && { key })), (model && { model })), (voiceSetting && { voice_setting: voiceSetting })), (audioSetting && { audio_setting: audioSetting })), (pronunciationDict && { pronunciation_dict: pronunciationDict })), (timberWeights && { timber_weights: timberWeights })), (languageBoost && { language_boost: languageBoost })) }, (skipPatterns && { skip_patterns: skipPatterns }));
118
+ }
119
+ }
120
+ export class MicrosoftCNTTS extends BaseCNTTS {
121
+ constructor(options) {
122
+ super();
123
+ this.options = options;
124
+ requireString(options.key, "key", "MicrosoftCNTTS");
125
+ requireString(options.region, "region", "MicrosoftCNTTS");
126
+ requireString(options.voiceName, "voiceName", "MicrosoftCNTTS");
127
+ }
128
+ toConfig() {
129
+ const { key, region, voiceName, sampleRate, speed, volume, skipPatterns, additionalParams } = this.options;
130
+ return Object.assign({ vendor: "microsoft", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
131
+ region, voice_name: voiceName }), (sampleRate !== undefined && { sample_rate: sampleRate })), (speed !== undefined && { speed })), (volume !== undefined && { volume })) }, (skipPatterns && { skip_patterns: skipPatterns }));
132
+ }
133
+ }
134
+ export class TencentTTS extends BaseCNTTS {
135
+ constructor(options) {
136
+ super();
137
+ this.options = options;
138
+ requireString(options.appId, "appId", "TencentTTS");
139
+ requireString(options.secretId, "secretId", "TencentTTS");
140
+ requireString(options.secretKey, "secretKey", "TencentTTS");
141
+ if (typeof options.voiceType !== "number" || Number.isNaN(options.voiceType)) {
142
+ throw new Error("TencentTTS requires voiceType");
143
+ }
144
+ }
145
+ toConfig() {
146
+ const { appId, secretId, secretKey, voiceType, volume, speed, emotionCategory, emotionIntensity, skipPatterns, additionalParams, } = this.options;
147
+ return Object.assign({ vendor: "tencent", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { app_id: appId, secret_id: secretId, secret_key: secretKey }), (voiceType !== undefined && { voice_type: voiceType })), (volume !== undefined && { volume })), (speed !== undefined && { speed })), (emotionCategory && { emotion_category: emotionCategory })), (emotionIntensity !== undefined && { emotion_intensity: emotionIntensity })) }, (skipPatterns && { skip_patterns: skipPatterns }));
148
+ }
149
+ }
150
+ export class BytedanceTTS extends BaseCNTTS {
151
+ constructor(options) {
152
+ super();
153
+ this.options = options;
154
+ requireString(options.token, "token", "BytedanceTTS");
155
+ requireString(options.appId, "appId", "BytedanceTTS");
156
+ requireString(options.cluster, "cluster", "BytedanceTTS");
157
+ requireString(options.voiceType, "voiceType", "BytedanceTTS");
158
+ }
159
+ toConfig() {
160
+ const { token, appId, cluster, voiceType, speedRatio, volumeRatio, pitchRatio, emotion, skipPatterns, additionalParams, } = this.options;
161
+ return Object.assign({ vendor: "bytedance", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { token, app_id: appId }), (cluster && { cluster })), (voiceType && { voice_type: voiceType })), (speedRatio !== undefined && { speed_ratio: speedRatio })), (volumeRatio !== undefined && { volume_ratio: volumeRatio })), (pitchRatio !== undefined && { pitch_ratio: pitchRatio })), (emotion && { emotion })) }, (skipPatterns && { skip_patterns: skipPatterns }));
162
+ }
163
+ }
164
+ export class CosyVoiceTTS extends BaseCNTTS {
165
+ constructor(options) {
166
+ super();
167
+ this.options = options;
168
+ requireString(options.apiKey, "apiKey", "CosyVoiceTTS");
169
+ requireString(options.model, "model", "CosyVoiceTTS");
170
+ if (typeof options.sampleRate !== "number" || Number.isNaN(options.sampleRate)) {
171
+ throw new Error("CosyVoiceTTS requires sampleRate");
172
+ }
173
+ requireString(options.voice, "voice", "CosyVoiceTTS");
174
+ }
175
+ toConfig() {
176
+ const { apiKey, model, sampleRate, voice, skipPatterns, additionalParams } = this.options;
177
+ return Object.assign({ vendor: "cosyvoice", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (model && { model })), (sampleRate !== undefined && { sample_rate: sampleRate })), (voice && { voice })) }, (skipPatterns && { skip_patterns: skipPatterns }));
178
+ }
179
+ }
180
+ export class BytedanceDuplexTTS extends BaseCNTTS {
181
+ constructor(options) {
182
+ super();
183
+ this.options = options;
184
+ requireString(options.appId, "appId", "BytedanceDuplexTTS");
185
+ requireString(options.token, "token", "BytedanceDuplexTTS");
186
+ requireString(options.speaker, "speaker", "BytedanceDuplexTTS");
187
+ }
188
+ toConfig() {
189
+ const { appId, token, speaker, skipPatterns, additionalParams } = this.options;
190
+ return Object.assign({ vendor: "bytedance_duplex", params: Object.assign(Object.assign({}, additionalParams), { app_id: appId, token,
191
+ speaker }) }, (skipPatterns && { skip_patterns: skipPatterns }));
192
+ }
193
+ }
194
+ export class StepFunTTS extends BaseCNTTS {
195
+ constructor(options) {
196
+ super();
197
+ this.options = options;
198
+ requireString(options.apiKey, "apiKey", "StepFunTTS");
199
+ requireString(options.model, "model", "StepFunTTS");
200
+ requireString(options.voiceId, "voiceId", "StepFunTTS");
201
+ }
202
+ toConfig() {
203
+ const { apiKey, model, voiceId, skipPatterns, additionalParams } = this.options;
204
+ return Object.assign({ vendor: "stepfun", params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (model && { model })), (voiceId && { voice_id: voiceId })) }, (skipPatterns && { skip_patterns: skipPatterns }));
205
+ }
206
+ }
207
+ function cnLlmConfig(options, vendor) {
208
+ var _a;
209
+ return Object.assign(Object.assign({ url: options.url }, (options.apiKey && { api_key: options.apiKey })), { params: Object.assign({ model: options.model }, options.params), headers: options.headers, max_history: options.maxHistory, system_messages: options.systemMessages, greeting_message: options.greetingMessage, failure_message: options.failureMessage, input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"], output_modalities: options.outputModalities, style: "openai", vendor, greeting_configs: options.greetingConfigs, template_variables: options.templateVariables, mcp_servers: options.mcpServers });
210
+ }
211
+ export class AliyunLLM extends BaseCNLLM {
212
+ constructor(options) {
213
+ super(options);
214
+ this.options = options;
215
+ requireString(options.url, "url", "AliyunLLM");
216
+ requireString(options.model, "model", "AliyunLLM");
217
+ }
218
+ toConfig() {
219
+ return cnLlmConfig(this.options, "aliyun");
220
+ }
221
+ }
222
+ export class BytedanceLLM extends BaseCNLLM {
223
+ constructor(options) {
224
+ super(options);
225
+ this.options = options;
226
+ requireString(options.url, "url", "BytedanceLLM");
227
+ requireString(options.model, "model", "BytedanceLLM");
228
+ }
229
+ toConfig() {
230
+ return cnLlmConfig(this.options, "bytedance");
231
+ }
232
+ }
233
+ export class DeepSeekLLM extends BaseCNLLM {
234
+ constructor(options) {
235
+ super(options);
236
+ this.options = options;
237
+ requireString(options.url, "url", "DeepSeekLLM");
238
+ requireString(options.model, "model", "DeepSeekLLM");
239
+ }
240
+ toConfig() {
241
+ return cnLlmConfig(this.options, "deepseek");
242
+ }
243
+ }
244
+ export class TencentLLM extends BaseCNLLM {
245
+ constructor(options) {
246
+ super(options);
247
+ this.options = options;
248
+ requireString(options.url, "url", "TencentLLM");
249
+ requireString(options.model, "model", "TencentLLM");
250
+ }
251
+ toConfig() {
252
+ return cnLlmConfig(this.options, "tencent");
253
+ }
254
+ }
255
+ export class SensetimeAvatar extends BaseCNAvatar {
256
+ constructor(options) {
257
+ super();
258
+ this.options = options;
259
+ this.requiredSampleRate = 0;
260
+ requireString(options.agoraUid, "agoraUid", "SensetimeAvatar");
261
+ requireString(options.appId, "appId", "SensetimeAvatar");
262
+ requireString(options.appKey, "appKey", "SensetimeAvatar");
263
+ }
264
+ toConfig() {
265
+ const { agoraUid, agoraToken, appId, appKey, sceneList, enable = true, additionalParams } = this.options;
266
+ return {
267
+ enable,
268
+ vendor: "sensetime",
269
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey, sceneList }),
270
+ };
271
+ }
272
+ }
@@ -43,7 +43,8 @@ export interface OpenAIRealtimeOptions {
43
43
  *
44
44
  * @example
45
45
  * ```typescript
46
- * const agent = new Agent({ name: 'realtime-assistant' })
46
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
47
+ * const agent = new Agent({ client })
47
48
  * .withMllm(new OpenAIRealtime({
48
49
  * apiKey: process.env.OPENAI_API_KEY,
49
50
  * greetingMessage: 'Hello! How can I help you?',
@@ -96,7 +97,8 @@ export interface GeminiLiveOptions {
96
97
  *
97
98
  * @example
98
99
  * ```typescript
99
- * const agent = new Agent({ name: 'gemini-assistant' })
100
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
101
+ * const agent = new Agent({ client })
100
102
  * .withMllm(new GeminiLive({
101
103
  * apiKey: process.env.GOOGLE_API_KEY,
102
104
  * model: 'gemini-live-2.5-flash',
@@ -152,7 +154,8 @@ export interface VertexAIOptions {
152
154
  *
153
155
  * @example
154
156
  * ```typescript
155
- * const agent = new Agent({ name: 'gemini-assistant' })
157
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
158
+ * const agent = new Agent({ client })
156
159
  * .withMllm(new VertexAI({
157
160
  * model: 'gemini-live-2.5-flash-preview-native-audio-09-2025',
158
161
  * projectId: process.env.GOOGLE_PROJECT_ID,
@@ -206,7 +209,8 @@ export interface XaiGrokOptions {
206
209
  *
207
210
  * @example
208
211
  * ```typescript
209
- * const agent = new Agent({ name: 'grok-assistant' })
212
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
213
+ * const agent = new Agent({ client })
210
214
  * .withMllm(new XaiGrok({
211
215
  * apiKey: process.env.XAI_API_KEY,
212
216
  * voice: 'eve',
@@ -11,7 +11,8 @@ import { BaseMLLM } from "./base.mjs";
11
11
  *
12
12
  * @example
13
13
  * ```typescript
14
- * const agent = new Agent({ name: 'realtime-assistant' })
14
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
15
+ * const agent = new Agent({ client })
15
16
  * .withMllm(new OpenAIRealtime({
16
17
  * apiKey: process.env.OPENAI_API_KEY,
17
18
  * greetingMessage: 'Hello! How can I help you?',
@@ -45,7 +46,8 @@ export class OpenAIRealtime extends BaseMLLM {
45
46
  *
46
47
  * @example
47
48
  * ```typescript
48
- * const agent = new Agent({ name: 'gemini-assistant' })
49
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
50
+ * const agent = new Agent({ client })
49
51
  * .withMllm(new GeminiLive({
50
52
  * apiKey: process.env.GOOGLE_API_KEY,
51
53
  * model: 'gemini-live-2.5-flash',
@@ -68,7 +70,8 @@ export class GeminiLive extends BaseMLLM {
68
70
  *
69
71
  * @example
70
72
  * ```typescript
71
- * const agent = new Agent({ name: 'gemini-assistant' })
73
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
74
+ * const agent = new Agent({ client })
72
75
  * .withMllm(new VertexAI({
73
76
  * model: 'gemini-live-2.5-flash-preview-native-audio-09-2025',
74
77
  * projectId: process.env.GOOGLE_PROJECT_ID,
@@ -98,7 +101,8 @@ export class VertexAI extends BaseMLLM {
98
101
  *
99
102
  * @example
100
103
  * ```typescript
101
- * const agent = new Agent({ name: 'grok-assistant' })
104
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
105
+ * const agent = new Agent({ client })
102
106
  * .withMllm(new XaiGrok({
103
107
  * apiKey: process.env.XAI_API_KEY,
104
108
  * voice: 'eve',
@@ -3,6 +3,11 @@
3
3
  */
4
4
  import { DeepgramPresetModels } from "../presets.mjs";
5
5
  import { BaseSTT } from "./base.mjs";
6
+ function _requireString(value, field, vendor) {
7
+ if (typeof value !== "string" || value.length === 0) {
8
+ throw new Error(`${vendor} requires ${field}`);
9
+ }
10
+ }
6
11
  function isDeepgramManagedModel(model) {
7
12
  return model !== undefined && DeepgramPresetModels.includes(model.trim().toLowerCase());
8
13
  }
@@ -386,13 +386,13 @@ type MiniMaxTTSCommonOptions = {
386
386
  /** MiniMax API key. Optional only for AgentKit-supported Agora-managed models. */
387
387
  key?: string;
388
388
  /** MiniMax group identifier */
389
- groupId: string;
389
+ groupId?: string;
390
390
  /** TTS model (e.g., 'speech-02-turbo') */
391
391
  model: string;
392
392
  /** Voice style identifier (e.g., 'English_captivating_female1') */
393
- voiceId: string;
393
+ voiceId?: string;
394
394
  /** WebSocket endpoint (e.g., 'wss://api-uw.minimax.io/ws/v1/t2a_v2') */
395
- url: string;
395
+ url?: string;
396
396
  /** Skip patterns for bracketed content */
397
397
  skipPatterns?: number[];
398
398
  };
@@ -172,6 +172,7 @@ export declare namespace StartAgentsRequest {
172
172
  * - `liveavatar`: LiveAvatar (Beta)
173
173
  * - `anam`: Anam (Beta)
174
174
  * - `generic`: Generic (Beta)
175
+ * - `sensetime`: SenseTime Avatar
175
176
  */
176
177
  vendor?: Avatar.Vendor;
177
178
  /** The configuration parameters for the avatar vendor. See [AI Avatar Overview](https://docs.agora.io/en/conversational-ai/models/avatar/overview) for details. */
@@ -184,6 +185,7 @@ export declare namespace StartAgentsRequest {
184
185
  * - `liveavatar`: LiveAvatar (Beta)
185
186
  * - `anam`: Anam (Beta)
186
187
  * - `generic`: Generic (Beta)
188
+ * - `sensetime`: SenseTime Avatar
187
189
  */
188
190
  const Vendor: {
189
191
  readonly Akool: "akool";
@@ -194,6 +196,9 @@ export declare namespace StartAgentsRequest {
194
196
  /**
195
197
  * Generic avatar (Beta) */
196
198
  readonly Generic: "generic";
199
+ /**
200
+ * SenseTime Avatar */
201
+ readonly Sensetime: "sensetime";
197
202
  /**
198
203
  * Deprecated: HeyGen has renamed to LiveAvatar. Use `liveavatar` instead. */
199
204
  readonly Heygen: "heygen";
@@ -204,8 +209,6 @@ export declare namespace StartAgentsRequest {
204
209
  * Conversation turn detection settings. Controls the logic for voice activity detection and conversation turn determination. This object has no effect when `mllm.enable` is true; use `mllm.turn_detection` instead.
205
210
  */
206
211
  interface TurnDetection {
207
- /** BCP-47 language tag identifying the primary language used for agent interaction. */
208
- language?: Agora.AsrLanguage;
209
212
  /**
210
213
  * Conversation turn detection mode:
211
214
  * - `default`: Uses standard conversation turn detection configuration.