agora-agents 2.1.1 → 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.
- package/README.md +49 -27
- package/dist/cjs/AgoraPoolClient.d.ts +9 -6
- package/dist/cjs/AgoraPoolClient.js +1 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/agentkit/Agent.d.ts +52 -51
- package/dist/cjs/agentkit/Agent.js +51 -51
- package/dist/cjs/agentkit/AgentSession.d.ts +11 -9
- package/dist/cjs/agentkit/AgentSession.js +10 -5
- package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.d.ts +1 -0
- package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +57 -0
- package/dist/cjs/agentkit/__tests__/readme-examples.test.d.ts +1 -0
- package/dist/cjs/agentkit/__tests__/readme-examples.test.js +126 -0
- package/dist/cjs/agentkit/__tests__/type-safety.test.js +24 -17
- package/dist/cjs/agentkit/area.d.ts +4 -0
- package/dist/cjs/agentkit/area.js +2 -0
- package/dist/cjs/agentkit/avatar-types.d.ts +28 -2
- package/dist/cjs/agentkit/avatar-types.js +24 -2
- package/dist/cjs/agentkit/index.d.ts +8 -5
- package/dist/cjs/agentkit/index.js +27 -2
- package/dist/cjs/agentkit/presets.js +11 -4
- package/dist/cjs/agentkit/region-vendors.d.ts +15 -0
- package/dist/cjs/agentkit/region-vendors.js +2 -0
- package/dist/cjs/agentkit/token.d.ts +3 -2
- package/dist/cjs/agentkit/token.js +3 -2
- package/dist/cjs/agentkit/types.d.ts +29 -6
- package/dist/cjs/agentkit/vendors/avatar.d.ts +9 -4
- package/dist/cjs/agentkit/vendors/avatar.js +6 -3
- package/dist/cjs/agentkit/vendors/base.d.ts +38 -5
- package/dist/cjs/agentkit/vendors/base.js +60 -6
- package/dist/cjs/agentkit/vendors/cn.d.ts +251 -0
- package/dist/cjs/agentkit/vendors/cn.js +293 -0
- package/dist/cjs/agentkit/vendors/llm.d.ts +4 -2
- package/dist/cjs/agentkit/vendors/llm.js +10 -5
- package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
- package/dist/cjs/agentkit/vendors/mllm.js +8 -4
- package/dist/cjs/agentkit/vendors/stt.d.ts +4 -6
- package/dist/cjs/agentkit/vendors/stt.js +48 -62
- package/dist/cjs/agentkit/vendors/tts.d.ts +3 -3
- package/dist/cjs/agentkit/vendors/tts.js +1 -1
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +5 -2
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +4 -0
- package/dist/cjs/api/types/Asr.d.ts +16 -1
- package/dist/cjs/api/types/BytedanceDuplexTts.d.ts +9 -0
- package/dist/cjs/api/types/BytedanceDuplexTts.js +3 -0
- package/dist/cjs/api/types/BytedanceDuplexTtsParams.d.ts +13 -0
- package/dist/cjs/api/types/BytedanceDuplexTtsParams.js +3 -0
- package/dist/cjs/api/types/BytedanceTts.d.ts +9 -0
- package/dist/cjs/api/types/BytedanceTts.js +3 -0
- package/dist/cjs/api/types/BytedanceTtsParams.d.ts +23 -0
- package/dist/cjs/api/types/BytedanceTtsParams.js +3 -0
- package/dist/cjs/api/types/CosyvoiceTts.d.ts +9 -0
- package/dist/cjs/api/types/CosyvoiceTts.js +3 -0
- package/dist/cjs/api/types/CosyvoiceTtsParams.d.ts +15 -0
- package/dist/cjs/api/types/CosyvoiceTtsParams.js +3 -0
- package/dist/cjs/api/types/DeepgramAsr.d.ts +0 -2
- package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
- package/dist/cjs/api/types/FengmingAsr.d.ts +11 -0
- package/dist/cjs/api/types/FengmingAsr.js +3 -0
- package/dist/cjs/api/types/MinimaxTtsParams.d.ts +52 -3
- package/dist/cjs/api/types/SensetimeAvatarParams.d.ts +48 -0
- package/dist/cjs/api/types/SensetimeAvatarParams.js +3 -0
- package/dist/cjs/api/types/StepfunTts.d.ts +9 -0
- package/dist/cjs/api/types/StepfunTts.js +3 -0
- package/dist/cjs/api/types/StepfunTtsParams.d.ts +13 -0
- package/dist/cjs/api/types/StepfunTtsParams.js +3 -0
- package/dist/cjs/api/types/TencentAsr.d.ts +10 -0
- package/dist/cjs/api/types/TencentAsr.js +3 -0
- package/dist/cjs/api/types/TencentAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/TencentAsrParams.js +3 -0
- package/dist/cjs/api/types/TencentTts.d.ts +9 -0
- package/dist/cjs/api/types/TencentTts.js +3 -0
- package/dist/cjs/api/types/TencentTtsParams.d.ts +23 -0
- package/dist/cjs/api/types/TencentTtsParams.js +3 -0
- package/dist/cjs/api/types/Tts.d.ts +16 -1
- package/dist/cjs/api/types/XfyunAsr.d.ts +10 -0
- package/dist/cjs/api/types/XfyunAsr.js +3 -0
- package/dist/cjs/api/types/XfyunAsrParams.d.ts +15 -0
- package/dist/cjs/api/types/XfyunAsrParams.js +3 -0
- package/dist/cjs/api/types/XfyunBigmodelAsr.d.ts +10 -0
- package/dist/cjs/api/types/XfyunBigmodelAsr.js +3 -0
- package/dist/cjs/api/types/XfyunBigmodelAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/XfyunBigmodelAsrParams.js +3 -0
- package/dist/cjs/api/types/XfyunDialectAsr.d.ts +10 -0
- package/dist/cjs/api/types/XfyunDialectAsr.js +3 -0
- package/dist/cjs/api/types/XfyunDialectAsrParams.d.ts +15 -0
- package/dist/cjs/api/types/XfyunDialectAsrParams.js +3 -0
- package/dist/cjs/api/types/index.d.ts +20 -0
- package/dist/cjs/api/types/index.js +20 -0
- package/dist/cjs/core/domain/index.d.ts +2 -1
- package/dist/cjs/core/domain/index.js +5 -3
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.js +26 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.d.mts +9 -6
- package/dist/esm/AgoraPoolClient.mjs +1 -0
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/agentkit/Agent.d.mts +52 -51
- package/dist/esm/agentkit/Agent.mjs +51 -51
- package/dist/esm/agentkit/AgentSession.d.mts +11 -9
- package/dist/esm/agentkit/AgentSession.mjs +11 -6
- package/dist/esm/agentkit/__tests__/area-aware-vendors.test.d.mts +1 -0
- package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +55 -0
- package/dist/esm/agentkit/__tests__/readme-examples.test.d.mts +1 -0
- package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +124 -0
- package/dist/esm/agentkit/__tests__/type-safety.test.mjs +24 -17
- package/dist/esm/agentkit/area.d.mts +4 -0
- package/dist/esm/agentkit/area.mjs +1 -0
- package/dist/esm/agentkit/avatar-types.d.mts +28 -2
- package/dist/esm/agentkit/avatar-types.mjs +23 -2
- package/dist/esm/agentkit/index.d.mts +8 -5
- package/dist/esm/agentkit/index.mjs +3 -2
- package/dist/esm/agentkit/presets.mjs +11 -4
- package/dist/esm/agentkit/region-vendors.d.mts +15 -0
- package/dist/esm/agentkit/region-vendors.mjs +1 -0
- package/dist/esm/agentkit/token.d.mts +3 -2
- package/dist/esm/agentkit/token.mjs +3 -2
- package/dist/esm/agentkit/types.d.mts +29 -6
- package/dist/esm/agentkit/vendors/avatar.d.mts +9 -4
- package/dist/esm/agentkit/vendors/avatar.mjs +6 -3
- package/dist/esm/agentkit/vendors/base.d.mts +38 -5
- package/dist/esm/agentkit/vendors/base.mjs +55 -5
- package/dist/esm/agentkit/vendors/cn.d.mts +251 -0
- package/dist/esm/agentkit/vendors/cn.mjs +272 -0
- package/dist/esm/agentkit/vendors/llm.d.mts +4 -2
- package/dist/esm/agentkit/vendors/llm.mjs +10 -5
- package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
- package/dist/esm/agentkit/vendors/mllm.mjs +8 -4
- package/dist/esm/agentkit/vendors/stt.d.mts +4 -6
- package/dist/esm/agentkit/vendors/stt.mjs +48 -62
- package/dist/esm/agentkit/vendors/tts.d.mts +3 -3
- package/dist/esm/agentkit/vendors/tts.mjs +1 -1
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +5 -2
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +4 -0
- package/dist/esm/api/types/Asr.d.mts +16 -1
- package/dist/esm/api/types/BytedanceDuplexTts.d.mts +9 -0
- package/dist/esm/api/types/BytedanceDuplexTts.mjs +2 -0
- package/dist/esm/api/types/BytedanceDuplexTtsParams.d.mts +13 -0
- package/dist/esm/api/types/BytedanceDuplexTtsParams.mjs +2 -0
- package/dist/esm/api/types/BytedanceTts.d.mts +9 -0
- package/dist/esm/api/types/BytedanceTts.mjs +2 -0
- package/dist/esm/api/types/BytedanceTtsParams.d.mts +23 -0
- package/dist/esm/api/types/BytedanceTtsParams.mjs +2 -0
- package/dist/esm/api/types/CosyvoiceTts.d.mts +9 -0
- package/dist/esm/api/types/CosyvoiceTts.mjs +2 -0
- package/dist/esm/api/types/CosyvoiceTtsParams.d.mts +15 -0
- package/dist/esm/api/types/CosyvoiceTtsParams.mjs +2 -0
- package/dist/esm/api/types/DeepgramAsr.d.mts +0 -2
- package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
- package/dist/esm/api/types/FengmingAsr.d.mts +11 -0
- package/dist/esm/api/types/FengmingAsr.mjs +2 -0
- package/dist/esm/api/types/MinimaxTtsParams.d.mts +52 -3
- package/dist/esm/api/types/SensetimeAvatarParams.d.mts +48 -0
- package/dist/esm/api/types/SensetimeAvatarParams.mjs +2 -0
- package/dist/esm/api/types/StepfunTts.d.mts +9 -0
- package/dist/esm/api/types/StepfunTts.mjs +2 -0
- package/dist/esm/api/types/StepfunTtsParams.d.mts +13 -0
- package/dist/esm/api/types/StepfunTtsParams.mjs +2 -0
- package/dist/esm/api/types/TencentAsr.d.mts +10 -0
- package/dist/esm/api/types/TencentAsr.mjs +2 -0
- package/dist/esm/api/types/TencentAsrParams.d.mts +17 -0
- package/dist/esm/api/types/TencentAsrParams.mjs +2 -0
- package/dist/esm/api/types/TencentTts.d.mts +9 -0
- package/dist/esm/api/types/TencentTts.mjs +2 -0
- package/dist/esm/api/types/TencentTtsParams.d.mts +23 -0
- package/dist/esm/api/types/TencentTtsParams.mjs +2 -0
- package/dist/esm/api/types/Tts.d.mts +16 -1
- package/dist/esm/api/types/XfyunAsr.d.mts +10 -0
- package/dist/esm/api/types/XfyunAsr.mjs +2 -0
- package/dist/esm/api/types/XfyunAsrParams.d.mts +15 -0
- package/dist/esm/api/types/XfyunAsrParams.mjs +2 -0
- package/dist/esm/api/types/XfyunBigmodelAsr.d.mts +10 -0
- package/dist/esm/api/types/XfyunBigmodelAsr.mjs +2 -0
- package/dist/esm/api/types/XfyunBigmodelAsrParams.d.mts +17 -0
- package/dist/esm/api/types/XfyunBigmodelAsrParams.mjs +2 -0
- package/dist/esm/api/types/XfyunDialectAsr.d.mts +10 -0
- package/dist/esm/api/types/XfyunDialectAsr.mjs +2 -0
- package/dist/esm/api/types/XfyunDialectAsrParams.d.mts +15 -0
- package/dist/esm/api/types/XfyunDialectAsrParams.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +20 -0
- package/dist/esm/api/types/index.mjs +20 -0
- package/dist/esm/core/domain/index.d.mts +2 -1
- package/dist/esm/core/domain/index.mjs +4 -2
- package/dist/esm/index.d.mts +3 -2
- package/dist/esm/index.mjs +6 -6
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,26 @@ export type LlmStyle = Llm.Style;
|
|
|
13
13
|
* When using shorthand strings or minimal configs, the untyped variant is available.
|
|
14
14
|
*/
|
|
15
15
|
export type SttConfig = {
|
|
16
|
+
vendor: "fengming";
|
|
17
|
+
language?: TurnDetectionLanguage;
|
|
18
|
+
params?: Record<string, unknown>;
|
|
19
|
+
} | {
|
|
20
|
+
vendor: "tencent";
|
|
21
|
+
language?: TurnDetectionLanguage;
|
|
22
|
+
params?: Record<string, unknown>;
|
|
23
|
+
} | {
|
|
24
|
+
vendor: "xfyun";
|
|
25
|
+
language?: TurnDetectionLanguage;
|
|
26
|
+
params?: Record<string, unknown>;
|
|
27
|
+
} | {
|
|
28
|
+
vendor: "xfyun_bigmodel";
|
|
29
|
+
language?: TurnDetectionLanguage;
|
|
30
|
+
params?: Record<string, unknown>;
|
|
31
|
+
} | {
|
|
32
|
+
vendor: "xfyun_dialect";
|
|
33
|
+
language?: TurnDetectionLanguage;
|
|
34
|
+
params?: Record<string, unknown>;
|
|
35
|
+
} | {
|
|
16
36
|
vendor: "speechmatics";
|
|
17
37
|
language?: TurnDetectionLanguage;
|
|
18
38
|
params: SpeechmaticsParams;
|
|
@@ -51,8 +71,8 @@ export type SttConfig = {
|
|
|
51
71
|
} | Asr;
|
|
52
72
|
/** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
|
|
53
73
|
export type AsrConfig = SttConfig;
|
|
54
|
-
/**
|
|
55
|
-
export type
|
|
74
|
+
/** Wire ASR vendor identifier (e.g. `"deepgram"`, `"fengming"`). */
|
|
75
|
+
export type AsrVendorName = string;
|
|
56
76
|
/** TTS (Text-to-Speech) configuration - discriminated union */
|
|
57
77
|
export type TtsConfig = Tts;
|
|
58
78
|
/** MLLM (Multimodal LLM) configuration */
|
|
@@ -62,11 +82,14 @@ export type MllmVendor = Mllm.Vendor;
|
|
|
62
82
|
/** Avatar configuration */
|
|
63
83
|
export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
|
|
64
84
|
/** Avatar vendor (akool, liveavatar, anam, generic, deprecated heygen) */
|
|
65
|
-
|
|
85
|
+
/** Wire avatar vendor identifier (e.g. `"liveavatar"`, `"sensetime"`). */
|
|
86
|
+
export type AvatarWireVendor = StartAgentsRequest.Properties.Avatar.Vendor;
|
|
66
87
|
/** BCP-47 language tag used by `turn_detection.language`. */
|
|
67
88
|
export type TurnDetectionLanguage = AsrLanguage;
|
|
68
89
|
/** Turn detection configuration */
|
|
69
|
-
export type TurnDetectionConfig = StartAgentsRequest.Properties.TurnDetection
|
|
90
|
+
export type TurnDetectionConfig = Omit<StartAgentsRequest.Properties.TurnDetection, "language"> & {
|
|
91
|
+
language?: TurnDetectionLanguage;
|
|
92
|
+
};
|
|
70
93
|
/** Detailed nested config for turn detection (`turn_detection.config`) */
|
|
71
94
|
export type TurnDetectionNestedConfig = StartAgentsRequest.Properties.TurnDetection.Config;
|
|
72
95
|
/** Start of Speech (SoS) detection configuration (`turn_detection.config.start_of_speech`) */
|
|
@@ -189,9 +212,9 @@ export type McpServersItem = Record<string, unknown>;
|
|
|
189
212
|
export type AgentConfig = StartAgentsRequest.Properties;
|
|
190
213
|
/** Agent configuration update (for runtime updates) */
|
|
191
214
|
export type AgentConfigUpdate = UpdateAgentsRequest.Properties;
|
|
192
|
-
/** Options for creating a session */
|
|
215
|
+
/** Options for creating a session via {@link Agent.createSession} */
|
|
193
216
|
export interface SessionOptions {
|
|
194
|
-
/** Unique
|
|
217
|
+
/** Unique agent instance name sent to the Agora API. Omit to auto-generate `agent-{timestamp}`. */
|
|
195
218
|
name?: string;
|
|
196
219
|
/** The channel to join */
|
|
197
220
|
channel: string;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import type { AvatarConfig } from "../types.mjs";
|
|
8
8
|
import type { AkoolSampleRate, HeyGenSampleRate, LiveAvatarSampleRate } from "./base.mjs";
|
|
9
9
|
import { BaseAvatar } from "./base.mjs";
|
|
10
|
+
/**
|
|
11
|
+
* Constructor options for HeyGen Avatar.
|
|
10
12
|
/**
|
|
11
13
|
* Constructor options for LiveAvatar.
|
|
12
14
|
*/
|
|
@@ -19,7 +21,7 @@ export interface LiveAvatarAvatarOptions {
|
|
|
19
21
|
agoraUid: string;
|
|
20
22
|
/** Avatar ConvoAI token. Omit to auto-generate at session start. */
|
|
21
23
|
agoraToken?: string;
|
|
22
|
-
/**
|
|
24
|
+
/** HeyGen avatar ID */
|
|
23
25
|
avatarId?: string;
|
|
24
26
|
/** Whether to disable idle timeout (default: false) */
|
|
25
27
|
disableIdleTimeout?: boolean;
|
|
@@ -67,7 +69,8 @@ export interface AkoolAvatarOptions {
|
|
|
67
69
|
* sampleRate: 16000, // Required for Akool
|
|
68
70
|
* });
|
|
69
71
|
*
|
|
70
|
-
* const
|
|
72
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
73
|
+
* const agent = new Agent({ client })
|
|
71
74
|
* .withTts(tts)
|
|
72
75
|
* .withAvatar(avatar);
|
|
73
76
|
* ```
|
|
@@ -108,7 +111,8 @@ export declare class AkoolAvatar extends BaseAvatar<AkoolSampleRate> {
|
|
|
108
111
|
* sampleRate: 24000, // Required for LiveAvatar
|
|
109
112
|
* });
|
|
110
113
|
*
|
|
111
|
-
* const
|
|
114
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
115
|
+
* const agent = new Agent({ client })
|
|
112
116
|
* .withTts(tts)
|
|
113
117
|
* .withAvatar(avatar);
|
|
114
118
|
* ```
|
|
@@ -166,7 +170,8 @@ export interface AnamAvatarOptions {
|
|
|
166
170
|
* personaId: 'persona-id',
|
|
167
171
|
* });
|
|
168
172
|
*
|
|
169
|
-
* const
|
|
173
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
174
|
+
* const agent = new Agent({ client })
|
|
170
175
|
* .withAvatar(avatar);
|
|
171
176
|
* ```
|
|
172
177
|
*
|
|
@@ -29,7 +29,8 @@ import { BaseAvatar } from "./base.mjs";
|
|
|
29
29
|
* sampleRate: 16000, // Required for Akool
|
|
30
30
|
* });
|
|
31
31
|
*
|
|
32
|
-
* const
|
|
32
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
33
|
+
* const agent = new Agent({ client })
|
|
33
34
|
* .withTts(tts)
|
|
34
35
|
* .withAvatar(avatar);
|
|
35
36
|
* ```
|
|
@@ -87,7 +88,8 @@ export class AkoolAvatar extends BaseAvatar {
|
|
|
87
88
|
* sampleRate: 24000, // Required for LiveAvatar
|
|
88
89
|
* });
|
|
89
90
|
*
|
|
90
|
-
* const
|
|
91
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
92
|
+
* const agent = new Agent({ client })
|
|
91
93
|
* .withTts(tts)
|
|
92
94
|
* .withAvatar(avatar);
|
|
93
95
|
* ```
|
|
@@ -166,7 +168,8 @@ export class HeyGenAvatar extends BaseAvatar {
|
|
|
166
168
|
* personaId: 'persona-id',
|
|
167
169
|
* });
|
|
168
170
|
*
|
|
169
|
-
* const
|
|
171
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
172
|
+
* const agent = new Agent({ client })
|
|
170
173
|
* .withAvatar(avatar);
|
|
171
174
|
* ```
|
|
172
175
|
*
|
|
@@ -43,6 +43,7 @@ export interface BaseLlmOptions {
|
|
|
43
43
|
/** MCP server configurations enabling the agent to call tools from external services */
|
|
44
44
|
mcpServers?: McpServersItem[];
|
|
45
45
|
}
|
|
46
|
+
type VendorScope = "global" | "cn";
|
|
46
47
|
/**
|
|
47
48
|
* Standard audio sample rates supported by Agora platform.
|
|
48
49
|
* Different vendors support different subsets of these rates.
|
|
@@ -82,13 +83,14 @@ export type AkoolSampleRate = 16000;
|
|
|
82
83
|
/**
|
|
83
84
|
* Base class for LLM (Large Language Model) vendors.
|
|
84
85
|
*/
|
|
85
|
-
|
|
86
|
+
declare abstract class ScopedBaseLLM<TScope extends VendorScope> {
|
|
87
|
+
readonly areaScope: TScope;
|
|
86
88
|
private readonly _outputModalities?;
|
|
87
89
|
private readonly _greetingConfigs?;
|
|
88
90
|
private readonly _templateVariables?;
|
|
89
91
|
private readonly _vendor?;
|
|
90
92
|
private readonly _mcpServers?;
|
|
91
|
-
constructor(options?: BaseLlmOptions);
|
|
93
|
+
constructor(areaScope: TScope, options?: BaseLlmOptions);
|
|
92
94
|
protected get outputModalities(): string[] | undefined;
|
|
93
95
|
protected get greetingConfigs(): LlmGreetingConfigs | undefined;
|
|
94
96
|
protected get templateVariables(): Record<string, string> | undefined;
|
|
@@ -100,6 +102,12 @@ export declare abstract class BaseLLM {
|
|
|
100
102
|
*/
|
|
101
103
|
abstract toConfig(): LlmConfig;
|
|
102
104
|
}
|
|
105
|
+
export declare abstract class BaseLLM extends ScopedBaseLLM<"global"> {
|
|
106
|
+
constructor(options?: BaseLlmOptions);
|
|
107
|
+
}
|
|
108
|
+
export declare abstract class BaseCNLLM extends ScopedBaseLLM<"cn"> {
|
|
109
|
+
constructor(options?: BaseLlmOptions);
|
|
110
|
+
}
|
|
103
111
|
/**
|
|
104
112
|
* Base class for TTS (Text-to-Speech) vendors with sample rate tracking.
|
|
105
113
|
*
|
|
@@ -117,21 +125,37 @@ export declare abstract class BaseLLM {
|
|
|
117
125
|
*
|
|
118
126
|
* @template SR - Sample rate literal type (e.g., 24000, 16000)
|
|
119
127
|
*/
|
|
120
|
-
|
|
128
|
+
declare abstract class ScopedBaseTTS<TScope extends VendorScope, _SR extends number = number> {
|
|
129
|
+
readonly areaScope: TScope;
|
|
130
|
+
constructor(areaScope: TScope);
|
|
121
131
|
/**
|
|
122
132
|
* Converts the vendor configuration to the Agora API format.
|
|
123
133
|
*/
|
|
124
134
|
abstract toConfig(): TtsConfig;
|
|
125
135
|
}
|
|
136
|
+
export declare abstract class BaseTTS<_SR extends number = number> extends ScopedBaseTTS<"global", _SR> {
|
|
137
|
+
constructor();
|
|
138
|
+
}
|
|
139
|
+
export declare abstract class BaseCNTTS<_SR extends number = number> extends ScopedBaseTTS<"cn", _SR> {
|
|
140
|
+
constructor();
|
|
141
|
+
}
|
|
126
142
|
/**
|
|
127
143
|
* Base class for STT (Speech-to-Text) vendors.
|
|
128
144
|
*/
|
|
129
|
-
|
|
145
|
+
declare abstract class ScopedBaseSTT<TScope extends VendorScope> {
|
|
146
|
+
readonly areaScope: TScope;
|
|
147
|
+
constructor(areaScope: TScope);
|
|
130
148
|
/**
|
|
131
149
|
* Converts the vendor configuration to the Agora API format.
|
|
132
150
|
*/
|
|
133
151
|
abstract toConfig(): SttConfig;
|
|
134
152
|
}
|
|
153
|
+
export declare abstract class BaseSTT extends ScopedBaseSTT<"global"> {
|
|
154
|
+
constructor();
|
|
155
|
+
}
|
|
156
|
+
export declare abstract class BaseCNSTT extends ScopedBaseSTT<"cn"> {
|
|
157
|
+
constructor();
|
|
158
|
+
}
|
|
135
159
|
/**
|
|
136
160
|
* Base class for MLLM (Multimodal Large Language Model) vendors.
|
|
137
161
|
*/
|
|
@@ -145,7 +169,9 @@ export declare abstract class BaseMLLM {
|
|
|
145
169
|
* Base class for Avatar vendors with required sample rate.
|
|
146
170
|
* @template RequiredSR - Required sample rate literal type
|
|
147
171
|
*/
|
|
148
|
-
|
|
172
|
+
declare abstract class ScopedBaseAvatar<TScope extends VendorScope, RequiredSR extends number = number> {
|
|
173
|
+
readonly areaScope: TScope;
|
|
174
|
+
constructor(areaScope: TScope);
|
|
149
175
|
/**
|
|
150
176
|
* Converts the vendor configuration to the Agora API format.
|
|
151
177
|
*/
|
|
@@ -155,3 +181,10 @@ export declare abstract class BaseAvatar<RequiredSR extends number = number> {
|
|
|
155
181
|
*/
|
|
156
182
|
abstract readonly requiredSampleRate: RequiredSR;
|
|
157
183
|
}
|
|
184
|
+
export declare abstract class BaseAvatar<RequiredSR extends number = number> extends ScopedBaseAvatar<"global", RequiredSR> {
|
|
185
|
+
constructor();
|
|
186
|
+
}
|
|
187
|
+
export declare abstract class BaseCNAvatar<RequiredSR extends number = number> extends ScopedBaseAvatar<"cn", RequiredSR> {
|
|
188
|
+
constructor();
|
|
189
|
+
}
|
|
190
|
+
export {};
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Base class for LLM (Large Language Model) vendors.
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
constructor(options) {
|
|
11
|
+
class ScopedBaseLLM {
|
|
12
|
+
constructor(areaScope, options) {
|
|
13
|
+
this.areaScope = areaScope;
|
|
13
14
|
this._outputModalities = options === null || options === void 0 ? void 0 : options.outputModalities;
|
|
14
15
|
this._greetingConfigs = options === null || options === void 0 ? void 0 : options.greetingConfigs;
|
|
15
16
|
this._templateVariables = options === null || options === void 0 ? void 0 : options.templateVariables;
|
|
@@ -36,6 +37,16 @@ export class BaseLLM {
|
|
|
36
37
|
return this._mcpServers.map((s) => (s.transport ? s : Object.assign(Object.assign({}, s), { transport: "streamable_http" })));
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
export class BaseLLM extends ScopedBaseLLM {
|
|
41
|
+
constructor(options) {
|
|
42
|
+
super("global", options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class BaseCNLLM extends ScopedBaseLLM {
|
|
46
|
+
constructor(options) {
|
|
47
|
+
super("cn", options);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
39
50
|
/**
|
|
40
51
|
* Base class for TTS (Text-to-Speech) vendors with sample rate tracking.
|
|
41
52
|
*
|
|
@@ -53,12 +64,38 @@ export class BaseLLM {
|
|
|
53
64
|
*
|
|
54
65
|
* @template SR - Sample rate literal type (e.g., 24000, 16000)
|
|
55
66
|
*/
|
|
56
|
-
|
|
67
|
+
class ScopedBaseTTS {
|
|
68
|
+
constructor(areaScope) {
|
|
69
|
+
this.areaScope = areaScope;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class BaseTTS extends ScopedBaseTTS {
|
|
73
|
+
constructor() {
|
|
74
|
+
super("global");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export class BaseCNTTS extends ScopedBaseTTS {
|
|
78
|
+
constructor() {
|
|
79
|
+
super("cn");
|
|
80
|
+
}
|
|
57
81
|
}
|
|
58
82
|
/**
|
|
59
83
|
* Base class for STT (Speech-to-Text) vendors.
|
|
60
84
|
*/
|
|
61
|
-
|
|
85
|
+
class ScopedBaseSTT {
|
|
86
|
+
constructor(areaScope) {
|
|
87
|
+
this.areaScope = areaScope;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export class BaseSTT extends ScopedBaseSTT {
|
|
91
|
+
constructor() {
|
|
92
|
+
super("global");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export class BaseCNSTT extends ScopedBaseSTT {
|
|
96
|
+
constructor() {
|
|
97
|
+
super("cn");
|
|
98
|
+
}
|
|
62
99
|
}
|
|
63
100
|
/**
|
|
64
101
|
* Base class for MLLM (Multimodal Large Language Model) vendors.
|
|
@@ -69,5 +106,18 @@ export class BaseMLLM {
|
|
|
69
106
|
* Base class for Avatar vendors with required sample rate.
|
|
70
107
|
* @template RequiredSR - Required sample rate literal type
|
|
71
108
|
*/
|
|
72
|
-
|
|
109
|
+
class ScopedBaseAvatar {
|
|
110
|
+
constructor(areaScope) {
|
|
111
|
+
this.areaScope = areaScope;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export class BaseAvatar extends ScopedBaseAvatar {
|
|
115
|
+
constructor() {
|
|
116
|
+
super("global");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export class BaseCNAvatar extends ScopedBaseAvatar {
|
|
120
|
+
constructor() {
|
|
121
|
+
super("cn");
|
|
122
|
+
}
|
|
73
123
|
}
|
|
@@ -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 {};
|