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.js";
|
|
2
|
+
import { BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, type BaseLlmOptions } from "./base.js";
|
|
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,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpatiusAvatar = exports.SensetimeAvatar = exports.TencentLLM = exports.DeepSeekLLM = exports.BytedanceLLM = exports.AliyunLLM = exports.StepFunTTS = exports.BytedanceDuplexTTS = exports.CosyVoiceTTS = exports.BytedanceTTS = exports.TencentTTS = exports.MicrosoftCNTTS = exports.MiniMaxCNTTS = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.XfyunSTT = exports.TencentSTT = exports.MicrosoftCNSTT = exports.FengmingSTT = void 0;
|
|
4
|
+
const base_js_1 = require("./base.js");
|
|
5
|
+
function requireString(value, field, vendor) {
|
|
6
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
7
|
+
throw new Error(`${vendor} requires ${field}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class FengmingSTT extends base_js_1.BaseCNSTT {
|
|
11
|
+
toConfig() {
|
|
12
|
+
return {
|
|
13
|
+
vendor: "fengming",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.FengmingSTT = FengmingSTT;
|
|
18
|
+
class MicrosoftCNSTT extends base_js_1.BaseCNSTT {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super();
|
|
21
|
+
this.options = options;
|
|
22
|
+
requireString(options.key, "key", "MicrosoftCNSTT");
|
|
23
|
+
requireString(options.region, "region", "MicrosoftCNSTT");
|
|
24
|
+
requireString(options.language, "language", "MicrosoftCNSTT");
|
|
25
|
+
}
|
|
26
|
+
toConfig() {
|
|
27
|
+
const { key, region, language, phraseList, additionalParams } = this.options;
|
|
28
|
+
return {
|
|
29
|
+
vendor: "microsoft",
|
|
30
|
+
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
|
|
31
|
+
region,
|
|
32
|
+
language }), (phraseList && { phrase_list: phraseList })),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.MicrosoftCNSTT = MicrosoftCNSTT;
|
|
37
|
+
class TencentSTT extends base_js_1.BaseCNSTT {
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super();
|
|
40
|
+
this.options = options;
|
|
41
|
+
requireString(options.key, "key", "TencentSTT");
|
|
42
|
+
requireString(options.appId, "appId", "TencentSTT");
|
|
43
|
+
requireString(options.secret, "secret", "TencentSTT");
|
|
44
|
+
requireString(options.engineModelType, "engineModelType", "TencentSTT");
|
|
45
|
+
requireString(options.voiceId, "voiceId", "TencentSTT");
|
|
46
|
+
}
|
|
47
|
+
toConfig() {
|
|
48
|
+
const { language, key, appId, secret, engineModelType, voiceId, additionalParams } = this.options;
|
|
49
|
+
return {
|
|
50
|
+
vendor: "tencent",
|
|
51
|
+
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 })),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.TencentSTT = TencentSTT;
|
|
56
|
+
class XfyunSTT extends base_js_1.BaseCNSTT {
|
|
57
|
+
constructor(options) {
|
|
58
|
+
super();
|
|
59
|
+
this.options = options;
|
|
60
|
+
requireString(options.apiKey, "apiKey", "XfyunSTT");
|
|
61
|
+
requireString(options.appId, "appId", "XfyunSTT");
|
|
62
|
+
requireString(options.apiSecret, "apiSecret", "XfyunSTT");
|
|
63
|
+
requireString(options.language, "language", "XfyunSTT");
|
|
64
|
+
}
|
|
65
|
+
toConfig() {
|
|
66
|
+
const { apiKey, appId, apiSecret, language, additionalParams } = this.options;
|
|
67
|
+
return {
|
|
68
|
+
vendor: "xfyun",
|
|
69
|
+
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, app_id: appId, api_secret: apiSecret }), (language && { language })),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.XfyunSTT = XfyunSTT;
|
|
74
|
+
class XfyunBigModelSTT extends base_js_1.BaseCNSTT {
|
|
75
|
+
constructor(options) {
|
|
76
|
+
super();
|
|
77
|
+
this.options = options;
|
|
78
|
+
requireString(options.apiKey, "apiKey", "XfyunBigModelSTT");
|
|
79
|
+
requireString(options.appId, "appId", "XfyunBigModelSTT");
|
|
80
|
+
requireString(options.apiSecret, "apiSecret", "XfyunBigModelSTT");
|
|
81
|
+
requireString(options.languageName, "languageName", "XfyunBigModelSTT");
|
|
82
|
+
requireString(options.language, "language", "XfyunBigModelSTT");
|
|
83
|
+
}
|
|
84
|
+
toConfig() {
|
|
85
|
+
const { apiKey, appId, apiSecret, languageName, language, additionalParams } = this.options;
|
|
86
|
+
return {
|
|
87
|
+
vendor: "xfyun_bigmodel",
|
|
88
|
+
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 })),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.XfyunBigModelSTT = XfyunBigModelSTT;
|
|
93
|
+
class XfyunDialectSTT extends base_js_1.BaseCNSTT {
|
|
94
|
+
constructor(options) {
|
|
95
|
+
super();
|
|
96
|
+
this.options = options;
|
|
97
|
+
requireString(options.appId, "appId", "XfyunDialectSTT");
|
|
98
|
+
requireString(options.accessKeyId, "accessKeyId", "XfyunDialectSTT");
|
|
99
|
+
requireString(options.accessKeySecret, "accessKeySecret", "XfyunDialectSTT");
|
|
100
|
+
requireString(options.language, "language", "XfyunDialectSTT");
|
|
101
|
+
}
|
|
102
|
+
toConfig() {
|
|
103
|
+
const { appId, accessKeyId, accessKeySecret, language, additionalParams } = this.options;
|
|
104
|
+
return {
|
|
105
|
+
vendor: "xfyun_dialect",
|
|
106
|
+
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { app_id: appId, access_key_id: accessKeyId, access_key_secret: accessKeySecret }), (language && { language })),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.XfyunDialectSTT = XfyunDialectSTT;
|
|
111
|
+
class MiniMaxCNTTS extends base_js_1.BaseCNTTS {
|
|
112
|
+
constructor(options) {
|
|
113
|
+
super();
|
|
114
|
+
this.options = options;
|
|
115
|
+
requireString(options.key, "key", "MiniMaxCNTTS");
|
|
116
|
+
requireString(options.model, "model", "MiniMaxCNTTS");
|
|
117
|
+
if (options.voiceSetting) {
|
|
118
|
+
requireString(options.voiceSetting.voice_id, "voiceSetting.voice_id", "MiniMaxCNTTS");
|
|
119
|
+
}
|
|
120
|
+
else if (!options.timberWeights.length) {
|
|
121
|
+
throw new Error("MiniMaxCNTTS requires at least one timberWeight when voiceSetting is omitted");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
toConfig() {
|
|
125
|
+
const { key, model, voiceSetting, audioSetting, pronunciationDict, timberWeights, languageBoost, skipPatterns, additionalParams, } = this.options;
|
|
126
|
+
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 }));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.MiniMaxCNTTS = MiniMaxCNTTS;
|
|
130
|
+
class MicrosoftCNTTS extends base_js_1.BaseCNTTS {
|
|
131
|
+
constructor(options) {
|
|
132
|
+
super();
|
|
133
|
+
this.options = options;
|
|
134
|
+
requireString(options.key, "key", "MicrosoftCNTTS");
|
|
135
|
+
requireString(options.region, "region", "MicrosoftCNTTS");
|
|
136
|
+
requireString(options.voiceName, "voiceName", "MicrosoftCNTTS");
|
|
137
|
+
}
|
|
138
|
+
toConfig() {
|
|
139
|
+
const { key, region, voiceName, sampleRate, speed, volume, skipPatterns, additionalParams } = this.options;
|
|
140
|
+
return Object.assign({ vendor: "microsoft", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { key,
|
|
141
|
+
region, voice_name: voiceName }), (sampleRate !== undefined && { sample_rate: sampleRate })), (speed !== undefined && { speed })), (volume !== undefined && { volume })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.MicrosoftCNTTS = MicrosoftCNTTS;
|
|
145
|
+
class TencentTTS extends base_js_1.BaseCNTTS {
|
|
146
|
+
constructor(options) {
|
|
147
|
+
super();
|
|
148
|
+
this.options = options;
|
|
149
|
+
requireString(options.appId, "appId", "TencentTTS");
|
|
150
|
+
requireString(options.secretId, "secretId", "TencentTTS");
|
|
151
|
+
requireString(options.secretKey, "secretKey", "TencentTTS");
|
|
152
|
+
if (typeof options.voiceType !== "number" || Number.isNaN(options.voiceType)) {
|
|
153
|
+
throw new Error("TencentTTS requires voiceType");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
toConfig() {
|
|
157
|
+
const { appId, secretId, secretKey, voiceType, volume, speed, emotionCategory, emotionIntensity, skipPatterns, additionalParams, } = this.options;
|
|
158
|
+
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 }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.TencentTTS = TencentTTS;
|
|
162
|
+
class BytedanceTTS extends base_js_1.BaseCNTTS {
|
|
163
|
+
constructor(options) {
|
|
164
|
+
super();
|
|
165
|
+
this.options = options;
|
|
166
|
+
requireString(options.token, "token", "BytedanceTTS");
|
|
167
|
+
requireString(options.appId, "appId", "BytedanceTTS");
|
|
168
|
+
requireString(options.cluster, "cluster", "BytedanceTTS");
|
|
169
|
+
requireString(options.voiceType, "voiceType", "BytedanceTTS");
|
|
170
|
+
}
|
|
171
|
+
toConfig() {
|
|
172
|
+
const { token, appId, cluster, voiceType, speedRatio, volumeRatio, pitchRatio, emotion, skipPatterns, additionalParams, } = this.options;
|
|
173
|
+
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 }));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.BytedanceTTS = BytedanceTTS;
|
|
177
|
+
class CosyVoiceTTS extends base_js_1.BaseCNTTS {
|
|
178
|
+
constructor(options) {
|
|
179
|
+
super();
|
|
180
|
+
this.options = options;
|
|
181
|
+
requireString(options.apiKey, "apiKey", "CosyVoiceTTS");
|
|
182
|
+
requireString(options.model, "model", "CosyVoiceTTS");
|
|
183
|
+
if (typeof options.sampleRate !== "number" || Number.isNaN(options.sampleRate)) {
|
|
184
|
+
throw new Error("CosyVoiceTTS requires sampleRate");
|
|
185
|
+
}
|
|
186
|
+
requireString(options.voice, "voice", "CosyVoiceTTS");
|
|
187
|
+
}
|
|
188
|
+
toConfig() {
|
|
189
|
+
const { apiKey, model, sampleRate, voice, skipPatterns, additionalParams } = this.options;
|
|
190
|
+
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 }));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.CosyVoiceTTS = CosyVoiceTTS;
|
|
194
|
+
class BytedanceDuplexTTS extends base_js_1.BaseCNTTS {
|
|
195
|
+
constructor(options) {
|
|
196
|
+
super();
|
|
197
|
+
this.options = options;
|
|
198
|
+
requireString(options.appId, "appId", "BytedanceDuplexTTS");
|
|
199
|
+
requireString(options.token, "token", "BytedanceDuplexTTS");
|
|
200
|
+
requireString(options.speaker, "speaker", "BytedanceDuplexTTS");
|
|
201
|
+
}
|
|
202
|
+
toConfig() {
|
|
203
|
+
const { appId, token, speaker, skipPatterns, additionalParams } = this.options;
|
|
204
|
+
return Object.assign({ vendor: "bytedance_duplex", params: Object.assign(Object.assign({}, additionalParams), { app_id: appId, token,
|
|
205
|
+
speaker }) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.BytedanceDuplexTTS = BytedanceDuplexTTS;
|
|
209
|
+
class StepFunTTS extends base_js_1.BaseCNTTS {
|
|
210
|
+
constructor(options) {
|
|
211
|
+
super();
|
|
212
|
+
this.options = options;
|
|
213
|
+
requireString(options.apiKey, "apiKey", "StepFunTTS");
|
|
214
|
+
requireString(options.model, "model", "StepFunTTS");
|
|
215
|
+
requireString(options.voiceId, "voiceId", "StepFunTTS");
|
|
216
|
+
}
|
|
217
|
+
toConfig() {
|
|
218
|
+
const { apiKey, model, voiceId, skipPatterns, additionalParams } = this.options;
|
|
219
|
+
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 }));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.StepFunTTS = StepFunTTS;
|
|
223
|
+
function cnLlmConfig(options, vendor) {
|
|
224
|
+
var _a;
|
|
225
|
+
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 });
|
|
226
|
+
}
|
|
227
|
+
class AliyunLLM extends base_js_1.BaseCNLLM {
|
|
228
|
+
constructor(options) {
|
|
229
|
+
super(options);
|
|
230
|
+
this.options = options;
|
|
231
|
+
requireString(options.url, "url", "AliyunLLM");
|
|
232
|
+
requireString(options.model, "model", "AliyunLLM");
|
|
233
|
+
}
|
|
234
|
+
toConfig() {
|
|
235
|
+
return cnLlmConfig(this.options, "aliyun");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.AliyunLLM = AliyunLLM;
|
|
239
|
+
class BytedanceLLM extends base_js_1.BaseCNLLM {
|
|
240
|
+
constructor(options) {
|
|
241
|
+
super(options);
|
|
242
|
+
this.options = options;
|
|
243
|
+
requireString(options.url, "url", "BytedanceLLM");
|
|
244
|
+
requireString(options.model, "model", "BytedanceLLM");
|
|
245
|
+
}
|
|
246
|
+
toConfig() {
|
|
247
|
+
return cnLlmConfig(this.options, "bytedance");
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
exports.BytedanceLLM = BytedanceLLM;
|
|
251
|
+
class DeepSeekLLM extends base_js_1.BaseCNLLM {
|
|
252
|
+
constructor(options) {
|
|
253
|
+
super(options);
|
|
254
|
+
this.options = options;
|
|
255
|
+
requireString(options.url, "url", "DeepSeekLLM");
|
|
256
|
+
requireString(options.model, "model", "DeepSeekLLM");
|
|
257
|
+
}
|
|
258
|
+
toConfig() {
|
|
259
|
+
return cnLlmConfig(this.options, "deepseek");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.DeepSeekLLM = DeepSeekLLM;
|
|
263
|
+
class TencentLLM extends base_js_1.BaseCNLLM {
|
|
264
|
+
constructor(options) {
|
|
265
|
+
super(options);
|
|
266
|
+
this.options = options;
|
|
267
|
+
requireString(options.url, "url", "TencentLLM");
|
|
268
|
+
requireString(options.model, "model", "TencentLLM");
|
|
269
|
+
}
|
|
270
|
+
toConfig() {
|
|
271
|
+
return cnLlmConfig(this.options, "tencent");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.TencentLLM = TencentLLM;
|
|
275
|
+
class SensetimeAvatar extends base_js_1.BaseCNAvatar {
|
|
276
|
+
constructor(options) {
|
|
277
|
+
super();
|
|
278
|
+
this.options = options;
|
|
279
|
+
this.requiredSampleRate = 0;
|
|
280
|
+
requireString(options.agoraUid, "agoraUid", "SensetimeAvatar");
|
|
281
|
+
requireString(options.appId, "appId", "SensetimeAvatar");
|
|
282
|
+
requireString(options.appKey, "appKey", "SensetimeAvatar");
|
|
283
|
+
}
|
|
284
|
+
toConfig() {
|
|
285
|
+
const { agoraUid, agoraToken, appId, appKey, sceneList, enable = true, additionalParams } = this.options;
|
|
286
|
+
return {
|
|
287
|
+
enable,
|
|
288
|
+
vendor: "sensetime",
|
|
289
|
+
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 })),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
exports.SensetimeAvatar = SensetimeAvatar;
|
|
294
|
+
class SpatiusAvatar extends base_js_1.BaseCNAvatar {
|
|
295
|
+
constructor(options) {
|
|
296
|
+
super();
|
|
297
|
+
this.options = options;
|
|
298
|
+
this.requiredSampleRate = 0;
|
|
299
|
+
requireString(options.spatiusApiKey, "spatiusApiKey", "SpatiusAvatar");
|
|
300
|
+
requireString(options.spatiusAppId, "spatiusAppId", "SpatiusAvatar");
|
|
301
|
+
requireString(options.spatiusAvatarId, "spatiusAvatarId", "SpatiusAvatar");
|
|
302
|
+
requireString(options.agoraUid, "agoraUid", "SpatiusAvatar");
|
|
303
|
+
}
|
|
304
|
+
toConfig() {
|
|
305
|
+
const { spatiusApiKey, spatiusAppId, spatiusAvatarId, agoraUid, agoraToken, region, sampleRate, sessionExpireMinutes, enable = true, additionalParams, } = this.options;
|
|
306
|
+
return {
|
|
307
|
+
enable,
|
|
308
|
+
vendor: "spatius",
|
|
309
|
+
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 })),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
exports.SpatiusAvatar = SpatiusAvatar;
|
|
@@ -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;
|
|
@@ -60,7 +60,7 @@ class OpenAI extends base_js_1.BaseLLM {
|
|
|
60
60
|
const { apiKey, model, url, maxHistory, temperature, topP, maxTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
61
61
|
return Object.assign(Object.assign({ url: url !== null && url !== void 0 ? url : "https://api.openai.com/v1/chat/completions" }, (apiKey && { api_key: apiKey })), {
|
|
62
62
|
// model is the default; params entries extend it; named fields win.
|
|
63
|
-
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 });
|
|
63
|
+
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 });
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
exports.OpenAI = OpenAI;
|
|
@@ -104,6 +104,7 @@ class AzureOpenAI extends base_js_1.BaseLLM {
|
|
|
104
104
|
max_history: maxHistory,
|
|
105
105
|
system_messages: systemMessages,
|
|
106
106
|
greeting_message: greetingMessage,
|
|
107
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
107
108
|
failure_message: failureMessage,
|
|
108
109
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
109
110
|
output_modalities: this.outputModalities,
|
|
@@ -150,6 +151,7 @@ class Anthropic extends base_js_1.BaseLLM {
|
|
|
150
151
|
max_history: maxHistory,
|
|
151
152
|
system_messages: systemMessages,
|
|
152
153
|
greeting_message: greetingMessage,
|
|
154
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
153
155
|
failure_message: failureMessage,
|
|
154
156
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
155
157
|
output_modalities: this.outputModalities,
|
|
@@ -178,19 +180,23 @@ class Gemini extends base_js_1.BaseLLM {
|
|
|
178
180
|
super(options);
|
|
179
181
|
requireString(options.apiKey, "apiKey", "Gemini");
|
|
180
182
|
requireString(options.model, "model", "Gemini");
|
|
183
|
+
if (options.url !== undefined) {
|
|
184
|
+
requireString(options.url, "url", "Gemini");
|
|
185
|
+
}
|
|
181
186
|
this.options = options;
|
|
182
187
|
}
|
|
183
188
|
toConfig() {
|
|
184
189
|
const { apiKey, model, url, maxHistory, temperature, topP, topK, maxOutputTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
190
|
+
const defaultUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${encodeURIComponent(apiKey)}`;
|
|
185
191
|
return {
|
|
186
|
-
url: url !== null && url !== void 0 ? url :
|
|
187
|
-
api_key: apiKey,
|
|
192
|
+
url: url !== null && url !== void 0 ? url : defaultUrl,
|
|
188
193
|
// model is the default; params entries extend it; named fields win.
|
|
189
194
|
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 })),
|
|
190
195
|
headers,
|
|
191
196
|
max_history: maxHistory,
|
|
192
197
|
system_messages: systemMessages,
|
|
193
198
|
greeting_message: greetingMessage,
|
|
199
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
194
200
|
failure_message: failureMessage,
|
|
195
201
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
196
202
|
output_modalities: this.outputModalities,
|
|
@@ -213,6 +219,7 @@ function openAIStyleConfig(options, vendor) {
|
|
|
213
219
|
max_history: options.maxHistory,
|
|
214
220
|
system_messages: options.systemMessages,
|
|
215
221
|
greeting_message: options.greetingMessage,
|
|
222
|
+
greeting_audio_url: options.greetingAudioUrl,
|
|
216
223
|
failure_message: options.failureMessage,
|
|
217
224
|
input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
218
225
|
output_modalities: options.outputModalities,
|
|
@@ -270,6 +277,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
|
|
|
270
277
|
max_history: o.maxHistory,
|
|
271
278
|
system_messages: o.systemMessages,
|
|
272
279
|
greeting_message: o.greetingMessage,
|
|
280
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
273
281
|
failure_message: o.failureMessage,
|
|
274
282
|
input_modalities: (_b = o.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
|
|
275
283
|
output_modalities: this.outputModalities,
|
|
@@ -305,6 +313,7 @@ class AmazonBedrock extends base_js_1.BaseLLM {
|
|
|
305
313
|
max_history: o.maxHistory,
|
|
306
314
|
system_messages: o.systemMessages,
|
|
307
315
|
greeting_message: o.greetingMessage,
|
|
316
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
308
317
|
failure_message: o.failureMessage,
|
|
309
318
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
310
319
|
output_modalities: this.outputModalities,
|
|
@@ -336,6 +345,7 @@ class Dify extends base_js_1.BaseLLM {
|
|
|
336
345
|
max_history: o.maxHistory,
|
|
337
346
|
system_messages: o.systemMessages,
|
|
338
347
|
greeting_message: o.greetingMessage,
|
|
348
|
+
greeting_audio_url: this.greetingAudioUrl,
|
|
339
349
|
failure_message: o.failureMessage,
|
|
340
350
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
341
351
|
output_modalities: this.outputModalities,
|