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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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;
|
|
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
4
|
const base_js_1 = require("./base.js");
|
|
5
5
|
function requireString(value, field, vendor) {
|
|
6
6
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -222,7 +222,7 @@ class StepFunTTS extends base_js_1.BaseCNTTS {
|
|
|
222
222
|
exports.StepFunTTS = StepFunTTS;
|
|
223
223
|
function cnLlmConfig(options, vendor) {
|
|
224
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, 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 });
|
|
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
226
|
}
|
|
227
227
|
class AliyunLLM extends base_js_1.BaseCNLLM {
|
|
228
228
|
constructor(options) {
|
|
@@ -286,8 +286,28 @@ class SensetimeAvatar extends base_js_1.BaseCNAvatar {
|
|
|
286
286
|
return {
|
|
287
287
|
enable,
|
|
288
288
|
vendor: "sensetime",
|
|
289
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey, sceneList }),
|
|
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
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
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,
|
|
@@ -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;
|
|
@@ -39,7 +39,7 @@ class OpenAIRealtime extends base_js_1.BaseMLLM {
|
|
|
39
39
|
voice !== undefined ||
|
|
40
40
|
instructions !== undefined ||
|
|
41
41
|
inputAudioTranscription !== undefined;
|
|
42
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
42
|
+
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 }));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.OpenAIRealtime = OpenAIRealtime;
|
|
@@ -66,7 +66,7 @@ class GeminiLive extends base_js_1.BaseMLLM {
|
|
|
66
66
|
}
|
|
67
67
|
toConfig() {
|
|
68
68
|
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
69
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
69
|
+
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 }));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.GeminiLive = GeminiLive;
|
|
@@ -95,7 +95,7 @@ class VertexAI extends base_js_1.BaseMLLM {
|
|
|
95
95
|
}
|
|
96
96
|
toConfig() {
|
|
97
97
|
const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
98
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
98
|
+
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 }));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
exports.VertexAI = VertexAI;
|
|
@@ -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 {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type-safe STT (Speech-to-Text) vendor classes.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = void 0;
|
|
6
|
+
exports.XAiSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = void 0;
|
|
7
7
|
const presets_js_1 = require("../presets.js");
|
|
8
8
|
const base_js_1 = require("./base.js");
|
|
9
9
|
function _requireString(value, field, vendor) {
|
|
@@ -249,3 +249,28 @@ class SarvamSTT extends base_js_1.BaseSTT {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
exports.SarvamSTT = SarvamSTT;
|
|
252
|
+
/**
|
|
253
|
+
* xAI STT vendor.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const stt = new XAiSTT({
|
|
258
|
+
* apiKey: process.env.XAI_API_KEY,
|
|
259
|
+
* language: 'en',
|
|
260
|
+
* });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
class XAiSTT extends base_js_1.BaseSTT {
|
|
264
|
+
constructor(options) {
|
|
265
|
+
super();
|
|
266
|
+
this.options = options;
|
|
267
|
+
}
|
|
268
|
+
toConfig() {
|
|
269
|
+
const { apiKey, language, baseUrl, sampleRate, additionalParams } = this.options;
|
|
270
|
+
return {
|
|
271
|
+
vendor: "xai",
|
|
272
|
+
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 })),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.XAiSTT = XAiSTT;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
3
3
|
*/
|
|
4
|
+
import { CredentialMode } from "../constants.js";
|
|
4
5
|
import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.js";
|
|
5
6
|
import type { TtsConfig } from "../types.js";
|
|
6
7
|
import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.js";
|
|
@@ -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 {};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
|
|
6
|
+
exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
|
|
7
|
+
const constants_js_1 = require("../constants.js");
|
|
7
8
|
const presets_js_1 = require("../presets.js");
|
|
8
9
|
const base_js_1 = require("./base.js");
|
|
9
10
|
function requireString(value, field, vendor) {
|
|
@@ -11,6 +12,11 @@ function requireString(value, field, vendor) {
|
|
|
11
12
|
throw new Error(`${vendor} requires ${field}`);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
function requireRecord(value, field, vendor) {
|
|
16
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) {
|
|
17
|
+
throw new Error(`${vendor} requires ${field}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
function isOpenAITtsManagedModel(model) {
|
|
15
21
|
return model === undefined || presets_js_1.OpenAITtsPresetModels.includes(model.trim().toLowerCase());
|
|
16
22
|
}
|
|
@@ -191,6 +197,32 @@ class DeepgramTTS extends base_js_1.BaseTTS {
|
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
exports.DeepgramTTS = DeepgramTTS;
|
|
200
|
+
/** Gradium TTS vendor. */
|
|
201
|
+
class GradiumTTS extends base_js_1.BaseTTS {
|
|
202
|
+
constructor(options) {
|
|
203
|
+
super();
|
|
204
|
+
requireString(options.apiKey, "apiKey", "GradiumTTS");
|
|
205
|
+
this.options = options;
|
|
206
|
+
}
|
|
207
|
+
toConfig() {
|
|
208
|
+
const { apiKey, url, modelName, voiceId, sampleRate, additionalParams, skipPatterns } = this.options;
|
|
209
|
+
return Object.assign({ vendor: "gradium", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (url !== undefined && { url })), (modelName !== undefined && { model_name: modelName })), (voiceId !== undefined && { voice_id: voiceId })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.GradiumTTS = GradiumTTS;
|
|
213
|
+
/** Mistral TTS vendor. */
|
|
214
|
+
class MistralTTS extends base_js_1.BaseTTS {
|
|
215
|
+
constructor(options) {
|
|
216
|
+
super();
|
|
217
|
+
requireString(options.apiKey, "apiKey", "MistralTTS");
|
|
218
|
+
this.options = options;
|
|
219
|
+
}
|
|
220
|
+
toConfig() {
|
|
221
|
+
const { apiKey, model, voice, additionalParams, skipPatterns } = this.options;
|
|
222
|
+
return Object.assign({ vendor: "mistral", params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (model !== undefined && { model })), (voice !== undefined && { voice })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.MistralTTS = MistralTTS;
|
|
194
226
|
/**
|
|
195
227
|
* Hume AI TTS vendor.
|
|
196
228
|
*
|
|
@@ -218,8 +250,19 @@ exports.HumeAITTS = HumeAITTS;
|
|
|
218
250
|
* Rime TTS vendor.
|
|
219
251
|
*
|
|
220
252
|
* @example
|
|
253
|
+
* Agora-managed credentials:
|
|
254
|
+
* ```typescript
|
|
255
|
+
* const managedTts = new RimeTTS({
|
|
256
|
+
* credentialMode: CredentialMode.Managed,
|
|
257
|
+
* baseUrl: 'wss://users.rime.ai/ws',
|
|
258
|
+
* modelId: 'mist',
|
|
259
|
+
* });
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* Bring your own credentials (the default mode):
|
|
221
264
|
* ```typescript
|
|
222
|
-
* const
|
|
265
|
+
* const byokTts = new RimeTTS({
|
|
223
266
|
* key: process.env.RIME_API_KEY,
|
|
224
267
|
* speaker: 'speaker-id',
|
|
225
268
|
* modelId: 'mist',
|
|
@@ -229,12 +272,23 @@ exports.HumeAITTS = HumeAITTS;
|
|
|
229
272
|
class RimeTTS extends base_js_1.BaseTTS {
|
|
230
273
|
constructor(options) {
|
|
231
274
|
super();
|
|
275
|
+
requireString(options.modelId, "modelId", "RimeTTS");
|
|
276
|
+
if (options.credentialMode === constants_js_1.CredentialMode.Managed) {
|
|
277
|
+
requireString(options.baseUrl, "baseUrl", "RimeTTS");
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
requireString(options.key, "key", "RimeTTS");
|
|
281
|
+
requireString(options.speaker, "speaker", "RimeTTS");
|
|
282
|
+
}
|
|
232
283
|
this.options = options;
|
|
233
284
|
}
|
|
234
285
|
toConfig() {
|
|
235
|
-
const { key, speaker, modelId, baseUrl, skipPatterns } = this.options;
|
|
236
|
-
|
|
237
|
-
|
|
286
|
+
const { key, speaker, modelId, baseUrl, skipPatterns, credentialMode } = this.options;
|
|
287
|
+
if (credentialMode === constants_js_1.CredentialMode.Managed) {
|
|
288
|
+
return Object.assign({ vendor: "rime", credential_mode: constants_js_1.CredentialMode.Managed, params: Object.assign(Object.assign({ modelId, base_url: baseUrl }, (key !== undefined && { api_key: key })), (speaker !== undefined && { speaker })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
289
|
+
}
|
|
290
|
+
return Object.assign(Object.assign(Object.assign({ vendor: "rime" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign({ api_key: key, speaker,
|
|
291
|
+
modelId }, (baseUrl && { base_url: baseUrl })) }), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
238
292
|
}
|
|
239
293
|
}
|
|
240
294
|
exports.RimeTTS = RimeTTS;
|
|
@@ -344,3 +398,48 @@ class MurfTTS extends base_js_1.BaseTTS {
|
|
|
344
398
|
}
|
|
345
399
|
}
|
|
346
400
|
exports.MurfTTS = MurfTTS;
|
|
401
|
+
function requireGenericTtsHttpUrl(url) {
|
|
402
|
+
requireString(url, "url", "GenericTTS");
|
|
403
|
+
let protocol;
|
|
404
|
+
try {
|
|
405
|
+
protocol = new URL(url).protocol;
|
|
406
|
+
}
|
|
407
|
+
catch (_a) {
|
|
408
|
+
throw new Error("GenericTTS requires url to be a valid absolute URL");
|
|
409
|
+
}
|
|
410
|
+
if (protocol === "http:" || protocol === "https:") {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
throw new Error(`GenericTTS does not support the ${protocol} protocol`);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Generic OpenAI-compatible TTS vendor.
|
|
417
|
+
*/
|
|
418
|
+
class GenericTTS extends base_js_1.BaseTTS {
|
|
419
|
+
constructor(options) {
|
|
420
|
+
super();
|
|
421
|
+
requireGenericTtsHttpUrl(options.url);
|
|
422
|
+
this.options = options;
|
|
423
|
+
}
|
|
424
|
+
toConfig() {
|
|
425
|
+
const { url, headers, apiKey, model, voice, speed, sampleRate, responseFormat, instruction, additionalParams, skipPatterns, } = this.options;
|
|
426
|
+
return Object.assign(Object.assign(Object.assign({ vendor: "generic_http", url }, (headers && { headers })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey !== undefined && { api_key: apiKey })), (model !== undefined && { model })), (voice !== undefined && { voice })), (speed !== undefined && { speed })), (sampleRate !== undefined && { sample_rate: sampleRate })), (responseFormat !== undefined && { response_format: responseFormat })), (instruction !== undefined && { instruction })) }), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
exports.GenericTTS = GenericTTS;
|
|
430
|
+
/**
|
|
431
|
+
* xAI TTS vendor.
|
|
432
|
+
*/
|
|
433
|
+
class XAiTTS extends base_js_1.BaseTTS {
|
|
434
|
+
constructor(options) {
|
|
435
|
+
super();
|
|
436
|
+
requireString(options.apiKey, "apiKey", "XAiTTS");
|
|
437
|
+
requireString(options.language, "language", "XAiTTS");
|
|
438
|
+
this.options = options;
|
|
439
|
+
}
|
|
440
|
+
toConfig() {
|
|
441
|
+
const { apiKey, language, voiceId, sampleRate, additionalParams, skipPatterns } = this.options;
|
|
442
|
+
return Object.assign({ vendor: "xai", params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (voiceId !== undefined && { voice_id: voiceId })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
exports.XAiTTS = XAiTTS;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type * as Agora from "../../../../index.js";
|
|
2
1
|
/**
|
|
3
2
|
* @example
|
|
4
3
|
* {
|
|
@@ -15,7 +14,7 @@ export interface ListAgentsRequest {
|
|
|
15
14
|
/** The end timestamp (in seconds) for the query. Default is current time. */
|
|
16
15
|
to_time?: number;
|
|
17
16
|
/**
|
|
18
|
-
* The agent state
|
|
17
|
+
* The agent state filter. You can specify one or more agent states as a comma-separated list in a single request, for example `state=0,1,2`:
|
|
19
18
|
* - `IDLE` (0): Agent is idle.
|
|
20
19
|
* - `STARTING` (1): The agent is being started.
|
|
21
20
|
* - `RUNNING` (2): The agent is running.
|
|
@@ -23,7 +22,7 @@ export interface ListAgentsRequest {
|
|
|
23
22
|
* - `STOPPED` (4): The agent has exited.
|
|
24
23
|
* - `FAILED` (6): The agent failed to execute.
|
|
25
24
|
*/
|
|
26
|
-
state?:
|
|
25
|
+
state?: string;
|
|
27
26
|
/** The maximum number of entries returned per page. */
|
|
28
27
|
limit?: number;
|
|
29
28
|
/** The paging cursor, indicating the starting position (`agent_id`) of the next page of results. */
|