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.
- package/README.md +48 -26
- package/dist/cjs/AgoraPoolClient.d.ts +9 -6
- package/dist/cjs/AgoraPoolClient.js +1 -0
- package/dist/cjs/agentkit/Agent.d.ts +52 -51
- package/dist/cjs/agentkit/Agent.js +40 -39
- package/dist/cjs/agentkit/AgentSession.d.ts +11 -10
- package/dist/cjs/agentkit/AgentSession.js +10 -6
- 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/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 +26 -5
- package/dist/cjs/agentkit/vendors/avatar.d.ts +6 -3
- 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/mllm.d.ts +8 -4
- package/dist/cjs/agentkit/vendors/mllm.js +8 -4
- package/dist/cjs/agentkit/vendors/stt.js +5 -0
- package/dist/cjs/agentkit/vendors/tts.d.ts +3 -3
- 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/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/OpenAiTtsParams.d.ts +1 -1
- 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/esm/AgoraPoolClient.d.mts +9 -6
- package/dist/esm/AgoraPoolClient.mjs +1 -0
- package/dist/esm/agentkit/Agent.d.mts +52 -51
- package/dist/esm/agentkit/Agent.mjs +40 -39
- package/dist/esm/agentkit/AgentSession.d.mts +11 -10
- package/dist/esm/agentkit/AgentSession.mjs +11 -7
- 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/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 +26 -5
- package/dist/esm/agentkit/vendors/avatar.d.mts +6 -3
- 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/mllm.d.mts +8 -4
- package/dist/esm/agentkit/vendors/mllm.mjs +8 -4
- package/dist/esm/agentkit/vendors/stt.mjs +5 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +3 -3
- 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/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/OpenAiTtsParams.d.mts +1 -1
- 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/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This provides type safety for vendor-specific parameters like sample rates,
|
|
5
5
|
* ensuring that invalid combinations are caught at compile time.
|
|
6
6
|
*/
|
|
7
|
+
import type { SensetimeAvatarParams } from "../api/types/SensetimeAvatarParams.mjs";
|
|
7
8
|
import type { AvatarConfig as BaseAvatarConfig } from "./types.mjs";
|
|
8
9
|
/**
|
|
9
10
|
* HeyGen-specific avatar configuration (legacy wire vendor `heygen`).
|
|
@@ -123,11 +124,31 @@ export interface GenericAvatarConfig {
|
|
|
123
124
|
[key: string]: unknown;
|
|
124
125
|
};
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* SenseTime-specific avatar configuration (CN).
|
|
129
|
+
*/
|
|
130
|
+
export interface SensetimeAvatarConfig {
|
|
131
|
+
enable?: boolean;
|
|
132
|
+
vendor: "sensetime";
|
|
133
|
+
params: {
|
|
134
|
+
/** RTC UID for the avatar video publisher (required) */
|
|
135
|
+
agora_uid: string;
|
|
136
|
+
/** Avatar ConvoAI token (filled by AgentKit at session start when omitted) */
|
|
137
|
+
agora_token?: string;
|
|
138
|
+
/** SenseTime application ID (required) */
|
|
139
|
+
appId: string;
|
|
140
|
+
/** SenseTime application key (required) */
|
|
141
|
+
app_key: string;
|
|
142
|
+
/** SenseTime scene configuration list (required) */
|
|
143
|
+
sceneList: SensetimeAvatarParams.SceneList.Item[];
|
|
144
|
+
[key: string]: unknown;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
126
147
|
/**
|
|
127
148
|
* Discriminated union of all avatar configurations.
|
|
128
149
|
* TypeScript will enforce vendor-specific constraints based on the vendor field.
|
|
129
150
|
*/
|
|
130
|
-
export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig;
|
|
151
|
+
export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig | SensetimeAvatarConfig;
|
|
131
152
|
/**
|
|
132
153
|
* Helper type guard to check if an avatar config uses the legacy HeyGen wire vendor.
|
|
133
154
|
*/
|
|
@@ -148,6 +169,10 @@ export declare function isAnamAvatar(config: StrictAvatarConfig): config is Anam
|
|
|
148
169
|
* Helper type guard to check if an avatar config is for Generic Avatar.
|
|
149
170
|
*/
|
|
150
171
|
export declare function isGenericAvatar(config: StrictAvatarConfig): config is GenericAvatarConfig;
|
|
172
|
+
/**
|
|
173
|
+
* Helper type guard to check if an avatar config is for SenseTime (CN).
|
|
174
|
+
*/
|
|
175
|
+
export declare function isSensetimeAvatar(config: StrictAvatarConfig): config is SensetimeAvatarConfig;
|
|
151
176
|
/**
|
|
152
177
|
* Returns true when AgentKit manages the avatar's RTC publisher identity
|
|
153
178
|
* (i.e. fills `agora_token`, validates uniqueness against the agent UID).
|
|
@@ -161,7 +186,8 @@ export declare function isAvatarTokenManaged(config: StrictAvatarConfig): boolea
|
|
|
161
186
|
* for cases where types are bypassed or data comes from external sources.
|
|
162
187
|
*
|
|
163
188
|
* @param options.requireSessionFields - When true, require fields AgentKit
|
|
164
|
-
* fills during `AgentSession.start()` for Generic avatars
|
|
189
|
+
* fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
|
|
190
|
+
* `agora_channel`, `agora_token`).
|
|
165
191
|
* @throws {Error} If the configuration is invalid
|
|
166
192
|
*/
|
|
167
193
|
export declare function validateAvatarConfig(config: StrictAvatarConfig, options?: {
|
|
@@ -34,6 +34,12 @@ export function isAnamAvatar(config) {
|
|
|
34
34
|
export function isGenericAvatar(config) {
|
|
35
35
|
return config.vendor === "generic";
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Helper type guard to check if an avatar config is for SenseTime (CN).
|
|
39
|
+
*/
|
|
40
|
+
export function isSensetimeAvatar(config) {
|
|
41
|
+
return config.vendor === "sensetime";
|
|
42
|
+
}
|
|
37
43
|
/**
|
|
38
44
|
* Returns true when AgentKit manages the avatar's RTC publisher identity
|
|
39
45
|
* (i.e. fills `agora_token`, validates uniqueness against the agent UID).
|
|
@@ -41,7 +47,7 @@ export function isGenericAvatar(config) {
|
|
|
41
47
|
* Mirrors the Go and Python SDK gate so all language SDKs behave identically.
|
|
42
48
|
*/
|
|
43
49
|
export function isAvatarTokenManaged(config) {
|
|
44
|
-
return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config);
|
|
50
|
+
return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config) || isSensetimeAvatar(config);
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Validates avatar configuration at runtime.
|
|
@@ -49,7 +55,8 @@ export function isAvatarTokenManaged(config) {
|
|
|
49
55
|
* for cases where types are bypassed or data comes from external sources.
|
|
50
56
|
*
|
|
51
57
|
* @param options.requireSessionFields - When true, require fields AgentKit
|
|
52
|
-
* fills during `AgentSession.start()` for Generic avatars
|
|
58
|
+
* fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
|
|
59
|
+
* `agora_channel`, `agora_token`).
|
|
53
60
|
* @throws {Error} If the configuration is invalid
|
|
54
61
|
*/
|
|
55
62
|
export function validateAvatarConfig(config, options = {}) {
|
|
@@ -105,6 +112,20 @@ export function validateAvatarConfig(config, options = {}) {
|
|
|
105
112
|
}
|
|
106
113
|
}
|
|
107
114
|
}
|
|
115
|
+
else if (isSensetimeAvatar(config)) {
|
|
116
|
+
if (!config.params.agora_uid) {
|
|
117
|
+
throw new Error("SenseTime avatar requires agora_uid");
|
|
118
|
+
}
|
|
119
|
+
if (!config.params.appId) {
|
|
120
|
+
throw new Error("SenseTime avatar requires appId");
|
|
121
|
+
}
|
|
122
|
+
if (!config.params.app_key) {
|
|
123
|
+
throw new Error("SenseTime avatar requires app_key");
|
|
124
|
+
}
|
|
125
|
+
if (!Array.isArray(config.params.sceneList) || config.params.sceneList.length === 0) {
|
|
126
|
+
throw new Error("SenseTime avatar requires a non-empty sceneList");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
108
129
|
}
|
|
109
130
|
/**
|
|
110
131
|
* Validates that TTS sample rate is compatible with the avatar vendor.
|
|
@@ -23,18 +23,21 @@ export type { AgentOptions } from "./Agent.mjs";
|
|
|
23
23
|
export { Agent } from "./Agent.mjs";
|
|
24
24
|
export type { AgentSessionEvent, AgentSessionEventHandler, AgentSessionOptions, } from "./AgentSession.mjs";
|
|
25
25
|
export { AgentSession } from "./AgentSession.mjs";
|
|
26
|
-
export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, StrictAvatarConfig, } from "./avatar-types.mjs";
|
|
27
|
-
export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
|
|
26
|
+
export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, SensetimeAvatarConfig, StrictAvatarConfig, } from "./avatar-types.mjs";
|
|
27
|
+
export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
|
|
28
28
|
export { AudioScenario, DataChannel, FillerWordsSelectionRule, Geofence, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, SalModeValues, SilenceActionValues, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, } from "./constants.mjs";
|
|
29
|
-
export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetInput, TtsPreset, } from "./presets.mjs";
|
|
29
|
+
export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetCategory, PresetInput, TtsPreset, } from "./presets.mjs";
|
|
30
30
|
export { AgentPresets, normalizePresetInput } from "./presets.mjs";
|
|
31
|
+
export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.mjs";
|
|
31
32
|
export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.mjs";
|
|
32
33
|
export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.mjs";
|
|
33
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig,
|
|
34
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.mjs";
|
|
34
35
|
export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.mjs";
|
|
35
36
|
export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.mjs";
|
|
36
37
|
export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.mjs";
|
|
37
|
-
export { BaseAvatar, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.mjs";
|
|
38
|
+
export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.mjs";
|
|
39
|
+
export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CosyVoiceTTSOptions, DeepSeekLLMOptions, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MiniMaxCNTTSOptions, SensetimeAvatarOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.mjs";
|
|
40
|
+
export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
|
|
38
41
|
export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, CustomLLMOptions, DifyOptions, GeminiOptions, GroqOptions, OpenAIOptions, VertexAILLMOptions, } from "./vendors/llm.mjs";
|
|
39
42
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
40
43
|
export type { GeminiLiveOptions, OpenAIRealtimeOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// Core classes
|
|
22
22
|
export { Agent } from "./Agent.mjs";
|
|
23
23
|
export { AgentSession } from "./AgentSession.mjs";
|
|
24
|
-
export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
|
|
24
|
+
export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
|
|
25
25
|
// Type-safe constants
|
|
26
26
|
export { AudioScenario, DataChannel, FillerWordsSelectionRule, Geofence, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, SalModeValues, SilenceActionValues, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, } from "./constants.mjs";
|
|
27
27
|
export { AgentPresets, normalizePresetInput } from "./presets.mjs";
|
|
@@ -30,7 +30,8 @@ export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS,
|
|
|
30
30
|
// Avatar vendor classes
|
|
31
31
|
export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.mjs";
|
|
32
32
|
// Base vendor classes
|
|
33
|
-
export { BaseAvatar, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, } from "./vendors/base.mjs";
|
|
33
|
+
export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, } from "./vendors/base.mjs";
|
|
34
|
+
export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
|
|
34
35
|
// LLM vendor classes
|
|
35
36
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
36
37
|
// MLLM vendor classes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseSTT, BaseTTS } from "./vendors/base.mjs";
|
|
2
|
+
import type { MicrosoftCNSampleRate, MicrosoftCNSTT, MicrosoftCNTTS } from "./vendors/cn.mjs";
|
|
3
|
+
import type { CustomLLM } from "./vendors/llm.mjs";
|
|
4
|
+
export type GlobalLlmVendor = BaseLLM;
|
|
5
|
+
export type GlobalTtsVendor<SR extends number = number> = BaseTTS<SR>;
|
|
6
|
+
export type GlobalSttVendor = BaseSTT;
|
|
7
|
+
export type GlobalAvatarVendor<SR extends number = number> = BaseAvatar<SR>;
|
|
8
|
+
export type CNLlmVendor = BaseCNLLM | CustomLLM;
|
|
9
|
+
export type CNTtsVendor<SR extends number = number> = BaseCNTTS<SR> | (SR extends MicrosoftCNSampleRate ? MicrosoftCNTTS<SR> : never);
|
|
10
|
+
export type CNSttVendor = BaseCNSTT | MicrosoftCNSTT;
|
|
11
|
+
export type CNAvatarVendor<SR extends number = number> = BaseCNAvatar<SR>;
|
|
12
|
+
export type LlmVendor = GlobalLlmVendor | CNLlmVendor;
|
|
13
|
+
export type TtsVendor<SR extends number = number> = GlobalTtsVendor<SR> | CNTtsVendor<SR>;
|
|
14
|
+
export type SttVendor = GlobalSttVendor | CNSttVendor;
|
|
15
|
+
export type AvatarVendor<SR extends number = number> = GlobalAvatarVendor<SR> | CNAvatarVendor<SR>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,8 +18,9 @@ export declare const MAX_EXPIRY_SECONDS = 86400;
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
21
|
-
* agent.createSession(
|
|
22
|
-
*
|
|
21
|
+
* agent.createSession({
|
|
22
|
+
* name: `conversation-${Date.now()}`,
|
|
23
|
+
* channel: `demo-channel-${Date.now()}`,
|
|
23
24
|
* agentUid: '1',
|
|
24
25
|
* remoteUids: ['100'],
|
|
25
26
|
* expiresIn: ExpiresIn.hours(12),
|
|
@@ -20,8 +20,9 @@ export const MAX_EXPIRY_SECONDS = 86400;
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```typescript
|
|
23
|
-
* agent.createSession(
|
|
24
|
-
*
|
|
23
|
+
* agent.createSession({
|
|
24
|
+
* name: `conversation-${Date.now()}`,
|
|
25
|
+
* channel: `demo-channel-${Date.now()}`,
|
|
25
26
|
* agentUid: '1',
|
|
26
27
|
* remoteUids: ['100'],
|
|
27
28
|
* expiresIn: ExpiresIn.hours(12),
|
|
@@ -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,7 +82,8 @@ 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 */
|
|
@@ -191,9 +212,9 @@ export type McpServersItem = Record<string, unknown>;
|
|
|
191
212
|
export type AgentConfig = StartAgentsRequest.Properties;
|
|
192
213
|
/** Agent configuration update (for runtime updates) */
|
|
193
214
|
export type AgentConfigUpdate = UpdateAgentsRequest.Properties;
|
|
194
|
-
/** Options for creating a session */
|
|
215
|
+
/** Options for creating a session via {@link Agent.createSession} */
|
|
195
216
|
export interface SessionOptions {
|
|
196
|
-
/** Unique
|
|
217
|
+
/** Unique agent instance name sent to the Agora API. Omit to auto-generate `agent-{timestamp}`. */
|
|
197
218
|
name?: string;
|
|
198
219
|
/** The channel to join */
|
|
199
220
|
channel: string;
|
|
@@ -69,7 +69,8 @@ export interface AkoolAvatarOptions {
|
|
|
69
69
|
* sampleRate: 16000, // Required for Akool
|
|
70
70
|
* });
|
|
71
71
|
*
|
|
72
|
-
* const
|
|
72
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
73
|
+
* const agent = new Agent({ client })
|
|
73
74
|
* .withTts(tts)
|
|
74
75
|
* .withAvatar(avatar);
|
|
75
76
|
* ```
|
|
@@ -110,7 +111,8 @@ export declare class AkoolAvatar extends BaseAvatar<AkoolSampleRate> {
|
|
|
110
111
|
* sampleRate: 24000, // Required for LiveAvatar
|
|
111
112
|
* });
|
|
112
113
|
*
|
|
113
|
-
* const
|
|
114
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
115
|
+
* const agent = new Agent({ client })
|
|
114
116
|
* .withTts(tts)
|
|
115
117
|
* .withAvatar(avatar);
|
|
116
118
|
* ```
|
|
@@ -168,7 +170,8 @@ export interface AnamAvatarOptions {
|
|
|
168
170
|
* personaId: 'persona-id',
|
|
169
171
|
* });
|
|
170
172
|
*
|
|
171
|
-
* const
|
|
173
|
+
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
174
|
+
* const agent = new Agent({ client })
|
|
172
175
|
* .withAvatar(avatar);
|
|
173
176
|
* ```
|
|
174
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
|
}
|