agora-agents 2.9.0 → 2.10.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/agentkit/Agent.js +3 -3
- package/dist/cjs/agentkit/index.d.ts +8 -10
- package/dist/cjs/agentkit/index.js +10 -8
- package/dist/cjs/agentkit/preview/client.d.ts +6 -18
- package/dist/cjs/agentkit/preview/client.js +17 -84
- package/dist/cjs/agentkit/preview/index.d.ts +4 -2
- package/dist/cjs/agentkit/preview/index.js +4 -2
- package/dist/cjs/agentkit/preview/vendors.d.ts +8 -104
- package/dist/cjs/agentkit/preview/vendors.js +14 -115
- package/dist/cjs/agentkit/types.d.ts +10 -4
- package/dist/cjs/agentkit/vendors/base.d.ts +15 -4
- package/dist/cjs/agentkit/vendors/base.js +16 -5
- package/dist/cjs/agentkit/vendors/cn.js +2 -2
- package/dist/cjs/agentkit/vendors/llm.js +2 -2
- package/dist/cjs/agentkit/vendors/mllm.d.ts +92 -10
- package/dist/cjs/agentkit/vendors/mllm.js +115 -18
- package/dist/cjs/agentkit/vendors/stt.d.ts +41 -0
- package/dist/cjs/agentkit/vendors/stt.js +18 -1
- package/dist/cjs/agentkit/vendors/tts.d.ts +27 -0
- package/dist/cjs/agentkit/vendors/tts.js +16 -1
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +11 -5
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +3 -1
- package/dist/cjs/api/types/AnamAvatarParams.d.ts +42 -0
- package/dist/cjs/api/types/AnamAvatarParams.js +18 -0
- package/dist/cjs/api/types/Asr.d.ts +4 -1
- package/dist/cjs/api/types/LlmTool.d.ts +7 -0
- package/dist/cjs/api/types/McpServer.d.ts +24 -0
- package/dist/cjs/api/types/McpServer.js +3 -0
- package/dist/cjs/api/types/Mllm.d.ts +14 -0
- package/dist/cjs/api/types/SmallestAiAsr.d.ts +11 -0
- package/dist/cjs/api/types/SmallestAiAsr.js +3 -0
- package/dist/cjs/api/types/SmallestAiAsrParams.d.ts +49 -0
- package/dist/cjs/api/types/SmallestAiAsrParams.js +3 -0
- package/dist/cjs/api/types/SmallestAiTts.d.ts +9 -0
- package/dist/cjs/api/types/SmallestAiTts.js +3 -0
- package/dist/cjs/api/types/SmallestAiTtsParams.d.ts +31 -0
- package/dist/cjs/api/types/SmallestAiTtsParams.js +3 -0
- package/dist/cjs/api/types/Tts.d.ts +4 -1
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +6 -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/agentkit/Agent.mjs +2 -2
- package/dist/esm/agentkit/index.d.mts +8 -10
- package/dist/esm/agentkit/index.mjs +3 -4
- package/dist/esm/agentkit/preview/client.d.mts +6 -18
- package/dist/esm/agentkit/preview/client.mjs +17 -84
- package/dist/esm/agentkit/preview/index.d.mts +4 -2
- package/dist/esm/agentkit/preview/index.mjs +2 -1
- package/dist/esm/agentkit/preview/vendors.d.mts +8 -104
- package/dist/esm/agentkit/preview/vendors.mjs +5 -112
- package/dist/esm/agentkit/types.d.mts +10 -4
- package/dist/esm/agentkit/vendors/base.d.mts +15 -4
- package/dist/esm/agentkit/vendors/base.mjs +16 -5
- package/dist/esm/agentkit/vendors/cn.mjs +2 -2
- package/dist/esm/agentkit/vendors/llm.mjs +2 -2
- package/dist/esm/agentkit/vendors/mllm.d.mts +92 -10
- package/dist/esm/agentkit/vendors/mllm.mjs +111 -16
- package/dist/esm/agentkit/vendors/stt.d.mts +41 -0
- package/dist/esm/agentkit/vendors/stt.mjs +16 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +27 -0
- package/dist/esm/agentkit/vendors/tts.mjs +14 -0
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +11 -5
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +3 -1
- package/dist/esm/api/types/AnamAvatarParams.d.mts +42 -0
- package/dist/esm/api/types/AnamAvatarParams.mjs +15 -0
- package/dist/esm/api/types/Asr.d.mts +4 -1
- package/dist/esm/api/types/LlmTool.d.mts +7 -0
- package/dist/esm/api/types/McpServer.d.mts +24 -0
- package/dist/esm/api/types/McpServer.mjs +2 -0
- package/dist/esm/api/types/Mllm.d.mts +14 -0
- package/dist/esm/api/types/SmallestAiAsr.d.mts +11 -0
- package/dist/esm/api/types/SmallestAiAsr.mjs +2 -0
- package/dist/esm/api/types/SmallestAiAsrParams.d.mts +49 -0
- package/dist/esm/api/types/SmallestAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/SmallestAiTts.d.mts +9 -0
- package/dist/esm/api/types/SmallestAiTts.mjs +2 -0
- package/dist/esm/api/types/SmallestAiTtsParams.d.mts +31 -0
- package/dist/esm/api/types/SmallestAiTtsParams.mjs +2 -0
- package/dist/esm/api/types/Tts.d.mts +4 -1
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -109,20 +109,31 @@ export class BaseCNSTT extends ScopedBaseSTT {
|
|
|
109
109
|
* Base class for MLLM (Multimodal Large Language Model) vendors.
|
|
110
110
|
*/
|
|
111
111
|
class ScopedBaseMLLM {
|
|
112
|
-
constructor(areaScope) {
|
|
112
|
+
constructor(areaScope, options) {
|
|
113
113
|
this.areaScope = areaScope;
|
|
114
|
+
this._mcpServers = options === null || options === void 0 ? void 0 : options.mcpServers;
|
|
115
|
+
this._tools = options === null || options === void 0 ? void 0 : options.tools;
|
|
116
|
+
}
|
|
117
|
+
get mcpServers() {
|
|
118
|
+
var _a;
|
|
119
|
+
if (!((_a = this._mcpServers) === null || _a === void 0 ? void 0 : _a.length))
|
|
120
|
+
return this._mcpServers;
|
|
121
|
+
return this._mcpServers.map((server) => server.transport ? server : Object.assign(Object.assign({}, server), { transport: "streamable_http" }));
|
|
122
|
+
}
|
|
123
|
+
get tools() {
|
|
124
|
+
return this._tools;
|
|
114
125
|
}
|
|
115
126
|
}
|
|
116
127
|
/** Base class for global MLLM vendors. */
|
|
117
128
|
export class BaseMLLM extends ScopedBaseMLLM {
|
|
118
|
-
constructor() {
|
|
119
|
-
super("global");
|
|
129
|
+
constructor(options) {
|
|
130
|
+
super("global", options);
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
133
|
/** Base class for Chinese mainland MLLM vendors. */
|
|
123
134
|
export class BaseCNMLLM extends ScopedBaseMLLM {
|
|
124
|
-
constructor() {
|
|
125
|
-
super("cn");
|
|
135
|
+
constructor(options) {
|
|
136
|
+
super("cn", options);
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
139
|
/**
|
|
@@ -213,8 +213,8 @@ export class StepFunTTS extends BaseCNTTS {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
function cnLlmConfig(options, vendor) {
|
|
216
|
-
var _a;
|
|
217
|
-
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, tools: options.tools });
|
|
216
|
+
var _a, _b;
|
|
217
|
+
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: (_b = options.mcpServers) === null || _b === void 0 ? void 0 : _b.map((server) => server.transport ? server : Object.assign(Object.assign({}, server), { transport: "streamable_http" })), tools: options.tools });
|
|
218
218
|
}
|
|
219
219
|
export class AliyunLLM extends BaseCNLLM {
|
|
220
220
|
constructor(options) {
|
|
@@ -206,7 +206,7 @@ export class Gemini extends BaseLLM {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
function openAIStyleConfig(options, vendor) {
|
|
209
|
-
var _a, _b;
|
|
209
|
+
var _a, _b, _c;
|
|
210
210
|
return {
|
|
211
211
|
url: options.url,
|
|
212
212
|
api_key: options.apiKey,
|
|
@@ -223,7 +223,7 @@ function openAIStyleConfig(options, vendor) {
|
|
|
223
223
|
vendor: (_b = options.vendor) !== null && _b !== void 0 ? _b : vendor,
|
|
224
224
|
greeting_configs: options.greetingConfigs,
|
|
225
225
|
template_variables: options.templateVariables,
|
|
226
|
-
mcp_servers: options.mcpServers,
|
|
226
|
+
mcp_servers: (_c = options.mcpServers) === null || _c === void 0 ? void 0 : _c.map((server) => server.transport ? server : Object.assign(Object.assign({}, server), { transport: "streamable_http" })),
|
|
227
227
|
tools: options.tools,
|
|
228
228
|
};
|
|
229
229
|
}
|
|
@@ -5,13 +5,95 @@
|
|
|
5
5
|
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` automatically
|
|
6
6
|
* sets `mllm.enable: true`.
|
|
7
7
|
*/
|
|
8
|
-
import type { GeminiThinkingLevel } from "../preview/vendors.mjs";
|
|
9
8
|
import type { MllmConfig, MllmTurnDetectionConfig } from "../types.mjs";
|
|
10
|
-
import { BaseCNMLLM, BaseMLLM } from "./base.mjs";
|
|
9
|
+
import { BaseCNMLLM, BaseMLLM, type BaseMllmOptions } from "./base.mjs";
|
|
10
|
+
export declare const GeminiLiveModels: {
|
|
11
|
+
/** Public ID for the low-latency voice model. */
|
|
12
|
+
readonly Live38: "models/gemini-3.8-live";
|
|
13
|
+
/** Public ID for the reasoning voice model. */
|
|
14
|
+
readonly Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking";
|
|
15
|
+
};
|
|
16
|
+
/** The model Gemini Live sends by default. */
|
|
17
|
+
export declare const GEMINI_MLLM_DEFAULT_MODEL: string;
|
|
18
|
+
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
19
|
+
export declare const GEMINI_MLLM_URL = "https://generativelanguage.googleapis.com";
|
|
20
|
+
/** @deprecated Use {@link GEMINI_MLLM_URL}. */
|
|
21
|
+
export declare const GEMINI_PREVIEW_MLLM_URL: string;
|
|
22
|
+
/** A Gemini Live model. Known models autocomplete while future model IDs remain accepted. */
|
|
23
|
+
export type GeminiLiveModel = (typeof GeminiLiveModels)[keyof typeof GeminiLiveModels] | (string & {});
|
|
24
|
+
/** Reasoning budgets accepted by Gemini Extended Thinking. */
|
|
25
|
+
export declare const GeminiThinkingLevels: readonly ["low", "medium", "high"];
|
|
26
|
+
export type GeminiThinkingLevel = (typeof GeminiThinkingLevels)[number];
|
|
27
|
+
/** Known Gemini output voices; future voice names remain accepted. */
|
|
28
|
+
export type GeminiLiveVoice = "Puck" | "Charon" | "Kore" | "Fenrir" | "Aoede" | "Leda" | "Orus" | "Zephyr" | (string & {});
|
|
29
|
+
/** @deprecated Use {@link GeminiLiveVoice}. */
|
|
30
|
+
export type GeminiPreviewVoice = GeminiLiveVoice;
|
|
31
|
+
export declare const OPENAI_GPT_LIVE_VENDOR: "openai_gpt_live";
|
|
32
|
+
export declare function isOpenAIGPTLiveConfig(config: unknown): boolean;
|
|
33
|
+
/** GPT Live v3 options. */
|
|
34
|
+
export interface OpenAIGPTLiveOptions extends BaseMllmOptions {
|
|
35
|
+
apiKey: string;
|
|
36
|
+
/** Full WebSocket URL, used verbatim except OpenAI's legacy /v1/live route. */
|
|
37
|
+
url?: string;
|
|
38
|
+
/** @deprecated Use prompt. Serialized as prompt; an explicit prompt wins. */
|
|
39
|
+
instructions?: string;
|
|
40
|
+
greeting?: string;
|
|
41
|
+
failureMessage?: string;
|
|
42
|
+
inputModalities?: string[];
|
|
43
|
+
outputModalities?: string[];
|
|
44
|
+
messages?: Record<string, unknown>[];
|
|
45
|
+
/** Additional provider fields; explicit options take precedence. */
|
|
46
|
+
params?: Record<string, unknown>;
|
|
47
|
+
/** @deprecated Unsupported in v3; setting this raises an error. */
|
|
48
|
+
inputAudioTranscription?: Record<string, unknown>;
|
|
49
|
+
/** @deprecated Ignored with a warning; v3 performs endpointing internally. */
|
|
50
|
+
turnDetection?: MllmTurnDetectionConfig;
|
|
51
|
+
/** Defaults to gpt-live-1. */
|
|
52
|
+
model?: string;
|
|
53
|
+
/** Output voice; provider default marin. Custom voice objects require PR #1522; use params after rollout. */
|
|
54
|
+
voice?: string;
|
|
55
|
+
/** Session instructions. */
|
|
56
|
+
prompt?: string;
|
|
57
|
+
/** Host when url is omitted; default wss://api.openai.com. */
|
|
58
|
+
baseUrl?: string;
|
|
59
|
+
/** WebSocket path; default /v1/live/sessions. */
|
|
60
|
+
path?: string;
|
|
61
|
+
/** Optional OpenAI-Alpha selector for preview contracts. Omitted by default. */
|
|
62
|
+
alphaSelector?: string;
|
|
63
|
+
/** Extra provider request headers as a JSON string; protocol headers win. */
|
|
64
|
+
headers?: string;
|
|
65
|
+
/** Assistant silence boundary in ms; provider default 600. Zero disables inference. */
|
|
66
|
+
outputIdleEndMs?: number;
|
|
67
|
+
/** Caller silence boundary in ms; provider default 1500. */
|
|
68
|
+
inputIdleEndMs?: number;
|
|
69
|
+
/** Speech amplitude threshold on the 16-bit scale; provider default 50. */
|
|
70
|
+
outputSilencePeak?: number;
|
|
71
|
+
/** Graph PCM sample rate; provider default 24000. */
|
|
72
|
+
outputSampleRate?: number;
|
|
73
|
+
/** Initial audio cushion; provider default 0. Negative disables pacing. */
|
|
74
|
+
outputBufferMs?: number;
|
|
75
|
+
/** Mic append batching in ms. Join default 0; extension class default 100. */
|
|
76
|
+
inputBatchMs?: number;
|
|
77
|
+
/** Advertise graph tools; provider default false. Does not control delegate built-ins. */
|
|
78
|
+
toolEnabled?: boolean;
|
|
79
|
+
/** Tool delegation mode; provider default responses. Fixed for the session. */
|
|
80
|
+
delegation?: "client" | "responses";
|
|
81
|
+
/** Tool delegate model; provider default gpt-5.6-sol. */
|
|
82
|
+
responsesModel?: string;
|
|
83
|
+
/** Interrupt playback on caller speech; provider default false. */
|
|
84
|
+
interruptOnUserTurn?: boolean;
|
|
85
|
+
/** Unmodelled v3 session fields. Cannot override model, delegation, audio, instructions or input. */
|
|
86
|
+
sessionParams?: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
export declare class OpenAIGPTLive extends BaseMLLM {
|
|
89
|
+
private readonly options;
|
|
90
|
+
constructor(options: OpenAIGPTLiveOptions);
|
|
91
|
+
toConfig(): MllmConfig;
|
|
92
|
+
}
|
|
11
93
|
/**
|
|
12
94
|
* Constructor options for OpenAI Realtime API.
|
|
13
95
|
*/
|
|
14
|
-
export interface OpenAIRealtimeOptions {
|
|
96
|
+
export interface OpenAIRealtimeOptions extends BaseMllmOptions {
|
|
15
97
|
/** OpenAI API key */
|
|
16
98
|
apiKey: string;
|
|
17
99
|
/** Model name (e.g., 'gpt-4o-realtime-preview') */
|
|
@@ -67,7 +149,7 @@ export interface AzureOpenAIRealtimeParams {
|
|
|
67
149
|
voice?: string;
|
|
68
150
|
}
|
|
69
151
|
/** Constructor options for Azure OpenAI Realtime API. */
|
|
70
|
-
export interface AzureOpenAIRealtimeOptions {
|
|
152
|
+
export interface AzureOpenAIRealtimeOptions extends BaseMllmOptions {
|
|
71
153
|
/** Azure OpenAI API key */
|
|
72
154
|
apiKey: string;
|
|
73
155
|
/** Azure OpenAI Realtime WebSocket URL, including deployment routing when required */
|
|
@@ -113,11 +195,11 @@ export declare class AzureOpenAIRealtime extends BaseMLLM {
|
|
|
113
195
|
/**
|
|
114
196
|
* Constructor options for Google Gemini Live (direct API, non-Vertex AI).
|
|
115
197
|
*/
|
|
116
|
-
export interface GeminiLiveOptions {
|
|
198
|
+
export interface GeminiLiveOptions extends BaseMllmOptions {
|
|
117
199
|
/** Google API key */
|
|
118
200
|
apiKey: string;
|
|
119
201
|
/** Model name (e.g., 'gemini-live-2.5-flash') */
|
|
120
|
-
model?:
|
|
202
|
+
model?: GeminiLiveModel;
|
|
121
203
|
/** Sent only for models/gemini-3.8-live-extended-thinking. */
|
|
122
204
|
thinkingLevel?: GeminiThinkingLevel;
|
|
123
205
|
/** Languages for Gemini 3.8, sent as params.language_codes. */
|
|
@@ -127,7 +209,7 @@ export interface GeminiLiveOptions {
|
|
|
127
209
|
/** System instructions for the model */
|
|
128
210
|
instructions?: string;
|
|
129
211
|
/** Voice name (e.g., 'Aoede', 'Charon') */
|
|
130
|
-
voice?:
|
|
212
|
+
voice?: GeminiLiveVoice;
|
|
131
213
|
affectiveDialog?: boolean;
|
|
132
214
|
proactiveAudio?: boolean;
|
|
133
215
|
transcribeAgent?: boolean;
|
|
@@ -172,7 +254,7 @@ export declare class GeminiLive extends BaseMLLM {
|
|
|
172
254
|
/**
|
|
173
255
|
* Constructor options for Google Gemini Live (Vertex AI).
|
|
174
256
|
*/
|
|
175
|
-
export interface VertexAIOptions {
|
|
257
|
+
export interface VertexAIOptions extends BaseMllmOptions {
|
|
176
258
|
/** Model name (e.g., 'gemini-live-2.5-flash-preview-native-audio-09-2025') */
|
|
177
259
|
model: string;
|
|
178
260
|
/** WebSocket URL for real-time communication */
|
|
@@ -233,7 +315,7 @@ export declare class VertexAI extends BaseMLLM {
|
|
|
233
315
|
/**
|
|
234
316
|
* Constructor options for xAI Grok Realtime API.
|
|
235
317
|
*/
|
|
236
|
-
export interface XaiGrokOptions {
|
|
318
|
+
export interface XaiGrokOptions extends BaseMllmOptions {
|
|
237
319
|
/** xAI API key */
|
|
238
320
|
apiKey: string;
|
|
239
321
|
/** WebSocket URL for real-time communication (defaults to xAI Realtime API) */
|
|
@@ -284,7 +366,7 @@ export declare class XaiGrok extends BaseMLLM {
|
|
|
284
366
|
toConfig(): MllmConfig;
|
|
285
367
|
}
|
|
286
368
|
/** Constructor options for Alibaba Cloud Qwen Omni Realtime. */
|
|
287
|
-
export interface QwenOmniOptions {
|
|
369
|
+
export interface QwenOmniOptions extends BaseMllmOptions {
|
|
288
370
|
/** Alibaba Cloud DashScope API key */
|
|
289
371
|
apiKey: string;
|
|
290
372
|
/** Qwen Omni model identifier */
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` automatically
|
|
6
6
|
* sets `mllm.enable: true`.
|
|
7
7
|
*/
|
|
8
|
-
import { buildGeminiPreviewConfig, GeminiLiveModels, GeminiThinkingLevels } from "../preview/vendors.mjs";
|
|
9
8
|
import { BaseCNMLLM, BaseMLLM } from "./base.mjs";
|
|
10
9
|
function requireString(value, field, vendor) {
|
|
11
10
|
if (typeof value !== "string" || value.length === 0) {
|
|
@@ -17,6 +16,94 @@ function requireObject(value, field, vendor) {
|
|
|
17
16
|
throw new Error(`${vendor} requires ${field}`);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// Google Gemini Live (MLLM)
|
|
21
|
+
// =============================================================================
|
|
22
|
+
export const GeminiLiveModels = {
|
|
23
|
+
/** Public ID for the low-latency voice model. */
|
|
24
|
+
Live38: "models/gemini-3.8-live",
|
|
25
|
+
/** Public ID for the reasoning voice model. */
|
|
26
|
+
Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking",
|
|
27
|
+
};
|
|
28
|
+
/** The model Gemini Live sends by default. */
|
|
29
|
+
export const GEMINI_MLLM_DEFAULT_MODEL = GeminiLiveModels.Live38;
|
|
30
|
+
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
31
|
+
export const GEMINI_MLLM_URL = "https://generativelanguage.googleapis.com";
|
|
32
|
+
/** @deprecated Use {@link GEMINI_MLLM_URL}. */
|
|
33
|
+
export const GEMINI_PREVIEW_MLLM_URL = GEMINI_MLLM_URL;
|
|
34
|
+
/** Reasoning budgets accepted by Gemini Extended Thinking. */
|
|
35
|
+
export const GeminiThinkingLevels = ["low", "medium", "high"];
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// OpenAI GPT Live (MLLM)
|
|
38
|
+
// =============================================================================
|
|
39
|
+
export const OPENAI_GPT_LIVE_VENDOR = "openai_gpt_live";
|
|
40
|
+
export function isOpenAIGPTLiveConfig(config) {
|
|
41
|
+
return (config === null || config === void 0 ? void 0 : config.vendor) === OPENAI_GPT_LIVE_VENDOR;
|
|
42
|
+
}
|
|
43
|
+
export class OpenAIGPTLive extends BaseMLLM {
|
|
44
|
+
constructor(options) {
|
|
45
|
+
super(options);
|
|
46
|
+
this.options = options;
|
|
47
|
+
if (!options.apiKey)
|
|
48
|
+
throw new Error("OpenAIGPTLive requires apiKey");
|
|
49
|
+
}
|
|
50
|
+
toConfig() {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const o = this.options;
|
|
53
|
+
const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: "gpt-live-1" }, o.params), (o.instructions !== undefined && { prompt: o.instructions })), (o.model !== undefined && { model: o.model })), (o.voice !== undefined && { voice: o.voice })), (o.prompt !== undefined && { prompt: o.prompt })), (o.baseUrl !== undefined && { base_url: o.baseUrl })), (o.path !== undefined && { path: o.path })), (o.alphaSelector !== undefined && { alpha_selector: o.alphaSelector })), (o.headers !== undefined && { headers: o.headers })), (o.outputIdleEndMs !== undefined && { output_idle_end_ms: o.outputIdleEndMs })), (o.inputIdleEndMs !== undefined && { input_idle_end_ms: o.inputIdleEndMs })), (o.outputSilencePeak !== undefined && { output_silence_peak: o.outputSilencePeak })), (o.outputSampleRate !== undefined && { output_sample_rate: o.outputSampleRate })), (o.outputBufferMs !== undefined && { output_buffer_ms: o.outputBufferMs })), (o.inputBatchMs !== undefined && { input_batch_ms: o.inputBatchMs })), (o.toolEnabled !== undefined && { tool_enabled: o.toolEnabled })), (o.delegation !== undefined && { delegation: o.delegation })), (o.responsesModel !== undefined && { responses_model: o.responsesModel })), (o.interruptOnUserTurn !== undefined && { interrupt_on_user_turn: o.interruptOnUserTurn })), (o.sessionParams !== undefined && { session_params: o.sessionParams }));
|
|
54
|
+
if (o.inputAudioTranscription !== undefined || "input_audio_transcription" in params) {
|
|
55
|
+
throw new Error("GPT Live v3 does not support input_audio_transcription");
|
|
56
|
+
}
|
|
57
|
+
if (o.turnDetection !== undefined || "turn_detection" in params) {
|
|
58
|
+
console.warn("GPT Live v3 ignores turn_detection; endpointing is internal");
|
|
59
|
+
delete params.turn_detection;
|
|
60
|
+
}
|
|
61
|
+
if (params.delegation !== undefined && params.delegation !== "client" && params.delegation !== "responses") {
|
|
62
|
+
throw new Error("GPT Live delegation must be client or responses");
|
|
63
|
+
}
|
|
64
|
+
if (params.headers !== undefined) {
|
|
65
|
+
let headers;
|
|
66
|
+
try {
|
|
67
|
+
headers = JSON.parse(String(params.headers));
|
|
68
|
+
}
|
|
69
|
+
catch (_c) {
|
|
70
|
+
throw new Error("GPT Live headers must be a JSON object string");
|
|
71
|
+
}
|
|
72
|
+
if (headers === null || typeof headers !== "object" || Array.isArray(headers)) {
|
|
73
|
+
throw new Error("GPT Live headers must be a JSON object string");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const session = params.session_params === undefined ? {} : params.session_params;
|
|
77
|
+
if (session === null || typeof session !== "object" || Array.isArray(session)) {
|
|
78
|
+
throw new Error("GPT Live session_params must be an object");
|
|
79
|
+
}
|
|
80
|
+
for (const key of ["model", "delegation", "audio", "instructions", "input"]) {
|
|
81
|
+
if (key in session)
|
|
82
|
+
throw new Error(`GPT Live session_params cannot override ${key}`);
|
|
83
|
+
}
|
|
84
|
+
let url = o.url ||
|
|
85
|
+
`${String((_a = params.base_url) !== null && _a !== void 0 ? _a : "wss://api.openai.com").replace(/\/+$/, "")}/${String((_b = params.path) !== null && _b !== void 0 ? _b : "/v1/live/sessions").replace(/^\/+/, "")}`;
|
|
86
|
+
if (!/^wss?:\/\/[^/]/i.test(url)) {
|
|
87
|
+
throw new Error("GPT Live url must be a full ws:// or wss:// endpoint");
|
|
88
|
+
}
|
|
89
|
+
let parsed;
|
|
90
|
+
try {
|
|
91
|
+
parsed = new URL(url);
|
|
92
|
+
}
|
|
93
|
+
catch (_d) {
|
|
94
|
+
throw new Error("GPT Live url must be a full ws:// or wss:// endpoint");
|
|
95
|
+
}
|
|
96
|
+
if ((parsed.protocol !== "ws:" && parsed.protocol !== "wss:") || !parsed.hostname) {
|
|
97
|
+
throw new Error("GPT Live url must be a full ws:// or wss:// endpoint");
|
|
98
|
+
}
|
|
99
|
+
if (parsed.hostname === "api.openai.com" && parsed.pathname === "/v1/live") {
|
|
100
|
+
parsed.pathname = "/v1/live/sessions";
|
|
101
|
+
url = parsed.toString();
|
|
102
|
+
}
|
|
103
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: OPENAI_GPT_LIVE_VENDOR, api_key: o.apiKey, url,
|
|
104
|
+
params }, (o.greeting !== undefined && { greeting_message: o.greeting })), (o.failureMessage !== undefined && { failure_message: o.failureMessage })), (o.inputModalities !== undefined && { input_modalities: o.inputModalities })), (o.outputModalities !== undefined && { output_modalities: o.outputModalities })), (o.messages !== undefined && { messages: o.messages })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
20
107
|
/**
|
|
21
108
|
* OpenAI Realtime API MLLM vendor.
|
|
22
109
|
*
|
|
@@ -32,7 +119,7 @@ function requireObject(value, field, vendor) {
|
|
|
32
119
|
*/
|
|
33
120
|
export class OpenAIRealtime extends BaseMLLM {
|
|
34
121
|
constructor(options) {
|
|
35
|
-
super();
|
|
122
|
+
super(options);
|
|
36
123
|
this.options = options;
|
|
37
124
|
}
|
|
38
125
|
toConfig() {
|
|
@@ -47,7 +134,7 @@ export class OpenAIRealtime extends BaseMLLM {
|
|
|
47
134
|
voice !== undefined ||
|
|
48
135
|
instructions !== undefined ||
|
|
49
136
|
inputAudioTranscription !== undefined;
|
|
50
|
-
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 }));
|
|
137
|
+
return Object.assign(Object.assign(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 })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
51
138
|
}
|
|
52
139
|
}
|
|
53
140
|
/**
|
|
@@ -66,7 +153,7 @@ export class OpenAIRealtime extends BaseMLLM {
|
|
|
66
153
|
*/
|
|
67
154
|
export class AzureOpenAIRealtime extends BaseMLLM {
|
|
68
155
|
constructor(options) {
|
|
69
|
-
super();
|
|
156
|
+
super(options);
|
|
70
157
|
requireString(options.apiKey, "apiKey", "AzureOpenAIRealtime");
|
|
71
158
|
requireString(options.url, "url", "AzureOpenAIRealtime");
|
|
72
159
|
requireObject(options.turnDetection, "turnDetection", "AzureOpenAIRealtime");
|
|
@@ -76,7 +163,7 @@ export class AzureOpenAIRealtime extends BaseMLLM {
|
|
|
76
163
|
const { apiKey, url, model, voice, instructions, maxHistory, greetingMessage, outputModalities, messages, params, turnDetection, } = this.options;
|
|
77
164
|
const mergedParams = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((params === null || params === void 0 ? void 0 : params.model) !== undefined && { model: params.model })), ((params === null || params === void 0 ? void 0 : params.voice) !== undefined && { voice: params.voice })), ((params === null || params === void 0 ? void 0 : params.instructions) !== undefined && { instructions: params.instructions })), (model !== undefined && { model })), (voice !== undefined && { voice })), (instructions !== undefined && { instructions }));
|
|
78
165
|
const hasParams = Object.keys(mergedParams).length > 0;
|
|
79
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "azure", api_key: apiKey, url }, (hasParams && { params: mergedParams })), (maxHistory !== undefined && { max_history: maxHistory })), (greetingMessage && { greeting_message: greetingMessage })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), { turn_detection: turnDetection });
|
|
166
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "azure", api_key: apiKey, url }, (hasParams && { params: mergedParams })), (maxHistory !== undefined && { max_history: maxHistory })), (greetingMessage && { greeting_message: greetingMessage })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), { turn_detection: turnDetection }), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
80
167
|
}
|
|
81
168
|
}
|
|
82
169
|
/**
|
|
@@ -97,7 +184,7 @@ export class AzureOpenAIRealtime extends BaseMLLM {
|
|
|
97
184
|
*/
|
|
98
185
|
export class GeminiLive extends BaseMLLM {
|
|
99
186
|
constructor(options) {
|
|
100
|
-
super();
|
|
187
|
+
super(options);
|
|
101
188
|
if (!options.apiKey.trim()) {
|
|
102
189
|
throw new Error("GeminiLive requires apiKey");
|
|
103
190
|
}
|
|
@@ -108,11 +195,19 @@ export class GeminiLive extends BaseMLLM {
|
|
|
108
195
|
}
|
|
109
196
|
toConfig() {
|
|
110
197
|
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
111
|
-
const selectedModel = (model === null || model === void 0 ? void 0 : model.trim()) ||
|
|
112
|
-
|
|
113
|
-
|
|
198
|
+
const selectedModel = (model === null || model === void 0 ? void 0 : model.trim()) || GEMINI_MLLM_DEFAULT_MODEL;
|
|
199
|
+
const isGemini38 = selectedModel === GeminiLiveModels.Live38 || selectedModel === GeminiLiveModels.Live38ExtendedThinking;
|
|
200
|
+
const isExtendedThinking = selectedModel === GeminiLiveModels.Live38ExtendedThinking;
|
|
201
|
+
const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model: selectedModel }), (instructions && { instructions })), ((voice || isGemini38) && { voice: voice || "Puck" })), (isExtendedThinking &&
|
|
202
|
+
this.options.thinkingLevel !== undefined && {
|
|
203
|
+
thinking_level: this.options.thinkingLevel,
|
|
204
|
+
})), (isGemini38 && this.options.languageCodes && { language_codes: [...this.options.languageCodes] })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions }));
|
|
205
|
+
if (isGemini38) {
|
|
206
|
+
delete params.api_key;
|
|
207
|
+
if (!isExtendedThinking)
|
|
208
|
+
delete params.thinking_level;
|
|
114
209
|
}
|
|
115
|
-
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 :
|
|
210
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey, url: url !== null && url !== void 0 ? url : (isGemini38 ? GEMINI_MLLM_URL : ""), params }, (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 })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
116
211
|
}
|
|
117
212
|
}
|
|
118
213
|
/**
|
|
@@ -135,12 +230,12 @@ export class GeminiLive extends BaseMLLM {
|
|
|
135
230
|
*/
|
|
136
231
|
export class VertexAI extends BaseMLLM {
|
|
137
232
|
constructor(options) {
|
|
138
|
-
super();
|
|
233
|
+
super(options);
|
|
139
234
|
this.options = options;
|
|
140
235
|
}
|
|
141
236
|
toConfig() {
|
|
142
237
|
const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
143
|
-
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 }));
|
|
238
|
+
return Object.assign(Object.assign(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 })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
144
239
|
}
|
|
145
240
|
}
|
|
146
241
|
/**
|
|
@@ -164,7 +259,7 @@ export class VertexAI extends BaseMLLM {
|
|
|
164
259
|
*/
|
|
165
260
|
export class XaiGrok extends BaseMLLM {
|
|
166
261
|
constructor(options) {
|
|
167
|
-
super();
|
|
262
|
+
super(options);
|
|
168
263
|
this.options = options;
|
|
169
264
|
if (!options.apiKey) {
|
|
170
265
|
throw new Error("XaiGrok requires apiKey");
|
|
@@ -172,7 +267,7 @@ export class XaiGrok extends BaseMLLM {
|
|
|
172
267
|
}
|
|
173
268
|
toConfig() {
|
|
174
269
|
const { apiKey, url = "wss://api.x.ai/v1/realtime", voice, language, sampleRate, greetingMessage, failureMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
175
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "xai", api_key: apiKey, url }, (messages && { messages })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), (voice && { voice })), (language && { language })), (sampleRate !== undefined && { sample_rate: sampleRate })) }), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
270
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "xai", api_key: apiKey, url }, (messages && { messages })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), (voice && { voice })), (language && { language })), (sampleRate !== undefined && { sample_rate: sampleRate })) }), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (turnDetection && { turn_detection: turnDetection })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
176
271
|
}
|
|
177
272
|
}
|
|
178
273
|
/**
|
|
@@ -190,7 +285,7 @@ export class XaiGrok extends BaseMLLM {
|
|
|
190
285
|
*/
|
|
191
286
|
export class QwenOmni extends BaseCNMLLM {
|
|
192
287
|
constructor(options) {
|
|
193
|
-
super();
|
|
288
|
+
super(options);
|
|
194
289
|
requireString(options.apiKey, "apiKey", "QwenOmni");
|
|
195
290
|
requireString(options.model, "model", "QwenOmni");
|
|
196
291
|
requireString(options.url, "url", "QwenOmni");
|
|
@@ -198,6 +293,6 @@ export class QwenOmni extends BaseCNMLLM {
|
|
|
198
293
|
}
|
|
199
294
|
toConfig() {
|
|
200
295
|
const { apiKey, model, url, voice, instructions, greetingMessage, failureMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
201
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "qwen_omni", api_key: apiKey, url, params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { model }), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })) }, (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (turnDetection && { turn_detection: turnDetection }));
|
|
296
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "qwen_omni", api_key: apiKey, url, params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { model }), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })) }, (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (turnDetection && { turn_detection: turnDetection })), (this.mcpServers !== undefined && { mcp_servers: this.mcpServers })), (this.tools !== undefined && { tools: this.tools }));
|
|
202
297
|
}
|
|
203
298
|
}
|
|
@@ -369,4 +369,45 @@ export declare class XAiSTT extends BaseSTT {
|
|
|
369
369
|
constructor(options: XAiSTTOptions);
|
|
370
370
|
toConfig(): SttConfig;
|
|
371
371
|
}
|
|
372
|
+
/** Constructor options for Smallest AI STT. */
|
|
373
|
+
export interface SmallestAISTTOptions {
|
|
374
|
+
/** Smallest AI API key. */
|
|
375
|
+
apiKey: string;
|
|
376
|
+
/** Language code for speech recognition. */
|
|
377
|
+
language?: string;
|
|
378
|
+
/** WebSocket endpoint for the Smallest AI streaming STT API. */
|
|
379
|
+
url?: string;
|
|
380
|
+
/** Input audio sample rate in Hz. */
|
|
381
|
+
sampleRate?: number;
|
|
382
|
+
/** Input audio encoding. */
|
|
383
|
+
encoding?: string;
|
|
384
|
+
/** Boolean options are serialized as `"true"` or `"false"` for the Smallest AI wire protocol. */
|
|
385
|
+
wordTimestamps?: boolean;
|
|
386
|
+
sentenceTimestamps?: boolean;
|
|
387
|
+
diarize?: boolean;
|
|
388
|
+
vadEvents?: boolean;
|
|
389
|
+
endpointing?: boolean;
|
|
390
|
+
/** End-of-utterance timeout in milliseconds. */
|
|
391
|
+
eouTimeoutMs?: number;
|
|
392
|
+
format?: boolean;
|
|
393
|
+
finalizeOnWords?: boolean;
|
|
394
|
+
/** Maximum number of words per result. */
|
|
395
|
+
maxWords?: string;
|
|
396
|
+
punctuate?: boolean;
|
|
397
|
+
capitalize?: boolean;
|
|
398
|
+
itnNormalize?: boolean;
|
|
399
|
+
fullTranscript?: boolean;
|
|
400
|
+
/** Comma-separated keyword boosts in `keyword:weight` format. */
|
|
401
|
+
keywords?: string;
|
|
402
|
+
redactPii?: boolean;
|
|
403
|
+
redactPci?: boolean;
|
|
404
|
+
/** Additional Smallest AI parameters. Explicit options take precedence. */
|
|
405
|
+
additionalParams?: Partial<import("../types.mjs").SmallestAiAsrParams>;
|
|
406
|
+
}
|
|
407
|
+
/** Smallest AI streaming STT vendor. */
|
|
408
|
+
export declare class SmallestAISTT extends BaseSTT {
|
|
409
|
+
private readonly options;
|
|
410
|
+
constructor(options: SmallestAISTTOptions);
|
|
411
|
+
toConfig(): SttConfig;
|
|
412
|
+
}
|
|
372
413
|
export {};
|
|
@@ -315,3 +315,19 @@ export class XAiSTT extends BaseSTT {
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
+
/** Smallest AI streaming STT vendor. */
|
|
319
|
+
export class SmallestAISTT extends BaseSTT {
|
|
320
|
+
constructor(options) {
|
|
321
|
+
super();
|
|
322
|
+
this.options = options;
|
|
323
|
+
if (!options.apiKey)
|
|
324
|
+
throw new Error("SmallestAISTT requires apiKey");
|
|
325
|
+
}
|
|
326
|
+
toConfig() {
|
|
327
|
+
const o = this.options;
|
|
328
|
+
return {
|
|
329
|
+
vendor: "smallestai",
|
|
330
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, o.additionalParams), { api_key: o.apiKey }), (o.language !== undefined && { language: o.language })), (o.url !== undefined && { url: o.url })), (o.sampleRate !== undefined && { sample_rate: o.sampleRate })), (o.encoding !== undefined && { encoding: o.encoding })), (o.wordTimestamps !== undefined && { word_timestamps: String(o.wordTimestamps) })), (o.sentenceTimestamps !== undefined && { sentence_timestamps: String(o.sentenceTimestamps) })), (o.diarize !== undefined && { diarize: String(o.diarize) })), (o.vadEvents !== undefined && { vad_events: String(o.vadEvents) })), (o.endpointing !== undefined && { endpointing: String(o.endpointing) })), (o.eouTimeoutMs !== undefined && { eou_timeout_ms: o.eouTimeoutMs })), (o.format !== undefined && { format: String(o.format) })), (o.finalizeOnWords !== undefined && { finalize_on_words: String(o.finalizeOnWords) })), (o.maxWords !== undefined && { max_words: o.maxWords })), (o.punctuate !== undefined && { punctuate: String(o.punctuate) })), (o.capitalize !== undefined && { capitalize: String(o.capitalize) })), (o.itnNormalize !== undefined && { itn_normalize: String(o.itnNormalize) })), (o.fullTranscript !== undefined && { full_transcript: String(o.fullTranscript) })), (o.keywords !== undefined && { keywords: o.keywords })), (o.redactPii !== undefined && { redact_pii: String(o.redactPii) })), (o.redactPci !== undefined && { redact_pci: String(o.redactPci) })),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -652,4 +652,31 @@ export declare class XAiTTS extends BaseTTS {
|
|
|
652
652
|
constructor(options: XAiTTSOptions);
|
|
653
653
|
toConfig(): TtsConfig;
|
|
654
654
|
}
|
|
655
|
+
/** Constructor options for Smallest AI TTS. */
|
|
656
|
+
export interface SmallestAITTSOptions {
|
|
657
|
+
/** Smallest AI API key. */
|
|
658
|
+
apiKey: string;
|
|
659
|
+
/** HTTP endpoint for the Smallest AI streaming TTS API. */
|
|
660
|
+
url?: string;
|
|
661
|
+
model?: string;
|
|
662
|
+
voiceId?: string;
|
|
663
|
+
sampleRate?: number;
|
|
664
|
+
speed?: number;
|
|
665
|
+
language?: string;
|
|
666
|
+
numberPronunciationLanguage?: string;
|
|
667
|
+
mathNotation?: boolean;
|
|
668
|
+
pronunciationDicts?: string[];
|
|
669
|
+
sessionId?: string;
|
|
670
|
+
requestId?: string;
|
|
671
|
+
/** Additional Smallest AI parameters. Explicit options take precedence. */
|
|
672
|
+
additionalParams?: Partial<import("../types.mjs").SmallestAiTtsParams>;
|
|
673
|
+
/** Skip patterns for bracketed content. */
|
|
674
|
+
skipPatterns?: number[];
|
|
675
|
+
}
|
|
676
|
+
/** Smallest AI streaming TTS vendor. */
|
|
677
|
+
export declare class SmallestAITTS extends BaseTTS {
|
|
678
|
+
private readonly options;
|
|
679
|
+
constructor(options: SmallestAITTSOptions);
|
|
680
|
+
toConfig(): TtsConfig;
|
|
681
|
+
}
|
|
655
682
|
export {};
|
|
@@ -437,3 +437,17 @@ export class XAiTTS extends BaseTTS {
|
|
|
437
437
|
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 }));
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
+
/** Smallest AI streaming TTS vendor. */
|
|
441
|
+
export class SmallestAITTS extends BaseTTS {
|
|
442
|
+
constructor(options) {
|
|
443
|
+
super();
|
|
444
|
+
this.options = options;
|
|
445
|
+
requireString(options.apiKey, "apiKey", "SmallestAITTS");
|
|
446
|
+
}
|
|
447
|
+
toConfig() {
|
|
448
|
+
const o = this.options;
|
|
449
|
+
return Object.assign({ vendor: "smallestai", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, o.additionalParams), { api_key: o.apiKey }), (o.url !== undefined && { url: o.url })), (o.model !== undefined && { model: o.model })), (o.voiceId !== undefined && { voice_id: o.voiceId })), (o.sampleRate !== undefined && { sample_rate: o.sampleRate })), (o.speed !== undefined && { speed: o.speed })), (o.language !== undefined && { language: o.language })), (o.numberPronunciationLanguage !== undefined && {
|
|
450
|
+
number_pronunciation_language: o.numberPronunciationLanguage,
|
|
451
|
+
})), (o.mathNotation !== undefined && { math_notation: o.mathNotation })), (o.pronunciationDicts !== undefined && { pronunciation_dicts: o.pronunciationDicts })), (o.sessionId !== undefined && { session_id: o.sessionId })), (o.requestId !== undefined && { request_id: o.requestId })) }, (o.skipPatterns !== undefined && { skip_patterns: o.skipPatterns }));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
@@ -194,6 +194,8 @@ export declare namespace StartAgentsRequest {
|
|
|
194
194
|
/**
|
|
195
195
|
* LiveAvatar (Beta) — formerly HeyGen */
|
|
196
196
|
readonly Liveavatar: "liveavatar";
|
|
197
|
+
/**
|
|
198
|
+
* Anam Avatar (Beta) */
|
|
197
199
|
readonly Anam: "anam";
|
|
198
200
|
/**
|
|
199
201
|
* Generic avatar (Beta) */
|
|
@@ -608,7 +610,7 @@ export declare namespace StartAgentsRequest {
|
|
|
608
610
|
/**
|
|
609
611
|
* Filler word content mode:
|
|
610
612
|
* - `static`: Static filler words. Uses a predefined list of filler words.
|
|
611
|
-
* - `generated`: LLM-generated filler words based on
|
|
613
|
+
* - `generated`: LLM-generated filler words based on recent conversation context.
|
|
612
614
|
*/
|
|
613
615
|
mode?: Content.Mode;
|
|
614
616
|
/** Static filler word configuration. Required when `mode` is `static`. */
|
|
@@ -620,7 +622,7 @@ export declare namespace StartAgentsRequest {
|
|
|
620
622
|
/**
|
|
621
623
|
* Filler word content mode:
|
|
622
624
|
* - `static`: Static filler words. Uses a predefined list of filler words.
|
|
623
|
-
* - `generated`: LLM-generated filler words based on
|
|
625
|
+
* - `generated`: LLM-generated filler words based on recent conversation context.
|
|
624
626
|
*/
|
|
625
627
|
const Mode: {
|
|
626
628
|
readonly Static: "static";
|
|
@@ -656,16 +658,20 @@ export declare namespace StartAgentsRequest {
|
|
|
656
658
|
* Optional configuration for generated filler words. When omitted, the service uses its default generator settings.
|
|
657
659
|
*/
|
|
658
660
|
interface GeneratedConfig {
|
|
659
|
-
/** OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM
|
|
661
|
+
/** OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM. */
|
|
660
662
|
llm_provider?: GeneratedConfig.LlmProvider;
|
|
661
|
-
/** System prompt used to generate a short filler phrase based on
|
|
663
|
+
/** System prompt used to generate a short filler phrase based on recent conversation context. The generated text should be conversational and must not answer the user's question. */
|
|
662
664
|
prompt?: string;
|
|
663
665
|
/** Fallback strategy when generated filler text is not ready, fails, or returns empty text. Phase 1 only supports `static`. */
|
|
664
666
|
fallback_strategy?: "static";
|
|
667
|
+
/** Maximum number of recent conversation messages used to generate a filler word. */
|
|
668
|
+
context_message_limit?: number;
|
|
669
|
+
/** Maximum number of characters from conversation history used to generate a filler word. */
|
|
670
|
+
history_character_limit?: number;
|
|
665
671
|
}
|
|
666
672
|
namespace GeneratedConfig {
|
|
667
673
|
/**
|
|
668
|
-
* OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM
|
|
674
|
+
* OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM.
|
|
669
675
|
*/
|
|
670
676
|
interface LlmProvider {
|
|
671
677
|
/** URL of the OpenAI-compatible chat completions endpoint. If the URL does not end with `/chat/completions`, the engine appends it automatically. */
|