agora-agents 3.0.0-alpha.1 → 3.0.0-alpha.2
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 +10 -4
- package/dist/cjs/AgoraPoolClient.d.ts +3 -3
- package/dist/cjs/AgoraPoolClient.js +3 -1
- package/dist/cjs/agentkit/Agent.d.ts +7 -1
- package/dist/cjs/agentkit/Agent.js +70 -47
- package/dist/cjs/agentkit/index.d.ts +1 -1
- package/dist/cjs/agentkit/session-backend.d.ts +5 -3
- package/dist/cjs/agentkit/session-backend.js +69 -8
- package/dist/cjs/agentkit/types.d.ts +8 -2
- package/dist/cjs/agentkit/v3.d.ts +5 -1
- package/dist/cjs/agentkit/v3.js +59 -17
- package/dist/cjs/agentkit/vendors/avatar.d.ts +24 -12
- package/dist/cjs/agentkit/vendors/avatar.js +48 -3
- package/dist/cjs/agentkit/vendors/llm.d.ts +7 -7
- package/dist/cjs/agentkit/vendors/llm.js +26 -22
- package/dist/cjs/agentkit/vendors/tts.d.ts +20 -0
- package/dist/cjs/agentkit/vendors/tts.js +5 -2
- package/dist/cjs/v3/contract.js +113 -4
- package/dist/cjs/v3/resources.js +0 -1
- package/dist/cjs/v3/types.d.ts +13 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.d.mts +3 -3
- package/dist/esm/AgoraPoolClient.mjs +3 -1
- package/dist/esm/agentkit/Agent.d.mts +7 -1
- package/dist/esm/agentkit/Agent.mjs +71 -48
- package/dist/esm/agentkit/index.d.mts +1 -1
- package/dist/esm/agentkit/session-backend.d.mts +5 -3
- package/dist/esm/agentkit/session-backend.mjs +68 -8
- package/dist/esm/agentkit/types.d.mts +8 -2
- package/dist/esm/agentkit/v3.d.mts +5 -1
- package/dist/esm/agentkit/v3.mjs +60 -18
- package/dist/esm/agentkit/vendors/avatar.d.mts +24 -12
- package/dist/esm/agentkit/vendors/avatar.mjs +45 -6
- package/dist/esm/agentkit/vendors/llm.d.mts +7 -7
- package/dist/esm/agentkit/vendors/llm.mjs +26 -22
- package/dist/esm/agentkit/vendors/tts.d.mts +20 -0
- package/dist/esm/agentkit/vendors/tts.mjs +5 -2
- package/dist/esm/v3/contract.mjs +113 -4
- package/dist/esm/v3/resources.mjs +0 -1
- package/dist/esm/v3/types.d.mts +13 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi.yaml +73 -4
- package/package.json +5 -3
|
@@ -228,15 +228,27 @@ export declare class GenericAvatar extends BaseAvatar<number> {
|
|
|
228
228
|
constructor(options: GenericAvatarOptions);
|
|
229
229
|
toConfig(): AvatarConfig;
|
|
230
230
|
}
|
|
231
|
-
/** Tavus
|
|
232
|
-
export
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
export
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
export
|
|
241
|
-
|
|
242
|
-
|
|
231
|
+
/** Tavus options with an optional provider endpoint override. */
|
|
232
|
+
export type TavusOptions = Omit<GenericAvatarOptions, "apiBaseUrl"> & {
|
|
233
|
+
apiBaseUrl?: string;
|
|
234
|
+
};
|
|
235
|
+
/** Protoface options with an optional provider endpoint override. */
|
|
236
|
+
export type ProtofaceOptions = TavusOptions;
|
|
237
|
+
export declare class Tavus extends GenericAvatar {
|
|
238
|
+
constructor(options: TavusOptions);
|
|
239
|
+
}
|
|
240
|
+
export declare class Protoface extends GenericAvatar {
|
|
241
|
+
constructor(options: ProtofaceOptions);
|
|
242
|
+
}
|
|
243
|
+
export interface LemonSliceOptions extends Omit<TavusOptions, "avatarId"> {
|
|
244
|
+
/** Provider-recommended fixed ID is lemonslice. Explicit overrides remain supported. */
|
|
245
|
+
avatarId?: string;
|
|
246
|
+
agentImageUrl?: string;
|
|
247
|
+
agentId?: string;
|
|
248
|
+
agentImageBase64?: string;
|
|
249
|
+
/** Omit to use the provider default of 2x3. */
|
|
250
|
+
aspectRatio?: "2x3" | "9x16" | "1x1";
|
|
251
|
+
}
|
|
252
|
+
export declare class LemonSlice extends GenericAvatar {
|
|
253
|
+
constructor(options: LemonSliceOptions);
|
|
254
|
+
}
|
|
@@ -244,6 +244,51 @@ class GenericAvatar extends base_js_1.BaseAvatar {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
exports.GenericAvatar = GenericAvatar;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
class Tavus extends GenericAvatar {
|
|
248
|
+
constructor(options) {
|
|
249
|
+
var _a;
|
|
250
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://tavusapi.com/v2/conversations/agora" }));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
exports.Tavus = Tavus;
|
|
254
|
+
class Protoface extends GenericAvatar {
|
|
255
|
+
constructor(options) {
|
|
256
|
+
var _a;
|
|
257
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://api.protoface.com/v1/agora" }));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
exports.Protoface = Protoface;
|
|
261
|
+
class LemonSlice extends GenericAvatar {
|
|
262
|
+
constructor(options) {
|
|
263
|
+
var _a, _b;
|
|
264
|
+
const params = Object.assign({}, options.additionalParams);
|
|
265
|
+
for (const [key, value] of [
|
|
266
|
+
["agent_image_url", options.agentImageUrl],
|
|
267
|
+
["agent_id", options.agentId],
|
|
268
|
+
["agent_image_base64", options.agentImageBase64],
|
|
269
|
+
["aspect_ratio", options.aspectRatio],
|
|
270
|
+
]) {
|
|
271
|
+
if (value !== undefined)
|
|
272
|
+
params[key] = value;
|
|
273
|
+
}
|
|
274
|
+
let selectors = 0;
|
|
275
|
+
for (const key of ["agent_id", "agent_image_url", "agent_image_base64"]) {
|
|
276
|
+
if (Object.keys(params).includes(key)) {
|
|
277
|
+
const value = params[key];
|
|
278
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
279
|
+
throw new Error(`LemonSlice ${key} must be a nonempty string`);
|
|
280
|
+
}
|
|
281
|
+
selectors++;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (selectors !== 1) {
|
|
285
|
+
throw new Error("LemonSlice requires exactly one of agent_id, agent_image_url, agent_image_base64");
|
|
286
|
+
}
|
|
287
|
+
if (Object.keys(params).includes("aspect_ratio") &&
|
|
288
|
+
!["2x3", "9x16", "1x1"].includes(params.aspect_ratio)) {
|
|
289
|
+
throw new Error("LemonSlice aspect_ratio must be 2x3, 9x16, or 1x1");
|
|
290
|
+
}
|
|
291
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://lemonslice.com/api/liveai/agora", avatarId: (_b = options.avatarId) !== null && _b !== void 0 ? _b : "lemonslice", additionalParams: params }));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.LemonSlice = LemonSlice;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe LLM (Large Language Model) vendor classes.
|
|
3
3
|
*/
|
|
4
|
-
import { type OpenAIPresetModel } from "../presets.js";
|
|
5
4
|
import type { LlmConfig } from "../types.js";
|
|
6
5
|
import { BaseLLM, type BaseLlmOptions } from "./base.js";
|
|
7
6
|
/**
|
|
8
7
|
* Constructor options for OpenAI LLM.
|
|
9
8
|
*/
|
|
10
9
|
type OpenAICommonOptions = BaseLlmOptions & {
|
|
11
|
-
/** OpenAI API key.
|
|
10
|
+
/** OpenAI API key. Omit for Agora-managed credentials; model availability is validated by the server. */
|
|
12
11
|
apiKey?: string;
|
|
13
12
|
/** Model name (e.g., 'gpt-4o-mini', 'gpt-4', 'gpt-3.5-turbo') */
|
|
14
13
|
model: string;
|
|
@@ -38,11 +37,10 @@ type OpenAICommonOptions = BaseLlmOptions & {
|
|
|
38
37
|
export type OpenAIOptions = (OpenAICommonOptions & {
|
|
39
38
|
apiKey: string;
|
|
40
39
|
url: string;
|
|
41
|
-
}) | (Omit<OpenAICommonOptions, "
|
|
40
|
+
}) | (Omit<OpenAICommonOptions, "apiKey" | "url" | "vendor"> & {
|
|
42
41
|
apiKey?: undefined;
|
|
43
|
-
model: OpenAIPresetModel;
|
|
44
42
|
url?: undefined;
|
|
45
|
-
vendor?:
|
|
43
|
+
vendor?: "openai";
|
|
46
44
|
});
|
|
47
45
|
/**
|
|
48
46
|
* OpenAI LLM vendor (and OpenAI-compatible APIs).
|
|
@@ -267,9 +265,11 @@ export declare class VertexAILLM extends BaseLLM {
|
|
|
267
265
|
}
|
|
268
266
|
export interface AmazonBedrockOptions extends BaseLlmOptions {
|
|
269
267
|
/** AWS access key ID. */
|
|
270
|
-
accessKey
|
|
268
|
+
accessKey?: string;
|
|
271
269
|
/** AWS secret access key. */
|
|
272
|
-
secretKey
|
|
270
|
+
secretKey?: string;
|
|
271
|
+
/** Bedrock API key, mutually exclusive with the AWS access-key pair. */
|
|
272
|
+
apiKey?: string;
|
|
273
273
|
/** AWS region. */
|
|
274
274
|
region: string;
|
|
275
275
|
model: string;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Dify = exports.AmazonBedrock = exports.VertexAILLM = exports.CustomLLM = exports.Groq = exports.Gemini = exports.Anthropic = exports.AzureOpenAI = exports.OpenAI = void 0;
|
|
7
|
-
const presets_js_1 = require("../presets.js");
|
|
8
7
|
const base_js_1 = require("./base.js");
|
|
9
8
|
function requireString(value, field, vendor) {
|
|
10
9
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -21,9 +20,6 @@ function requireRecord(value, field, vendor) {
|
|
|
21
20
|
throw new Error(`${vendor} requires ${field}`);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
function isOpenAIManagedModel(model) {
|
|
25
|
-
return presets_js_1.OpenAIPresetModels.includes(model.trim().toLowerCase());
|
|
26
|
-
}
|
|
27
23
|
/**
|
|
28
24
|
* OpenAI LLM vendor (and OpenAI-compatible APIs).
|
|
29
25
|
*
|
|
@@ -44,23 +40,20 @@ class OpenAI extends base_js_1.BaseLLM {
|
|
|
44
40
|
requireString(options.url, "url", "OpenAI");
|
|
45
41
|
}
|
|
46
42
|
else {
|
|
47
|
-
if (
|
|
48
|
-
throw new Error("OpenAI
|
|
49
|
-
}
|
|
43
|
+
if (options.vendor && options.vendor !== "openai")
|
|
44
|
+
throw new Error("OpenAI managed credentials require the openai vendor");
|
|
50
45
|
if (options.url) {
|
|
51
46
|
throw new Error("OpenAI Agora-managed mode does not allow url");
|
|
52
47
|
}
|
|
53
|
-
if (options.vendor) {
|
|
54
|
-
throw new Error("OpenAI Agora-managed mode does not allow vendor");
|
|
55
|
-
}
|
|
56
48
|
}
|
|
57
49
|
this.options = options;
|
|
58
50
|
}
|
|
59
51
|
toConfig() {
|
|
52
|
+
var _a;
|
|
60
53
|
const { apiKey, model, url, maxHistory, temperature, topP, maxTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
61
54
|
return Object.assign(Object.assign({ url: url !== null && url !== void 0 ? url : "https://api.openai.com/v1/chat/completions" }, (apiKey && { api_key: apiKey })), {
|
|
62
55
|
// 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, 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, tools: this.tools });
|
|
56
|
+
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: (_a = this.vendor) !== null && _a !== void 0 ? _a : "openai", greeting_configs: this.greetingConfigs, template_variables: this.templateVariables, mcp_servers: this.mcpServers, tools: this.tools });
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
exports.OpenAI = OpenAI;
|
|
@@ -142,6 +135,7 @@ class Anthropic extends base_js_1.BaseLLM {
|
|
|
142
135
|
this.options = options;
|
|
143
136
|
}
|
|
144
137
|
toConfig() {
|
|
138
|
+
var _a;
|
|
145
139
|
const { apiKey, model, url, maxHistory, maxTokens, temperature, topP, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
146
140
|
return {
|
|
147
141
|
url,
|
|
@@ -157,7 +151,7 @@ class Anthropic extends base_js_1.BaseLLM {
|
|
|
157
151
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
158
152
|
output_modalities: this.outputModalities,
|
|
159
153
|
style: "anthropic",
|
|
160
|
-
vendor: this.vendor,
|
|
154
|
+
vendor: (_a = this.vendor) !== null && _a !== void 0 ? _a : "anthropic",
|
|
161
155
|
greeting_configs: this.greetingConfigs,
|
|
162
156
|
template_variables: this.templateVariables,
|
|
163
157
|
mcp_servers: this.mcpServers,
|
|
@@ -188,10 +182,12 @@ class Gemini extends base_js_1.BaseLLM {
|
|
|
188
182
|
this.options = options;
|
|
189
183
|
}
|
|
190
184
|
toConfig() {
|
|
185
|
+
var _a;
|
|
191
186
|
const { apiKey, model, url, maxHistory, temperature, topP, topK, maxOutputTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
192
187
|
const defaultUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${encodeURIComponent(apiKey)}`;
|
|
193
188
|
return {
|
|
194
189
|
url: url !== null && url !== void 0 ? url : defaultUrl,
|
|
190
|
+
api_key: apiKey,
|
|
195
191
|
// model is the default; params entries extend it; named fields win.
|
|
196
192
|
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 })),
|
|
197
193
|
headers,
|
|
@@ -203,7 +199,7 @@ class Gemini extends base_js_1.BaseLLM {
|
|
|
203
199
|
input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
|
|
204
200
|
output_modalities: this.outputModalities,
|
|
205
201
|
style: "gemini",
|
|
206
|
-
vendor: this.vendor,
|
|
202
|
+
vendor: (_a = this.vendor) !== null && _a !== void 0 ? _a : "gemini",
|
|
207
203
|
greeting_configs: this.greetingConfigs,
|
|
208
204
|
template_variables: this.templateVariables,
|
|
209
205
|
mcp_servers: this.mcpServers,
|
|
@@ -243,7 +239,7 @@ class Groq extends base_js_1.BaseLLM {
|
|
|
243
239
|
requireString(options.url, "url", "Groq");
|
|
244
240
|
}
|
|
245
241
|
toConfig() {
|
|
246
|
-
return openAIStyleConfig(this.options);
|
|
242
|
+
return openAIStyleConfig(this.options, "groq");
|
|
247
243
|
}
|
|
248
244
|
}
|
|
249
245
|
exports.Groq = Groq;
|
|
@@ -270,7 +266,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
|
|
|
270
266
|
requireString(options.location, "location", "VertexAILLM");
|
|
271
267
|
}
|
|
272
268
|
toConfig() {
|
|
273
|
-
var _a, _b;
|
|
269
|
+
var _a, _b, _c;
|
|
274
270
|
const o = this.options;
|
|
275
271
|
const defaultUrl = `https://${o.location}-aiplatform.googleapis.com/v1/projects/${o.projectId}/locations/${o.location}/publishers/google/models/${o.model}:streamGenerateContent?alt=sse`;
|
|
276
272
|
return {
|
|
@@ -286,7 +282,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
|
|
|
286
282
|
input_modalities: (_b = o.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
|
|
287
283
|
output_modalities: this.outputModalities,
|
|
288
284
|
style: "gemini",
|
|
289
|
-
vendor: this.vendor,
|
|
285
|
+
vendor: (_c = this.vendor) !== null && _c !== void 0 ? _c : "vertexai",
|
|
290
286
|
greeting_configs: this.greetingConfigs,
|
|
291
287
|
template_variables: this.templateVariables,
|
|
292
288
|
mcp_servers: this.mcpServers,
|
|
@@ -299,16 +295,24 @@ class AmazonBedrock extends base_js_1.BaseLLM {
|
|
|
299
295
|
constructor(options) {
|
|
300
296
|
super(options);
|
|
301
297
|
this.options = options;
|
|
302
|
-
|
|
303
|
-
|
|
298
|
+
if (options.apiKey !== undefined) {
|
|
299
|
+
requireString(options.apiKey, "apiKey", "AmazonBedrock");
|
|
300
|
+
if (options.accessKey !== undefined || options.secretKey !== undefined)
|
|
301
|
+
throw new Error("Use apiKey or accessKey/secretKey, not both");
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
requireString(options.accessKey, "accessKey", "AmazonBedrock");
|
|
305
|
+
requireString(options.secretKey, "secretKey", "AmazonBedrock");
|
|
306
|
+
}
|
|
304
307
|
requireString(options.region, "region", "AmazonBedrock");
|
|
305
308
|
requireString(options.model, "model", "AmazonBedrock");
|
|
306
309
|
}
|
|
307
310
|
toConfig() {
|
|
308
|
-
var _a;
|
|
311
|
+
var _a, _b;
|
|
309
312
|
const o = this.options;
|
|
310
313
|
return {
|
|
311
314
|
url: `https://bedrock-runtime.${o.region}.amazonaws.com/model/${o.model}/converse-stream`,
|
|
315
|
+
api_key: o.apiKey,
|
|
312
316
|
access_key: o.accessKey,
|
|
313
317
|
secret_key: o.secretKey,
|
|
314
318
|
region: o.region,
|
|
@@ -323,7 +327,7 @@ class AmazonBedrock extends base_js_1.BaseLLM {
|
|
|
323
327
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
324
328
|
output_modalities: this.outputModalities,
|
|
325
329
|
style: "bedrock",
|
|
326
|
-
vendor: this.vendor,
|
|
330
|
+
vendor: (_b = this.vendor) !== null && _b !== void 0 ? _b : "amazon",
|
|
327
331
|
greeting_configs: this.greetingConfigs,
|
|
328
332
|
template_variables: this.templateVariables,
|
|
329
333
|
mcp_servers: this.mcpServers,
|
|
@@ -341,7 +345,7 @@ class Dify extends base_js_1.BaseLLM {
|
|
|
341
345
|
requireString(options.model, "model", "Dify");
|
|
342
346
|
}
|
|
343
347
|
toConfig() {
|
|
344
|
-
var _a;
|
|
348
|
+
var _a, _b;
|
|
345
349
|
const o = this.options;
|
|
346
350
|
return {
|
|
347
351
|
url: o.url,
|
|
@@ -356,7 +360,7 @@ class Dify extends base_js_1.BaseLLM {
|
|
|
356
360
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
357
361
|
output_modalities: this.outputModalities,
|
|
358
362
|
style: "dify",
|
|
359
|
-
vendor: this.vendor,
|
|
363
|
+
vendor: (_b = this.vendor) !== null && _b !== void 0 ? _b : "dify",
|
|
360
364
|
greeting_configs: this.greetingConfigs,
|
|
361
365
|
template_variables: this.templateVariables,
|
|
362
366
|
mcp_servers: this.mcpServers,
|
|
@@ -482,6 +482,16 @@ type MiniMaxTTSCommonOptions = {
|
|
|
482
482
|
model: string;
|
|
483
483
|
/** Voice style identifier (e.g., 'English_captivating_female1') */
|
|
484
484
|
voiceId?: string;
|
|
485
|
+
/** Speech speed (default 1). */
|
|
486
|
+
speed?: number;
|
|
487
|
+
volume?: number;
|
|
488
|
+
pitch?: number;
|
|
489
|
+
emotion?: string;
|
|
490
|
+
sampleRate?: number;
|
|
491
|
+
bitrate?: number;
|
|
492
|
+
format?: string;
|
|
493
|
+
channel?: number;
|
|
494
|
+
additionalParams?: Record<string, unknown>;
|
|
485
495
|
/** WebSocket endpoint (e.g., 'wss://api-uw.minimax.io/ws/v1/t2a_v2') */
|
|
486
496
|
url?: string;
|
|
487
497
|
/** Skip patterns for bracketed content */
|
|
@@ -494,6 +504,16 @@ export type MiniMaxTTSOptions = (MiniMaxTTSCommonOptions & {
|
|
|
494
504
|
model: MiniMaxPresetModel;
|
|
495
505
|
groupId?: string;
|
|
496
506
|
voiceId?: string;
|
|
507
|
+
/** Speech speed (default 1). */
|
|
508
|
+
speed?: number;
|
|
509
|
+
volume?: number;
|
|
510
|
+
pitch?: number;
|
|
511
|
+
emotion?: string;
|
|
512
|
+
sampleRate?: number;
|
|
513
|
+
bitrate?: number;
|
|
514
|
+
format?: string;
|
|
515
|
+
channel?: number;
|
|
516
|
+
additionalParams?: Record<string, unknown>;
|
|
497
517
|
url?: string;
|
|
498
518
|
});
|
|
499
519
|
/**
|
|
@@ -363,8 +363,11 @@ class MiniMaxTTS extends base_js_1.BaseTTS {
|
|
|
363
363
|
this.options = options;
|
|
364
364
|
}
|
|
365
365
|
toConfig() {
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
var _a, _b;
|
|
367
|
+
const { key, groupId, model, voiceId, url, skipPatterns, speed, volume, pitch, emotion, sampleRate, bitrate, format, channel, additionalParams, } = this.options;
|
|
368
|
+
const voice = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.voice_setting), (voiceId !== undefined && { voice_id: voiceId })), { speed: (_b = speed !== null && speed !== void 0 ? speed : (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.voice_setting) === null || _a === void 0 ? void 0 : _a.speed) !== null && _b !== void 0 ? _b : 1 }), (volume !== undefined && { vol: volume })), (pitch !== undefined && { pitch })), (emotion !== undefined && { emotion }));
|
|
369
|
+
const audio = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.audio_setting), (sampleRate !== undefined && { sample_rate: sampleRate })), (bitrate !== undefined && { bitrate })), (format !== undefined && { format })), (channel !== undefined && { channel }));
|
|
370
|
+
return Object.assign(Object.assign({ vendor: "minimax", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (key && { key })), (key && groupId && { group_id: groupId })), (key && { model })), { voice_setting: voice }), (Object.keys(audio).length && { audio_setting: audio })), (key && url && { url })) }, (!key && { _minimaxPresetModel: model })), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
368
371
|
}
|
|
369
372
|
}
|
|
370
373
|
exports.MiniMaxTTS = MiniMaxTTS;
|
package/dist/cjs/v3/contract.js
CHANGED
|
@@ -3540,6 +3540,16 @@ exports.contract = {
|
|
|
3540
3540
|
pattern: "^[A-Za-z0-9_]+$",
|
|
3541
3541
|
title: "Key",
|
|
3542
3542
|
},
|
|
3543
|
+
create_ts: {
|
|
3544
|
+
type: "integer",
|
|
3545
|
+
minimum: 0,
|
|
3546
|
+
description: "Key timestamp when returned by the service.",
|
|
3547
|
+
},
|
|
3548
|
+
update_ts: {
|
|
3549
|
+
type: "integer",
|
|
3550
|
+
minimum: 0,
|
|
3551
|
+
description: "Key timestamp when returned by the service.",
|
|
3552
|
+
},
|
|
3543
3553
|
},
|
|
3544
3554
|
additionalProperties: false,
|
|
3545
3555
|
type: "object",
|
|
@@ -3643,13 +3653,21 @@ exports.contract = {
|
|
|
3643
3653
|
},
|
|
3644
3654
|
keys: {
|
|
3645
3655
|
items: {
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3656
|
+
anyOf: [
|
|
3657
|
+
{
|
|
3658
|
+
type: "string",
|
|
3659
|
+
maxLength: 64,
|
|
3660
|
+
minLength: 1,
|
|
3661
|
+
pattern: "^[A-Za-z0-9_]+$",
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
$ref: "#/components/schemas/SecretKey",
|
|
3665
|
+
},
|
|
3666
|
+
],
|
|
3650
3667
|
},
|
|
3651
3668
|
type: "array",
|
|
3652
3669
|
title: "Keys",
|
|
3670
|
+
description: "Accepts legacy key names and launch key metadata objects during rollout.",
|
|
3653
3671
|
},
|
|
3654
3672
|
create_ts: {
|
|
3655
3673
|
type: "integer",
|
|
@@ -4044,6 +4062,17 @@ exports.contract = {
|
|
|
4044
4062
|
],
|
|
4045
4063
|
title: "Message",
|
|
4046
4064
|
},
|
|
4065
|
+
analysis: {
|
|
4066
|
+
anyOf: [
|
|
4067
|
+
{
|
|
4068
|
+
$ref: "#/components/schemas/SessionAnalysis",
|
|
4069
|
+
},
|
|
4070
|
+
{
|
|
4071
|
+
type: "null",
|
|
4072
|
+
},
|
|
4073
|
+
],
|
|
4074
|
+
description: "Optional extraction analysis. May be absent while analysis support is rolling out.",
|
|
4075
|
+
},
|
|
4047
4076
|
},
|
|
4048
4077
|
additionalProperties: false,
|
|
4049
4078
|
type: "object",
|
|
@@ -9003,4 +9032,84 @@ exports.contract = {
|
|
|
9003
9032
|
type: "object",
|
|
9004
9033
|
title: "EndCallPolicy",
|
|
9005
9034
|
},
|
|
9035
|
+
SessionAnalysis: {
|
|
9036
|
+
properties: {
|
|
9037
|
+
status: {
|
|
9038
|
+
type: "string",
|
|
9039
|
+
enum: ["pending", "completed", "failed", "skipped"],
|
|
9040
|
+
title: "Status",
|
|
9041
|
+
},
|
|
9042
|
+
skip_reason: {
|
|
9043
|
+
anyOf: [
|
|
9044
|
+
{
|
|
9045
|
+
type: "string",
|
|
9046
|
+
enum: ["no_user_turns", "retention_none"],
|
|
9047
|
+
},
|
|
9048
|
+
{
|
|
9049
|
+
type: "null",
|
|
9050
|
+
},
|
|
9051
|
+
],
|
|
9052
|
+
title: "Skip Reason",
|
|
9053
|
+
},
|
|
9054
|
+
complete_ts: {
|
|
9055
|
+
anyOf: [
|
|
9056
|
+
{
|
|
9057
|
+
type: "integer",
|
|
9058
|
+
minimum: 0.0,
|
|
9059
|
+
},
|
|
9060
|
+
{
|
|
9061
|
+
type: "null",
|
|
9062
|
+
},
|
|
9063
|
+
],
|
|
9064
|
+
title: "Complete Ts",
|
|
9065
|
+
},
|
|
9066
|
+
result: {
|
|
9067
|
+
anyOf: [
|
|
9068
|
+
{
|
|
9069
|
+
patternProperties: {
|
|
9070
|
+
"^[a-z][a-z0-9_]{0,63}$": {
|
|
9071
|
+
anyOf: [
|
|
9072
|
+
{
|
|
9073
|
+
type: "string",
|
|
9074
|
+
},
|
|
9075
|
+
{
|
|
9076
|
+
type: "integer",
|
|
9077
|
+
},
|
|
9078
|
+
{
|
|
9079
|
+
type: "number",
|
|
9080
|
+
},
|
|
9081
|
+
{
|
|
9082
|
+
type: "boolean",
|
|
9083
|
+
},
|
|
9084
|
+
{
|
|
9085
|
+
type: "null",
|
|
9086
|
+
},
|
|
9087
|
+
],
|
|
9088
|
+
},
|
|
9089
|
+
},
|
|
9090
|
+
type: "object",
|
|
9091
|
+
},
|
|
9092
|
+
{
|
|
9093
|
+
type: "null",
|
|
9094
|
+
},
|
|
9095
|
+
],
|
|
9096
|
+
title: "Result",
|
|
9097
|
+
},
|
|
9098
|
+
error: {
|
|
9099
|
+
anyOf: [
|
|
9100
|
+
{
|
|
9101
|
+
type: "string",
|
|
9102
|
+
},
|
|
9103
|
+
{
|
|
9104
|
+
type: "null",
|
|
9105
|
+
},
|
|
9106
|
+
],
|
|
9107
|
+
title: "Error",
|
|
9108
|
+
},
|
|
9109
|
+
},
|
|
9110
|
+
additionalProperties: false,
|
|
9111
|
+
type: "object",
|
|
9112
|
+
required: ["status", "skip_reason", "complete_ts", "result", "error"],
|
|
9113
|
+
title: "SessionAnalysis",
|
|
9114
|
+
},
|
|
9006
9115
|
};
|
package/dist/cjs/v3/resources.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated by scripts/generate-v3-preview.py.
|
|
3
2
|
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
4
3
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
5
4
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
package/dist/cjs/v3/types.d.ts
CHANGED
|
@@ -440,6 +440,8 @@ export type SecretDeleted = {
|
|
|
440
440
|
};
|
|
441
441
|
export type SecretKey = {
|
|
442
442
|
key: string;
|
|
443
|
+
create_ts?: number;
|
|
444
|
+
update_ts?: number;
|
|
443
445
|
};
|
|
444
446
|
export type SecretKeyWrite = {
|
|
445
447
|
value: string;
|
|
@@ -460,7 +462,7 @@ export type SecretReplace = {
|
|
|
460
462
|
};
|
|
461
463
|
export type SecretSet = {
|
|
462
464
|
name: string;
|
|
463
|
-
keys: Array<string>;
|
|
465
|
+
keys: Array<string | SecretKey>;
|
|
464
466
|
create_ts: number;
|
|
465
467
|
update_ts: number;
|
|
466
468
|
};
|
|
@@ -526,6 +528,7 @@ export type SessionResponse = {
|
|
|
526
528
|
status: "IDLE" | "STARTING" | "RUNNING" | "STOPPING" | "STOPPED" | "FAILED";
|
|
527
529
|
stop_ts?: number | null;
|
|
528
530
|
message?: string | null;
|
|
531
|
+
analysis?: SessionAnalysis | null;
|
|
529
532
|
};
|
|
530
533
|
export type SessionStartResponse = {
|
|
531
534
|
agent_session_id: string;
|
|
@@ -986,6 +989,15 @@ export type InboundEndCallPolicy = {
|
|
|
986
989
|
on_ai_assistant?: boolean;
|
|
987
990
|
on_fax?: boolean;
|
|
988
991
|
};
|
|
992
|
+
export type SessionAnalysis = {
|
|
993
|
+
status: "pending" | "completed" | "failed" | "skipped";
|
|
994
|
+
skip_reason: "no_user_turns" | "retention_none" | null;
|
|
995
|
+
complete_ts: number | null;
|
|
996
|
+
result: {
|
|
997
|
+
[key: string]: string | number | number | boolean | null;
|
|
998
|
+
} | null;
|
|
999
|
+
error: string | null;
|
|
1000
|
+
};
|
|
989
1001
|
export type { EphemeralSessionStartRequest, SessionGeofence, SessionStartOptions, SessionStartRequest, SessionTransport, } from "./session-lifecycle.js";
|
|
990
1002
|
export type AgentCreateRequest = AgentCreateInput;
|
|
991
1003
|
export type AgentPatchRequest = AgentPatch;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v3.0.0-alpha.
|
|
1
|
+
export declare const SDK_VERSION = "v3.0.0-alpha.2";
|
package/dist/cjs/version.js
CHANGED
|
@@ -19,11 +19,10 @@ export declare namespace AgoraClient {
|
|
|
19
19
|
v3?: V3Options;
|
|
20
20
|
/** Agora App ID — used as the `appid` path parameter and for RTC token generation */
|
|
21
21
|
appId: string;
|
|
22
|
-
/** Agora App Certificate — used to sign RTC tokens. Keep this secret. */
|
|
23
|
-
appCertificate: string;
|
|
24
22
|
}
|
|
25
23
|
/** Use a pre-built Agora token for REST API authentication. Pass the raw token; the SDK sets `Authorization: agora token=<authToken>` automatically. */
|
|
26
24
|
interface TokenAuthOptions {
|
|
25
|
+
appCertificate?: string;
|
|
27
26
|
authToken: string;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
@@ -31,6 +30,7 @@ export declare namespace AgoraClient {
|
|
|
31
30
|
* ConvoAI token per API call — no Customer Secret required.
|
|
32
31
|
*/
|
|
33
32
|
interface AppCredentialsOptions {
|
|
33
|
+
appCertificate: string;
|
|
34
34
|
authToken?: never;
|
|
35
35
|
}
|
|
36
36
|
type AuthOptions = TokenAuthOptions | AppCredentialsOptions;
|
|
@@ -75,7 +75,7 @@ export declare class AgoraClient<TArea extends AgoraArea = AgoraArea> extends Ba
|
|
|
75
75
|
/** Agora App ID */
|
|
76
76
|
readonly appId: string;
|
|
77
77
|
/** Agora App Certificate (used for RTC token signing) */
|
|
78
|
-
readonly appCertificate: string;
|
|
78
|
+
readonly appCertificate: string | undefined;
|
|
79
79
|
/** The active authentication mode */
|
|
80
80
|
readonly authMode: AgoraAuthMode;
|
|
81
81
|
/** The configured routing area */
|
|
@@ -119,9 +119,11 @@ export class AgoraClient extends BaseAgoraClient {
|
|
|
119
119
|
}
|
|
120
120
|
const authMode = options.authToken !== undefined ? "token" : "app-credentials";
|
|
121
121
|
const { authToken, appId, appCertificate } = options, rest = __rest(options, ["authToken", "appId", "appCertificate"]);
|
|
122
|
+
if (authMode === "app-credentials" && !appCertificate)
|
|
123
|
+
throw new Error("appCertificate or authToken is required");
|
|
122
124
|
const authorization = () => authMode === "token"
|
|
123
125
|
? `agora token=${authToken}`
|
|
124
|
-
: `agora token=${generateConvoAIToken({ appId, appCertificate, channelName: "", uid: 0 })}`;
|
|
126
|
+
: `agora token=${generateConvoAIToken({ appId, appCertificate: appCertificate, channelName: "", uid: 0 })}`;
|
|
125
127
|
const originalFetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;
|
|
126
128
|
const tokenOnlyFetch = (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
127
129
|
const finalHeaders = new Headers(input instanceof Request ? input.headers : undefined);
|
|
@@ -11,7 +11,7 @@ import type * as Agora from "../api/index.mjs";
|
|
|
11
11
|
import { AgentSession } from "./AgentSession.mjs";
|
|
12
12
|
import type { AgoraArea } from "./area.mjs";
|
|
13
13
|
import type { AvatarVendor, CNMllmVendor, GlobalMllmVendor, LlmVendor, SttVendor, TtsVendor } from "./region-vendors.mjs";
|
|
14
|
-
import type { AdvancedFeatures, AvatarConfig, FillerWordsConfig, GeofenceConfig, InterruptionConfig, Labels, LlmConfig, LlmGreetingConfigs, MllmConfig, ParametersAudioScenario, RtcConfig, SalConfig, SessionOptions, SessionParamsInput, SttConfig, TtsConfig, TurnDetectionConfig } from "./types.mjs";
|
|
14
|
+
import type { AdvancedFeatures, AvatarConfig, CallOptions, FillerWordsConfig, GeofenceConfig, InterruptionConfig, Labels, LlmConfig, LlmGreetingConfigs, MllmConfig, ParametersAudioScenario, RtcConfig, SalConfig, SessionOptions, SessionParamsInput, SttConfig, TtsConfig, TurnDetectionConfig } from "./types.mjs";
|
|
15
15
|
/**
|
|
16
16
|
* Configuration options for creating an Agent.
|
|
17
17
|
*
|
|
@@ -420,6 +420,11 @@ export declare class Agent<TTSSampleRate extends number = number, TArea extends
|
|
|
420
420
|
/** Compatibility alias for save(). */
|
|
421
421
|
deploy(options?: DeployOptions): Promise<DeployedAgent>;
|
|
422
422
|
createSession(options: SessionOptions): AgentSession;
|
|
423
|
+
/** Start an unsaved configuration explicitly through the Platform API. */
|
|
424
|
+
createEphemeralSession(options: SessionOptions): AgentSession;
|
|
425
|
+
/** Create an outbound phone-call session from this unsaved configuration. */
|
|
426
|
+
call(options: CallOptions): AgentSession;
|
|
427
|
+
private _createPlatformSession;
|
|
423
428
|
/**
|
|
424
429
|
* Converts the Agent configuration to the Fern request properties format.
|
|
425
430
|
*
|
|
@@ -463,6 +468,7 @@ export declare class Agent<TTSSampleRate extends number = number, TArea extends
|
|
|
463
468
|
* If a new private field is added to Agent, it MUST also be added here.
|
|
464
469
|
*/
|
|
465
470
|
private _clone;
|
|
471
|
+
private _resolvePlatformAsrConfig;
|
|
466
472
|
private _resolveAsrConfig;
|
|
467
473
|
private _resolveTurnDetectionConfig;
|
|
468
474
|
}
|