agora-agents 2.3.1 → 2.5.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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.js +8 -16
- package/dist/cjs/agentkit/Agent.js +6 -5
- package/dist/cjs/agentkit/AgentSession.js +2 -0
- package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +4 -0
- package/dist/cjs/agentkit/avatar-types.d.ts +18 -5
- package/dist/cjs/agentkit/avatar-types.js +31 -3
- package/dist/cjs/agentkit/constants.d.ts +6 -0
- package/dist/cjs/agentkit/constants.js +6 -1
- package/dist/cjs/agentkit/index.d.ts +10 -10
- package/dist/cjs/agentkit/index.js +11 -3
- package/dist/cjs/agentkit/region-vendors.d.ts +2 -1
- package/dist/cjs/agentkit/types.d.ts +26 -5
- package/dist/cjs/agentkit/vendors/avatar.d.ts +3 -3
- package/dist/cjs/agentkit/vendors/avatar.js +3 -3
- package/dist/cjs/agentkit/vendors/base.d.ts +4 -0
- package/dist/cjs/agentkit/vendors/base.js +4 -0
- package/dist/cjs/agentkit/vendors/cn.d.ts +19 -1
- package/dist/cjs/agentkit/vendors/cn.js +23 -3
- 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 +1 -1
- package/dist/cjs/agentkit/vendors/mllm.js +3 -3
- package/dist/cjs/agentkit/vendors/stt.d.ts +31 -0
- package/dist/cjs/agentkit/vendors/stt.js +26 -1
- package/dist/cjs/agentkit/vendors/tts.d.ts +137 -5
- package/dist/cjs/agentkit/vendors/tts.js +104 -5
- package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +2 -3
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +18 -1
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +8 -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 +4 -1
- package/dist/cjs/api/types/GenericHttpTts.d.ts +13 -0
- package/dist/cjs/api/types/GenericHttpTts.js +3 -0
- package/dist/cjs/api/types/GenericHttpTtsParams.d.ts +21 -0
- package/dist/cjs/api/types/GenericHttpTtsParams.js +3 -0
- package/dist/cjs/api/types/GradiumTts.d.ts +9 -0
- package/dist/cjs/api/types/GradiumTts.js +3 -0
- package/dist/cjs/api/types/GradiumTtsParams.d.ts +17 -0
- package/dist/cjs/api/types/GradiumTtsParams.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/MistralTts.d.ts +9 -0
- package/dist/cjs/api/types/MistralTts.js +3 -0
- package/dist/cjs/api/types/MistralTtsParams.d.ts +13 -0
- package/dist/cjs/api/types/MistralTtsParams.js +3 -0
- package/dist/cjs/api/types/RimeTts.d.ts +10 -0
- package/dist/cjs/api/types/RimeTts.js +9 -0
- package/dist/cjs/api/types/RimeTtsParams.d.ts +2 -2
- package/dist/cjs/api/types/SpatiusAvatarParams.d.ts +23 -0
- package/dist/cjs/api/types/SpatiusAvatarParams.js +3 -0
- package/dist/cjs/api/types/Tts.d.ts +13 -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/index.d.ts +11 -0
- package/dist/cjs/api/types/index.js +11 -0
- package/dist/cjs/core/base64.js +1 -5
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +11 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.mjs +8 -16
- package/dist/esm/agentkit/Agent.mjs +6 -5
- package/dist/esm/agentkit/AgentSession.mjs +3 -1
- package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +5 -1
- package/dist/esm/agentkit/avatar-types.d.mts +18 -5
- package/dist/esm/agentkit/avatar-types.mjs +30 -3
- package/dist/esm/agentkit/constants.d.mts +6 -0
- package/dist/esm/agentkit/constants.mjs +5 -0
- package/dist/esm/agentkit/index.d.mts +10 -10
- package/dist/esm/agentkit/index.mjs +5 -5
- package/dist/esm/agentkit/region-vendors.d.mts +2 -1
- package/dist/esm/agentkit/types.d.mts +26 -5
- package/dist/esm/agentkit/vendors/avatar.d.mts +3 -3
- package/dist/esm/agentkit/vendors/avatar.mjs +3 -3
- package/dist/esm/agentkit/vendors/base.d.mts +4 -0
- package/dist/esm/agentkit/vendors/base.mjs +4 -0
- package/dist/esm/agentkit/vendors/cn.d.mts +19 -1
- package/dist/esm/agentkit/vendors/cn.mjs +21 -2
- 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 +1 -1
- package/dist/esm/agentkit/vendors/mllm.mjs +3 -3
- package/dist/esm/agentkit/vendors/stt.d.mts +31 -0
- package/dist/esm/agentkit/vendors/stt.mjs +24 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +137 -5
- package/dist/esm/agentkit/vendors/tts.mjs +99 -4
- package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +2 -3
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +18 -1
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +8 -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 +4 -1
- package/dist/esm/api/types/GenericHttpTts.d.mts +13 -0
- package/dist/esm/api/types/GenericHttpTts.mjs +2 -0
- package/dist/esm/api/types/GenericHttpTtsParams.d.mts +21 -0
- package/dist/esm/api/types/GenericHttpTtsParams.mjs +2 -0
- package/dist/esm/api/types/GradiumTts.d.mts +9 -0
- package/dist/esm/api/types/GradiumTts.mjs +2 -0
- package/dist/esm/api/types/GradiumTtsParams.d.mts +17 -0
- package/dist/esm/api/types/GradiumTtsParams.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/MistralTts.d.mts +9 -0
- package/dist/esm/api/types/MistralTts.mjs +2 -0
- package/dist/esm/api/types/MistralTtsParams.d.mts +13 -0
- package/dist/esm/api/types/MistralTtsParams.mjs +2 -0
- package/dist/esm/api/types/RimeTts.d.mts +10 -0
- package/dist/esm/api/types/RimeTts.mjs +8 -1
- package/dist/esm/api/types/RimeTtsParams.d.mts +2 -2
- package/dist/esm/api/types/SpatiusAvatarParams.d.mts +23 -0
- package/dist/esm/api/types/SpatiusAvatarParams.mjs +2 -0
- package/dist/esm/api/types/Tts.d.mts +13 -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/index.d.mts +11 -0
- package/dist/esm/api/types/index.mjs +11 -0
- package/dist/esm/core/base64.mjs +1 -5
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +5 -5
- 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
|
@@ -151,8 +151,8 @@ export declare class HeyGenAvatar extends BaseAvatar<HeyGenSampleRate> {
|
|
|
151
151
|
export interface AnamAvatarOptions {
|
|
152
152
|
/** Anam API key */
|
|
153
153
|
apiKey: string;
|
|
154
|
-
/** Anam
|
|
155
|
-
|
|
154
|
+
/** Anam avatar ID */
|
|
155
|
+
avatarId?: string;
|
|
156
156
|
/** Enable avatar (default: true) */
|
|
157
157
|
enable?: boolean;
|
|
158
158
|
/** Additional vendor-specific parameters */
|
|
@@ -167,7 +167,7 @@ export interface AnamAvatarOptions {
|
|
|
167
167
|
*
|
|
168
168
|
* const avatar = new AnamAvatar({
|
|
169
169
|
* apiKey: process.env.ANAM_API_KEY,
|
|
170
|
-
*
|
|
170
|
+
* avatarId: 'avatar-id',
|
|
171
171
|
* });
|
|
172
172
|
*
|
|
173
173
|
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
@@ -165,7 +165,7 @@ export class HeyGenAvatar extends BaseAvatar {
|
|
|
165
165
|
*
|
|
166
166
|
* const avatar = new AnamAvatar({
|
|
167
167
|
* apiKey: process.env.ANAM_API_KEY,
|
|
168
|
-
*
|
|
168
|
+
* avatarId: 'avatar-id',
|
|
169
169
|
* });
|
|
170
170
|
*
|
|
171
171
|
* const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
|
|
@@ -189,11 +189,11 @@ export class AnamAvatar extends BaseAvatar {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
toConfig() {
|
|
192
|
-
const { apiKey,
|
|
192
|
+
const { apiKey, avatarId, enable = true, additionalParams } = this.options;
|
|
193
193
|
return {
|
|
194
194
|
enable,
|
|
195
195
|
vendor: "anam",
|
|
196
|
-
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (
|
|
196
|
+
params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (avatarId && { avatar_id: avatarId })),
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -25,6 +25,8 @@ export interface BaseLlmOptions {
|
|
|
25
25
|
* - `"single_first"`: Broadcasts a greeting only once to the first user.
|
|
26
26
|
*/
|
|
27
27
|
greetingConfigs?: LlmGreetingConfigs;
|
|
28
|
+
/** Publicly accessible greeting audio URL played when the session starts. */
|
|
29
|
+
greetingAudioUrl?: string;
|
|
28
30
|
/**
|
|
29
31
|
* Key-value pairs injected into `system_messages`, `greeting_message`, and
|
|
30
32
|
* `failure_message` via `{{variable_name}}` syntax. Useful for per-session
|
|
@@ -87,12 +89,14 @@ declare abstract class ScopedBaseLLM<TScope extends VendorScope> {
|
|
|
87
89
|
readonly areaScope: TScope;
|
|
88
90
|
private readonly _outputModalities?;
|
|
89
91
|
private readonly _greetingConfigs?;
|
|
92
|
+
private readonly _greetingAudioUrl?;
|
|
90
93
|
private readonly _templateVariables?;
|
|
91
94
|
private readonly _vendor?;
|
|
92
95
|
private readonly _mcpServers?;
|
|
93
96
|
constructor(areaScope: TScope, options?: BaseLlmOptions);
|
|
94
97
|
protected get outputModalities(): string[] | undefined;
|
|
95
98
|
protected get greetingConfigs(): LlmGreetingConfigs | undefined;
|
|
99
|
+
protected get greetingAudioUrl(): string | undefined;
|
|
96
100
|
protected get templateVariables(): Record<string, string> | undefined;
|
|
97
101
|
protected get vendor(): string | undefined;
|
|
98
102
|
/** MCP servers with transport defaulted to streamable_http (API requires it; only option). */
|
|
@@ -13,6 +13,7 @@ class ScopedBaseLLM {
|
|
|
13
13
|
this.areaScope = areaScope;
|
|
14
14
|
this._outputModalities = options === null || options === void 0 ? void 0 : options.outputModalities;
|
|
15
15
|
this._greetingConfigs = options === null || options === void 0 ? void 0 : options.greetingConfigs;
|
|
16
|
+
this._greetingAudioUrl = options === null || options === void 0 ? void 0 : options.greetingAudioUrl;
|
|
16
17
|
this._templateVariables = options === null || options === void 0 ? void 0 : options.templateVariables;
|
|
17
18
|
this._vendor = options === null || options === void 0 ? void 0 : options.vendor;
|
|
18
19
|
this._mcpServers = options === null || options === void 0 ? void 0 : options.mcpServers;
|
|
@@ -23,6 +24,9 @@ class ScopedBaseLLM {
|
|
|
23
24
|
get greetingConfigs() {
|
|
24
25
|
return this._greetingConfigs;
|
|
25
26
|
}
|
|
27
|
+
get greetingAudioUrl() {
|
|
28
|
+
return this._greetingAudioUrl;
|
|
29
|
+
}
|
|
26
30
|
get templateVariables() {
|
|
27
31
|
return this._templateVariables;
|
|
28
32
|
}
|
|
@@ -238,7 +238,7 @@ export interface SensetimeAvatarOptions {
|
|
|
238
238
|
agoraToken?: string;
|
|
239
239
|
appId: string;
|
|
240
240
|
appKey: string;
|
|
241
|
-
sceneList
|
|
241
|
+
sceneList?: Record<string, unknown>[];
|
|
242
242
|
enable?: boolean;
|
|
243
243
|
additionalParams?: Record<string, unknown>;
|
|
244
244
|
}
|
|
@@ -248,4 +248,22 @@ export declare class SensetimeAvatar extends BaseCNAvatar<number> {
|
|
|
248
248
|
constructor(options: SensetimeAvatarOptions);
|
|
249
249
|
toConfig(): AvatarConfig;
|
|
250
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
|
+
}
|
|
251
269
|
export {};
|
|
@@ -206,7 +206,7 @@ export class StepFunTTS extends BaseCNTTS {
|
|
|
206
206
|
}
|
|
207
207
|
function cnLlmConfig(options, vendor) {
|
|
208
208
|
var _a;
|
|
209
|
-
return Object.assign(Object.assign({ url: options.url }, (options.apiKey && { api_key: options.apiKey })), { params: Object.assign({ model: options.model }, options.params), headers: options.headers, max_history: options.maxHistory, system_messages: options.systemMessages, greeting_message: options.greetingMessage, failure_message: options.failureMessage, input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"], output_modalities: options.outputModalities, style: "openai", vendor, greeting_configs: options.greetingConfigs, template_variables: options.templateVariables, mcp_servers: options.mcpServers });
|
|
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
210
|
}
|
|
211
211
|
export class AliyunLLM extends BaseCNLLM {
|
|
212
212
|
constructor(options) {
|
|
@@ -266,7 +266,26 @@ export class SensetimeAvatar extends BaseCNAvatar {
|
|
|
266
266
|
return {
|
|
267
267
|
enable,
|
|
268
268
|
vendor: "sensetime",
|
|
269
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey, sceneList }),
|
|
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 })),
|
|
270
289
|
};
|
|
271
290
|
}
|
|
272
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,
|
|
@@ -21,7 +21,7 @@ export interface OpenAIRealtimeOptions {
|
|
|
21
21
|
instructions?: string;
|
|
22
22
|
/** Audio transcription settings */
|
|
23
23
|
inputAudioTranscription?: Record<string, unknown>;
|
|
24
|
-
/** WebSocket URL
|
|
24
|
+
/** WebSocket URL. Defaults to `wss://api.openai.com/v1/realtime` when omitted or empty. */
|
|
25
25
|
url?: string;
|
|
26
26
|
/** Agent greeting message */
|
|
27
27
|
greetingMessage?: string;
|
|
@@ -36,7 +36,7 @@ export class OpenAIRealtime extends BaseMLLM {
|
|
|
36
36
|
voice !== undefined ||
|
|
37
37
|
instructions !== undefined ||
|
|
38
38
|
inputAudioTranscription !== undefined;
|
|
39
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
39
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "openai", api_key: apiKey, url: url || "wss://api.openai.com/v1/realtime" }, (hasParams && { params: mergedParams })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
@@ -62,7 +62,7 @@ export class GeminiLive extends BaseMLLM {
|
|
|
62
62
|
}
|
|
63
63
|
toConfig() {
|
|
64
64
|
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
65
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
65
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey, url: url !== null && url !== void 0 ? url : "", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }, (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
@@ -90,7 +90,7 @@ export class VertexAI extends BaseMLLM {
|
|
|
90
90
|
}
|
|
91
91
|
toConfig() {
|
|
92
92
|
const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
93
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
93
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai", url: url !== null && url !== void 0 ? url : "", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model, project_id: projectId, location, adc_credentials_string: adcCredentialsString }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }, (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
@@ -285,4 +285,35 @@ export declare class SarvamSTT extends BaseSTT {
|
|
|
285
285
|
constructor(options: SarvamSTTOptions);
|
|
286
286
|
toConfig(): SttConfig;
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Constructor options for xAI STT.
|
|
290
|
+
*/
|
|
291
|
+
export interface XAiSTTOptions {
|
|
292
|
+
/** xAI API key */
|
|
293
|
+
apiKey: string;
|
|
294
|
+
/** Language code for speech recognition */
|
|
295
|
+
language?: string;
|
|
296
|
+
/** WebSocket endpoint URL for the xAI streaming STT API */
|
|
297
|
+
baseUrl?: string;
|
|
298
|
+
/** Audio sample rate in Hz */
|
|
299
|
+
sampleRate?: number;
|
|
300
|
+
/** Additional vendor-specific parameters */
|
|
301
|
+
additionalParams?: Record<string, unknown>;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* xAI STT vendor.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* const stt = new XAiSTT({
|
|
309
|
+
* apiKey: process.env.XAI_API_KEY,
|
|
310
|
+
* language: 'en',
|
|
311
|
+
* });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export declare class XAiSTT extends BaseSTT {
|
|
315
|
+
private readonly options;
|
|
316
|
+
constructor(options: XAiSTTOptions);
|
|
317
|
+
toConfig(): SttConfig;
|
|
318
|
+
}
|
|
288
319
|
export {};
|
|
@@ -237,3 +237,27 @@ export class SarvamSTT extends BaseSTT {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* xAI STT vendor.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* const stt = new XAiSTT({
|
|
246
|
+
* apiKey: process.env.XAI_API_KEY,
|
|
247
|
+
* language: 'en',
|
|
248
|
+
* });
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export class XAiSTT extends BaseSTT {
|
|
252
|
+
constructor(options) {
|
|
253
|
+
super();
|
|
254
|
+
this.options = options;
|
|
255
|
+
}
|
|
256
|
+
toConfig() {
|
|
257
|
+
const { apiKey, language, baseUrl, sampleRate, additionalParams } = this.options;
|
|
258
|
+
return {
|
|
259
|
+
vendor: "xai",
|
|
260
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (baseUrl !== undefined && { base_url: baseUrl })), (sampleRate !== undefined && { sample_rate: sampleRate })), (language !== undefined && { language })),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
3
3
|
*/
|
|
4
|
+
import { CredentialMode } from "../constants.mjs";
|
|
4
5
|
import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.mjs";
|
|
5
6
|
import type { TtsConfig } from "../types.mjs";
|
|
6
7
|
import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.mjs";
|
|
@@ -279,6 +280,48 @@ export declare class DeepgramTTS extends BaseTTS {
|
|
|
279
280
|
constructor(options: DeepgramTTSOptions);
|
|
280
281
|
toConfig(): TtsConfig;
|
|
281
282
|
}
|
|
283
|
+
/** Constructor options for Gradium TTS. */
|
|
284
|
+
export interface GradiumTTSOptions {
|
|
285
|
+
/** Gradium API key */
|
|
286
|
+
apiKey: string;
|
|
287
|
+
/** WebSocket endpoint for streaming TTS output */
|
|
288
|
+
url?: string;
|
|
289
|
+
/** Gradium TTS model name (e.g., 'default') */
|
|
290
|
+
modelName?: string;
|
|
291
|
+
/** Gradium voice identifier */
|
|
292
|
+
voiceId?: string;
|
|
293
|
+
/** Audio sample rate in Hz */
|
|
294
|
+
sampleRate?: number;
|
|
295
|
+
/** Additional vendor-specific parameters */
|
|
296
|
+
additionalParams?: Record<string, unknown>;
|
|
297
|
+
/** Skip patterns for bracketed content */
|
|
298
|
+
skipPatterns?: number[];
|
|
299
|
+
}
|
|
300
|
+
/** Gradium TTS vendor. */
|
|
301
|
+
export declare class GradiumTTS extends BaseTTS {
|
|
302
|
+
private readonly options;
|
|
303
|
+
constructor(options: GradiumTTSOptions);
|
|
304
|
+
toConfig(): TtsConfig;
|
|
305
|
+
}
|
|
306
|
+
/** Constructor options for Mistral TTS. */
|
|
307
|
+
export interface MistralTTSOptions {
|
|
308
|
+
/** Mistral API key */
|
|
309
|
+
apiKey: string;
|
|
310
|
+
/** Mistral TTS model name (e.g., 'voxtral-mini-tts-2603') */
|
|
311
|
+
model?: string;
|
|
312
|
+
/** Mistral voice identifier */
|
|
313
|
+
voice?: string;
|
|
314
|
+
/** Additional vendor-specific parameters */
|
|
315
|
+
additionalParams?: Record<string, unknown>;
|
|
316
|
+
/** Skip patterns for bracketed content */
|
|
317
|
+
skipPatterns?: number[];
|
|
318
|
+
}
|
|
319
|
+
/** Mistral TTS vendor. */
|
|
320
|
+
export declare class MistralTTS extends BaseTTS {
|
|
321
|
+
private readonly options;
|
|
322
|
+
constructor(options: MistralTTSOptions);
|
|
323
|
+
toConfig(): TtsConfig;
|
|
324
|
+
}
|
|
282
325
|
/**
|
|
283
326
|
* Constructor options for Hume AI TTS.
|
|
284
327
|
*/
|
|
@@ -319,8 +362,28 @@ export declare class HumeAITTS extends BaseTTS {
|
|
|
319
362
|
}
|
|
320
363
|
/**
|
|
321
364
|
* Constructor options for Rime TTS.
|
|
365
|
+
*
|
|
366
|
+
* - `credentialMode: CredentialMode.Managed` requires `baseUrl` and `modelId`
|
|
367
|
+
* - omitted / `CredentialMode.Byok` requires `key`, `speaker`, and `modelId`
|
|
322
368
|
*/
|
|
323
|
-
|
|
369
|
+
type RimeTTSCommonOptions = {
|
|
370
|
+
/** Skip patterns for bracketed content */
|
|
371
|
+
skipPatterns?: number[];
|
|
372
|
+
};
|
|
373
|
+
export type RimeTTSOptions = (RimeTTSCommonOptions & {
|
|
374
|
+
/** Use Agora-managed Rime credentials */
|
|
375
|
+
credentialMode: typeof CredentialMode.Managed;
|
|
376
|
+
/** Model ID */
|
|
377
|
+
modelId: string;
|
|
378
|
+
/** WebSocket URL for the Rime streaming API */
|
|
379
|
+
baseUrl: string;
|
|
380
|
+
/** Rime API key (optional for managed credentials) */
|
|
381
|
+
key?: string;
|
|
382
|
+
/** Speaker ID (optional for managed credentials) */
|
|
383
|
+
speaker?: string;
|
|
384
|
+
}) | (RimeTTSCommonOptions & {
|
|
385
|
+
/** Bring-your-own Rime credentials (default when omitted) */
|
|
386
|
+
credentialMode?: typeof CredentialMode.Byok;
|
|
324
387
|
/** Rime API key */
|
|
325
388
|
key: string;
|
|
326
389
|
/** Speaker ID */
|
|
@@ -329,15 +392,24 @@ export interface RimeTTSOptions {
|
|
|
329
392
|
modelId: string;
|
|
330
393
|
/** WebSocket URL for the Rime streaming API */
|
|
331
394
|
baseUrl?: string;
|
|
332
|
-
|
|
333
|
-
skipPatterns?: number[];
|
|
334
|
-
}
|
|
395
|
+
});
|
|
335
396
|
/**
|
|
336
397
|
* Rime TTS vendor.
|
|
337
398
|
*
|
|
338
399
|
* @example
|
|
400
|
+
* Agora-managed credentials:
|
|
401
|
+
* ```typescript
|
|
402
|
+
* const managedTts = new RimeTTS({
|
|
403
|
+
* credentialMode: CredentialMode.Managed,
|
|
404
|
+
* baseUrl: 'wss://users.rime.ai/ws',
|
|
405
|
+
* modelId: 'mist',
|
|
406
|
+
* });
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* Bring your own credentials (the default mode):
|
|
339
411
|
* ```typescript
|
|
340
|
-
* const
|
|
412
|
+
* const byokTts = new RimeTTS({
|
|
341
413
|
* key: process.env.RIME_API_KEY,
|
|
342
414
|
* speaker: 'speaker-id',
|
|
343
415
|
* modelId: 'mist',
|
|
@@ -501,4 +573,64 @@ export declare class MurfTTS extends BaseTTS {
|
|
|
501
573
|
constructor(options: MurfTTSOptions);
|
|
502
574
|
toConfig(): TtsConfig;
|
|
503
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Constructor options for Generic OpenAI-compatible TTS.
|
|
578
|
+
*/
|
|
579
|
+
export interface GenericTTSOptions {
|
|
580
|
+
/** HTTP(S) endpoint of the generic TTS service */
|
|
581
|
+
url: string;
|
|
582
|
+
/** Custom headers to include in requests to the generic TTS service */
|
|
583
|
+
headers?: Record<string, string>;
|
|
584
|
+
/** API key for the generic TTS service */
|
|
585
|
+
apiKey?: string;
|
|
586
|
+
/** TTS model name */
|
|
587
|
+
model?: string;
|
|
588
|
+
/** Voice name */
|
|
589
|
+
voice?: string;
|
|
590
|
+
/** Speech rate */
|
|
591
|
+
speed?: number;
|
|
592
|
+
/** Output audio sample rate in Hz */
|
|
593
|
+
sampleRate?: number;
|
|
594
|
+
/** Output audio format. ConvoAI currently supports `pcm` only. */
|
|
595
|
+
responseFormat?: "pcm";
|
|
596
|
+
/** Additional voice style control instruction */
|
|
597
|
+
instruction?: string;
|
|
598
|
+
/** Additional vendor-specific parameters */
|
|
599
|
+
additionalParams?: Record<string, unknown>;
|
|
600
|
+
/** Skip patterns for bracketed content */
|
|
601
|
+
skipPatterns?: number[];
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Generic OpenAI-compatible TTS vendor.
|
|
605
|
+
*/
|
|
606
|
+
export declare class GenericTTS extends BaseTTS {
|
|
607
|
+
private readonly options;
|
|
608
|
+
constructor(options: GenericTTSOptions);
|
|
609
|
+
toConfig(): TtsConfig;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Constructor options for xAI TTS.
|
|
613
|
+
*/
|
|
614
|
+
export interface XAiTTSOptions {
|
|
615
|
+
/** xAI API key */
|
|
616
|
+
apiKey: string;
|
|
617
|
+
/** BCP-47 language code for speech synthesis */
|
|
618
|
+
language: string;
|
|
619
|
+
/** xAI voice identifier */
|
|
620
|
+
voiceId?: string;
|
|
621
|
+
/** Audio sample rate in Hz */
|
|
622
|
+
sampleRate?: number;
|
|
623
|
+
/** Additional vendor-specific parameters */
|
|
624
|
+
additionalParams?: Record<string, unknown>;
|
|
625
|
+
/** Skip patterns for bracketed content */
|
|
626
|
+
skipPatterns?: number[];
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* xAI TTS vendor.
|
|
630
|
+
*/
|
|
631
|
+
export declare class XAiTTS extends BaseTTS {
|
|
632
|
+
private readonly options;
|
|
633
|
+
constructor(options: XAiTTSOptions);
|
|
634
|
+
toConfig(): TtsConfig;
|
|
635
|
+
}
|
|
504
636
|
export {};
|