agora-agents 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -26
- 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/Client.js +8 -16
- package/dist/cjs/agentkit/Agent.d.ts +52 -51
- package/dist/cjs/agentkit/Agent.js +46 -44
- package/dist/cjs/agentkit/AgentSession.d.ts +11 -10
- package/dist/cjs/agentkit/AgentSession.js +12 -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 +43 -4
- package/dist/cjs/agentkit/avatar-types.js +52 -2
- package/dist/cjs/agentkit/index.d.ts +12 -9
- package/dist/cjs/agentkit/index.js +32 -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 +47 -9
- package/dist/cjs/agentkit/vendors/avatar.d.ts +9 -6
- package/dist/cjs/agentkit/vendors/avatar.js +9 -6
- package/dist/cjs/agentkit/vendors/base.d.ts +42 -5
- package/dist/cjs/agentkit/vendors/base.js +64 -6
- package/dist/cjs/agentkit/vendors/cn.d.ts +269 -0
- package/dist/cjs/agentkit/vendors/cn.js +313 -0
- package/dist/cjs/agentkit/vendors/llm.d.ts +1 -1
- package/dist/cjs/agentkit/vendors/llm.js +13 -3
- package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
- package/dist/cjs/agentkit/vendors/mllm.js +10 -6
- package/dist/cjs/agentkit/vendors/stt.d.ts +31 -0
- package/dist/cjs/agentkit/vendors/stt.js +31 -1
- package/dist/cjs/agentkit/vendors/tts.d.ts +63 -3
- package/dist/cjs/agentkit/vendors/tts.js +42 -1
- package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +2 -3
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +23 -3
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +12 -0
- package/dist/cjs/api/resources/agents/types/GetHistoryAgentsResponse.d.ts +6 -0
- package/dist/cjs/api/resources/agents/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/types/index.js +0 -1
- package/dist/cjs/api/types/Asr.d.ts +19 -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/GenericTts.d.ts +13 -0
- package/dist/cjs/api/types/GenericTts.js +3 -0
- package/dist/cjs/api/types/GenericTtsParams.d.ts +21 -0
- package/dist/cjs/api/types/GenericTtsParams.js +3 -0
- package/dist/cjs/api/types/Llm.d.ts +24 -1
- package/dist/cjs/api/types/Llm.js +8 -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/SpatiusAvatarParams.d.ts +23 -0
- package/dist/cjs/api/types/SpatiusAvatarParams.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 +22 -1
- package/dist/cjs/api/types/XAiAsr.d.ts +10 -0
- package/dist/cjs/api/types/XAiAsr.js +3 -0
- package/dist/cjs/api/types/XAiAsrParams.d.ts +15 -0
- package/dist/cjs/api/types/XAiAsrParams.js +3 -0
- package/dist/cjs/api/types/XAiTts.d.ts +9 -0
- package/dist/cjs/api/types/XAiTts.js +3 -0
- package/dist/cjs/api/types/XAiTtsParams.d.ts +15 -0
- package/dist/cjs/api/types/XAiTtsParams.js +3 -0
- 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 +27 -0
- package/dist/cjs/api/types/index.js +27 -0
- package/dist/cjs/core/base64.js +1 -5
- 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 +31 -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/Client.mjs +8 -16
- package/dist/esm/agentkit/Agent.d.mts +52 -51
- package/dist/esm/agentkit/Agent.mjs +46 -44
- package/dist/esm/agentkit/AgentSession.d.mts +11 -10
- package/dist/esm/agentkit/AgentSession.mjs +13 -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 +43 -4
- package/dist/esm/agentkit/avatar-types.mjs +50 -2
- package/dist/esm/agentkit/index.d.mts +12 -9
- package/dist/esm/agentkit/index.mjs +5 -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 +47 -9
- package/dist/esm/agentkit/vendors/avatar.d.mts +9 -6
- package/dist/esm/agentkit/vendors/avatar.mjs +9 -6
- package/dist/esm/agentkit/vendors/base.d.mts +42 -5
- package/dist/esm/agentkit/vendors/base.mjs +59 -5
- package/dist/esm/agentkit/vendors/cn.d.mts +269 -0
- package/dist/esm/agentkit/vendors/cn.mjs +291 -0
- package/dist/esm/agentkit/vendors/llm.d.mts +1 -1
- package/dist/esm/agentkit/vendors/llm.mjs +13 -3
- package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
- package/dist/esm/agentkit/vendors/mllm.mjs +10 -6
- package/dist/esm/agentkit/vendors/stt.d.mts +31 -0
- package/dist/esm/agentkit/vendors/stt.mjs +29 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +63 -3
- package/dist/esm/agentkit/vendors/tts.mjs +39 -0
- package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +2 -3
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +23 -3
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +12 -0
- package/dist/esm/api/resources/agents/types/GetHistoryAgentsResponse.d.mts +6 -0
- package/dist/esm/api/resources/agents/types/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/types/index.mjs +0 -1
- package/dist/esm/api/types/Asr.d.mts +19 -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/GenericTts.d.mts +13 -0
- package/dist/esm/api/types/GenericTts.mjs +2 -0
- package/dist/esm/api/types/GenericTtsParams.d.mts +21 -0
- package/dist/esm/api/types/GenericTtsParams.mjs +2 -0
- package/dist/esm/api/types/Llm.d.mts +24 -1
- package/dist/esm/api/types/Llm.mjs +8 -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/SpatiusAvatarParams.d.mts +23 -0
- package/dist/esm/api/types/SpatiusAvatarParams.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 +22 -1
- package/dist/esm/api/types/XAiAsr.d.mts +10 -0
- package/dist/esm/api/types/XAiAsr.mjs +2 -0
- package/dist/esm/api/types/XAiAsrParams.d.mts +15 -0
- package/dist/esm/api/types/XAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/XAiTts.d.mts +9 -0
- package/dist/esm/api/types/XAiTts.mjs +2 -0
- package/dist/esm/api/types/XAiTtsParams.d.mts +15 -0
- package/dist/esm/api/types/XAiTtsParams.mjs +2 -0
- 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 +27 -0
- package/dist/esm/api/types/index.mjs +27 -0
- package/dist/esm/core/base64.mjs +1 -5
- 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
- package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.d.ts +0 -10
- package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.js +0 -13
- package/dist/esm/api/resources/agents/types/ListAgentsRequestState.d.mts +0 -10
- package/dist/esm/api/resources/agents/types/ListAgentsRequestState.mjs +0 -10
|
@@ -0,0 +1,269 @@
|
|
|
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 interface SpatiusAvatarOptions {
|
|
252
|
+
spatiusApiKey: string;
|
|
253
|
+
spatiusAppId: string;
|
|
254
|
+
spatiusAvatarId: string;
|
|
255
|
+
agoraUid: string;
|
|
256
|
+
agoraToken?: string;
|
|
257
|
+
region?: string;
|
|
258
|
+
sampleRate?: 16000 | 24000;
|
|
259
|
+
sessionExpireMinutes?: number;
|
|
260
|
+
enable?: boolean;
|
|
261
|
+
additionalParams?: Record<string, unknown>;
|
|
262
|
+
}
|
|
263
|
+
export declare class SpatiusAvatar extends BaseCNAvatar<number> {
|
|
264
|
+
private readonly options;
|
|
265
|
+
readonly requiredSampleRate: number;
|
|
266
|
+
constructor(options: SpatiusAvatarOptions);
|
|
267
|
+
toConfig(): AvatarConfig;
|
|
268
|
+
}
|
|
269
|
+
export {};
|
|
@@ -0,0 +1,291 @@
|
|
|
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, greeting_audio_url: options.greetingAudioUrl, 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(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey }), (sceneList !== undefined && { sceneList })),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export class SpatiusAvatar extends BaseCNAvatar {
|
|
274
|
+
constructor(options) {
|
|
275
|
+
super();
|
|
276
|
+
this.options = options;
|
|
277
|
+
this.requiredSampleRate = 0;
|
|
278
|
+
requireString(options.spatiusApiKey, "spatiusApiKey", "SpatiusAvatar");
|
|
279
|
+
requireString(options.spatiusAppId, "spatiusAppId", "SpatiusAvatar");
|
|
280
|
+
requireString(options.spatiusAvatarId, "spatiusAvatarId", "SpatiusAvatar");
|
|
281
|
+
requireString(options.agoraUid, "agoraUid", "SpatiusAvatar");
|
|
282
|
+
}
|
|
283
|
+
toConfig() {
|
|
284
|
+
const { spatiusApiKey, spatiusAppId, spatiusAvatarId, agoraUid, agoraToken, region, sampleRate, sessionExpireMinutes, enable = true, additionalParams, } = this.options;
|
|
285
|
+
return {
|
|
286
|
+
enable,
|
|
287
|
+
vendor: "spatius",
|
|
288
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { spatius_api_key: spatiusApiKey, spatius_app_id: spatiusAppId, spatius_avatar_id: spatiusAvatarId, agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), (region && { region })), (sampleRate !== undefined && { sample_rate: sampleRate })), (sessionExpireMinutes !== undefined && { session_expire_minutes: sessionExpireMinutes })),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -174,7 +174,7 @@ export interface GeminiOptions extends BaseLlmOptions {
|
|
|
174
174
|
apiKey: string;
|
|
175
175
|
/** Model name (e.g., 'gemini-pro', 'gemini-pro-vision') */
|
|
176
176
|
model: string;
|
|
177
|
-
/** API endpoint URL
|
|
177
|
+
/** Optional full API endpoint URL override. When omitted, AgentKit builds the official Gemini stream URL. */
|
|
178
178
|
url?: string;
|
|
179
179
|
/** Maximum number of conversation history messages to cache */
|
|
180
180
|
maxHistory?: number;
|
|
@@ -57,7 +57,7 @@ export class OpenAI extends BaseLLM {
|
|
|
57
57
|
const { apiKey, model, url, maxHistory, temperature, topP, maxTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
58
58
|
return Object.assign(Object.assign({ url: url !== null && url !== void 0 ? url : "https://api.openai.com/v1/chat/completions" }, (apiKey && { api_key: apiKey })), {
|
|
59
59
|
// model is the default; params entries extend it; named fields win.
|
|
60
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (maxTokens !== undefined && { max_tokens: maxTokens })), headers, max_history: maxHistory, system_messages: systemMessages, greeting_message: greetingMessage, failure_message: failureMessage, input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"], output_modalities: this.outputModalities, style: "openai", vendor: this.vendor, greeting_configs: this.greetingConfigs, template_variables: this.templateVariables, mcp_servers: this.mcpServers });
|
|
60
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (maxTokens !== undefined && { max_tokens: maxTokens })), headers, max_history: maxHistory, system_messages: systemMessages, greeting_message: greetingMessage, greeting_audio_url: this.greetingAudioUrl, failure_message: failureMessage, input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"], output_modalities: this.outputModalities, style: "openai", vendor: this.vendor, greeting_configs: this.greetingConfigs, template_variables: this.templateVariables, mcp_servers: this.mcpServers });
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -100,6 +100,7 @@ export class AzureOpenAI extends BaseLLM {
|
|
|
100
100
|
max_history: maxHistory,
|
|
101
101
|
system_messages: systemMessages,
|
|
102
102
|
greeting_message: greetingMessage,
|
|
103
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
103
104
|
failure_message: failureMessage,
|
|
104
105
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
105
106
|
output_modalities: this.outputModalities,
|
|
@@ -145,6 +146,7 @@ export class Anthropic extends BaseLLM {
|
|
|
145
146
|
max_history: maxHistory,
|
|
146
147
|
system_messages: systemMessages,
|
|
147
148
|
greeting_message: greetingMessage,
|
|
149
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
148
150
|
failure_message: failureMessage,
|
|
149
151
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
150
152
|
output_modalities: this.outputModalities,
|
|
@@ -172,19 +174,23 @@ export class Gemini extends BaseLLM {
|
|
|
172
174
|
super(options);
|
|
173
175
|
requireString(options.apiKey, "apiKey", "Gemini");
|
|
174
176
|
requireString(options.model, "model", "Gemini");
|
|
177
|
+
if (options.url !== undefined) {
|
|
178
|
+
requireString(options.url, "url", "Gemini");
|
|
179
|
+
}
|
|
175
180
|
this.options = options;
|
|
176
181
|
}
|
|
177
182
|
toConfig() {
|
|
178
183
|
const { apiKey, model, url, maxHistory, temperature, topP, topK, maxOutputTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
184
|
+
const defaultUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${encodeURIComponent(apiKey)}`;
|
|
179
185
|
return {
|
|
180
|
-
url: url !== null && url !== void 0 ? url :
|
|
181
|
-
api_key: apiKey,
|
|
186
|
+
url: url !== null && url !== void 0 ? url : defaultUrl,
|
|
182
187
|
// model is the default; params entries extend it; named fields win.
|
|
183
188
|
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (topK !== undefined && { top_k: topK })), (maxOutputTokens !== undefined && { max_output_tokens: maxOutputTokens })),
|
|
184
189
|
headers,
|
|
185
190
|
max_history: maxHistory,
|
|
186
191
|
system_messages: systemMessages,
|
|
187
192
|
greeting_message: greetingMessage,
|
|
193
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
188
194
|
failure_message: failureMessage,
|
|
189
195
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
190
196
|
output_modalities: this.outputModalities,
|
|
@@ -206,6 +212,7 @@ function openAIStyleConfig(options, vendor) {
|
|
|
206
212
|
max_history: options.maxHistory,
|
|
207
213
|
system_messages: options.systemMessages,
|
|
208
214
|
greeting_message: options.greetingMessage,
|
|
215
|
+
greeting_audio_url: options.greetingAudioUrl,
|
|
209
216
|
failure_message: options.failureMessage,
|
|
210
217
|
input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
211
218
|
output_modalities: options.outputModalities,
|
|
@@ -261,6 +268,7 @@ export class VertexAILLM extends BaseLLM {
|
|
|
261
268
|
max_history: o.maxHistory,
|
|
262
269
|
system_messages: o.systemMessages,
|
|
263
270
|
greeting_message: o.greetingMessage,
|
|
271
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
264
272
|
failure_message: o.failureMessage,
|
|
265
273
|
input_modalities: (_b = o.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
|
|
266
274
|
output_modalities: this.outputModalities,
|
|
@@ -295,6 +303,7 @@ export class AmazonBedrock extends BaseLLM {
|
|
|
295
303
|
max_history: o.maxHistory,
|
|
296
304
|
system_messages: o.systemMessages,
|
|
297
305
|
greeting_message: o.greetingMessage,
|
|
306
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
298
307
|
failure_message: o.failureMessage,
|
|
299
308
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
300
309
|
output_modalities: this.outputModalities,
|
|
@@ -325,6 +334,7 @@ export class Dify extends BaseLLM {
|
|
|
325
334
|
max_history: o.maxHistory,
|
|
326
335
|
system_messages: o.systemMessages,
|
|
327
336
|
greeting_message: o.greetingMessage,
|
|
337
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
328
338
|
failure_message: o.failureMessage,
|
|
329
339
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
330
340
|
output_modalities: this.outputModalities,
|