agora-agents 2.15.0 → 2.16.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.d.ts +6 -3
- package/dist/cjs/agentkit/Agent.js +50 -18
- package/dist/cjs/agentkit/AgentSession.js +1 -5
- package/dist/cjs/agentkit/index.d.ts +2 -2
- package/dist/cjs/agentkit/index.js +4 -2
- package/dist/cjs/agentkit/preview/client.d.ts +10 -3
- package/dist/cjs/agentkit/preview/client.js +22 -13
- package/dist/cjs/agentkit/preview/index.d.ts +2 -2
- package/dist/cjs/agentkit/preview/index.js +3 -1
- package/dist/cjs/agentkit/preview/vendors.d.ts +2 -2
- package/dist/cjs/agentkit/preview/vendors.js +3 -1
- package/dist/cjs/agentkit/vendors/mllm.d.ts +56 -4
- package/dist/cjs/agentkit/vendors/mllm.js +62 -7
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +6 -4
- 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.d.mts +6 -3
- package/dist/esm/agentkit/Agent.mjs +50 -18
- package/dist/esm/agentkit/AgentSession.mjs +1 -5
- package/dist/esm/agentkit/index.d.mts +2 -2
- package/dist/esm/agentkit/index.mjs +1 -1
- package/dist/esm/agentkit/preview/client.d.mts +10 -3
- package/dist/esm/agentkit/preview/client.mjs +22 -13
- package/dist/esm/agentkit/preview/index.d.mts +2 -2
- package/dist/esm/agentkit/preview/index.mjs +1 -1
- package/dist/esm/agentkit/preview/vendors.d.mts +2 -2
- package/dist/esm/agentkit/preview/vendors.mjs +1 -1
- package/dist/esm/agentkit/vendors/mllm.d.mts +56 -4
- package/dist/esm/agentkit/vendors/mllm.mjs +60 -6
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -36,10 +36,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.AgoraTimeoutError = exports.AgoraError = exports.AgoraEnvironment = exports.Area = exports.Agora = exports.GeminiTTSModels = exports.GeminiTTS = exports.XfyunSTT = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.XaiGrok = exports.XAiTTS = exports.XAiSTT = void 0;
|
|
39
|
+
exports.GEMINI_MLLM_URL = exports.GEMINI_MLLM_DEFAULT_MODEL = exports.GEMINI_LIVE_MODEL_TABLE = exports.GEMINI_EAP_MLLM_MODELS = exports.FishAudioTTS = exports.FishAudioSTT = exports.FillerWordsSelectionRule = exports.FengmingSTT = exports.ExpiresIn = exports.ElevenLabsTTS = exports.ElevenLabsSTT = exports.Dify = exports.DeepSeekLLM = exports.DeepgramTTS = exports.DeepgramSTT = exports.DataChannel = exports.createPreviewRoute = exports.CustomLLM = exports.CredentialMode = exports.CosyVoiceTTS = exports.CartesiaTTS = exports.BytedanceTTS = exports.BytedanceLLM = exports.BytedanceDuplexTTS = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseCNTTS = exports.BaseCNSTT = exports.BaseCNMLLM = exports.BaseCNLLM = exports.BaseCNAvatar = exports.BaseAvatar = exports.AzureOpenAIRealtime = exports.AzureOpenAI = exports.AudioScenario = exports.AssemblyAISTT = exports.AresSTT = exports.Anthropic = exports.AnamAvatar = exports.AmazonTTS = exports.AmazonSTT = exports.AmazonBedrock = exports.AliyunLLM = exports.AkoolAvatar = exports.AgentSession = exports.AgentPresets = exports.Agent = exports.AgoraClient = void 0;
|
|
40
|
+
exports.normalizePresetInput = exports.MurfTTS = exports.MllmTurnDetectionModeValues = exports.MllmTurnDetectionModeServerVad = exports.MllmTurnDetectionModeSemanticVad = exports.MllmTurnDetectionModeAgoraVad = exports.MistralTTS = exports.MiniMaxTTS = exports.MiniMaxDuplexTTS = exports.MiniMaxCNTTS = exports.MicrosoftTTS = exports.MicrosoftSTT = exports.MicrosoftCNTTS = exports.MicrosoftCNSTT = exports.MAX_EXPIRY_SECONDS = exports.LiveAvatarAvatar = exports.LemonSlice = exports.isSpatiusAvatar = exports.isSensetimeAvatar = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.InterruptionModeValues = exports.InterruptionModeStartOfSpeech = exports.InterruptionModeKeywords = exports.InterruptionDisabledStrategyIgnore = exports.InterruptionDisabledStrategyAppend = exports.InterruptionDisabledStrategy = exports.HeyGenAvatar = exports.generateRtcToken = exports.generateConvoAIToken = exports.generateClientToken = exports.Groq = exports.GradiumTTS = exports.GoogleTTS = exports.GoogleSTT = exports.Geofence = exports.GenericTTS = exports.GenericAvatar = exports.GeminiTranscriptionMode = exports.GeminiThinkingLevels = exports.GeminiSTTModels = exports.GeminiSTT = exports.GeminiLiveModels = exports.GeminiLive = exports.Gemini = exports.GEMINI_PREVIEW_MLLM_URL = void 0;
|
|
41
|
+
exports.VertexAILLM = exports.VertexAI = exports.toBaseAvatarConfig = exports.TypecastTTS = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.Tavus = exports.StepFunTTS = exports.StepFunSTT = exports.SpeechmaticsSTT = exports.SpeakPriorityValues = exports.SpeakPriorityInterrupt = exports.SpeakPriorityIgnore = exports.SpeakPriorityAppend = exports.SpatiusAvatar = exports.SonioxTTS = exports.SmallestAITTS = exports.SmallestAISTT = exports.SilenceActionValues = exports.SensetimeAvatar = exports.SarvamTTSLanguage = exports.SarvamTTS = exports.SarvamSTT = exports.SalModeValues = exports.redactSecrets = exports.redactHeadersForDebug = exports.RTZRSTT = exports.RimeTTS = exports.REDACTED = exports.QwenSTT = exports.QwenOmni = exports.previewRequestHeaders = exports.Protoface = exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = exports.OpenAITTS = exports.OpenAISTT = exports.OpenAIRealtime = exports.OpenAIGPTLive = exports.OpenAI = void 0;
|
|
42
|
+
exports.AgoraTimeoutError = exports.AgoraError = exports.AgoraEnvironment = exports.Area = exports.Agora = exports.GeminiTTSModels = exports.GeminiTTS = exports.XfyunSTT = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.XaiGrok = exports.XAiTTS = exports.XAiSTT = exports.validateTtsSampleRate = exports.validateAvatarConfig = void 0;
|
|
43
43
|
var AgoraPoolClient_js_1 = require("./AgoraPoolClient.js");
|
|
44
44
|
Object.defineProperty(exports, "AgoraClient", { enumerable: true, get: function () { return AgoraPoolClient_js_1.AgoraClient; } });
|
|
45
45
|
// Agentkit layer exports - clean, ergonomic API
|
|
@@ -91,6 +91,8 @@ Object.defineProperty(exports, "FengmingSTT", { enumerable: true, get: function
|
|
|
91
91
|
Object.defineProperty(exports, "FillerWordsSelectionRule", { enumerable: true, get: function () { return index_js_1.FillerWordsSelectionRule; } });
|
|
92
92
|
Object.defineProperty(exports, "FishAudioSTT", { enumerable: true, get: function () { return index_js_1.FishAudioSTT; } });
|
|
93
93
|
Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return index_js_1.FishAudioTTS; } });
|
|
94
|
+
Object.defineProperty(exports, "GEMINI_EAP_MLLM_MODELS", { enumerable: true, get: function () { return index_js_1.GEMINI_EAP_MLLM_MODELS; } });
|
|
95
|
+
Object.defineProperty(exports, "GEMINI_LIVE_MODEL_TABLE", { enumerable: true, get: function () { return index_js_1.GEMINI_LIVE_MODEL_TABLE; } });
|
|
94
96
|
Object.defineProperty(exports, "GEMINI_MLLM_DEFAULT_MODEL", { enumerable: true, get: function () { return index_js_1.GEMINI_MLLM_DEFAULT_MODEL; } });
|
|
95
97
|
Object.defineProperty(exports, "GEMINI_MLLM_URL", { enumerable: true, get: function () { return index_js_1.GEMINI_MLLM_URL; } });
|
|
96
98
|
Object.defineProperty(exports, "GEMINI_PREVIEW_MLLM_URL", { enumerable: true, get: function () { return index_js_1.GEMINI_PREVIEW_MLLM_URL; } });
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.
|
|
1
|
+
export declare const SDK_VERSION = "v2.16.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -5,8 +5,8 @@ export function normalizeClientOptions(options) {
|
|
|
5
5
|
const headers = mergeHeaders({
|
|
6
6
|
"X-Fern-Language": "JavaScript",
|
|
7
7
|
"X-Fern-SDK-Name": "agora-agents",
|
|
8
|
-
"X-Fern-SDK-Version": "v2.
|
|
9
|
-
"User-Agent": "agora-agents/v2.
|
|
8
|
+
"X-Fern-SDK-Version": "v2.16.0",
|
|
9
|
+
"User-Agent": "agora-agents/v2.16.0",
|
|
10
10
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
11
11
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
12
12
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -155,9 +155,12 @@ export declare class Agent<TTSSampleRate extends number = number, TArea extends
|
|
|
155
155
|
* Returns a new Agent with the specified MLLM vendor.
|
|
156
156
|
*
|
|
157
157
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
158
|
-
* ASR → LLM → TTS pipeline. Calling this method
|
|
159
|
-
* `
|
|
160
|
-
* are not
|
|
158
|
+
* ASR → LLM → TTS pipeline. Calling this method makes the start request
|
|
159
|
+
* send `advanced_features.enable_mllm: true` (merged with any other
|
|
160
|
+
* advanced features), so `withLlm()`, `withTts()`, and `withStt()` are not
|
|
161
|
+
* needed. `mllm.enable` is never sent: when it is present the backend does
|
|
162
|
+
* not deliver RTM `message.metrics`. A vendor config that sets it has it
|
|
163
|
+
* removed.
|
|
161
164
|
*
|
|
162
165
|
* Note: avatars are not supported with MLLM. The avatar publisher requires
|
|
163
166
|
* the cascading ASR + LLM + TTS pipeline. Combining `withMllm()` and
|
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
* multiple sessions. Set the unique agent instance `name` in
|
|
6
6
|
* {@link Agent.createSession}, not on the Agent itself.
|
|
7
7
|
*/
|
|
8
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
9
|
+
var t = {};
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
13
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
14
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
15
|
+
t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
8
19
|
import { Area } from "../core/domain/index.mjs";
|
|
9
20
|
import { AgentSession } from "./AgentSession.mjs";
|
|
10
21
|
import { AudioScenario } from "./constants.mjs";
|
|
@@ -16,6 +27,28 @@ function toGeneratedMllm(config) {
|
|
|
16
27
|
// this wire boundary so the public and builder APIs remain accurately typed.
|
|
17
28
|
return config;
|
|
18
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns a copy of an MLLM config without `mllm.enable`.
|
|
32
|
+
*
|
|
33
|
+
* The SDK enables MLLM with `advanced_features.enable_mllm`, never with
|
|
34
|
+
* `mllm.enable`. When `mllm.enable` is present in the start body the backend
|
|
35
|
+
* does not send RTM `message.metrics` (ttfb), even if
|
|
36
|
+
* `advanced_features.enable_mllm` is also set. Audio and transcripts are not
|
|
37
|
+
* affected, so the problem is easy to miss. A value set by a custom vendor or a
|
|
38
|
+
* hand-written config is dropped for the same reason.
|
|
39
|
+
*/
|
|
40
|
+
function withoutMllmEnable(config) {
|
|
41
|
+
const { enable: _dropped } = config, rest = __rest(config, ["enable"]);
|
|
42
|
+
return rest;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merges `enable_mllm: true` into the caller's advanced features (for example
|
|
46
|
+
* `enable_rtm`). Used only for MLLM sessions; the cascading pipeline never
|
|
47
|
+
* gets `enable_mllm`.
|
|
48
|
+
*/
|
|
49
|
+
function withEnableMllm(features) {
|
|
50
|
+
return Object.assign(Object.assign({}, features), { enable_mllm: true });
|
|
51
|
+
}
|
|
19
52
|
const INTERACTION_LANGUAGES = new Set([
|
|
20
53
|
"ar-EG",
|
|
21
54
|
"ar-JO",
|
|
@@ -209,9 +242,12 @@ export class Agent {
|
|
|
209
242
|
* Returns a new Agent with the specified MLLM vendor.
|
|
210
243
|
*
|
|
211
244
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
212
|
-
* ASR → LLM → TTS pipeline. Calling this method
|
|
213
|
-
* `
|
|
214
|
-
* are not
|
|
245
|
+
* ASR → LLM → TTS pipeline. Calling this method makes the start request
|
|
246
|
+
* send `advanced_features.enable_mllm: true` (merged with any other
|
|
247
|
+
* advanced features), so `withLlm()`, `withTts()`, and `withStt()` are not
|
|
248
|
+
* needed. `mllm.enable` is never sent: when it is present the backend does
|
|
249
|
+
* not deliver RTM `message.metrics`. A vendor config that sets it has it
|
|
250
|
+
* removed.
|
|
215
251
|
*
|
|
216
252
|
* Note: avatars are not supported with MLLM. The avatar publisher requires
|
|
217
253
|
* the cascading ASR + LLM + TTS pipeline. Combining `withMllm()` and
|
|
@@ -220,14 +256,8 @@ export class Agent {
|
|
|
220
256
|
* @param vendor - MLLM vendor instance (e.g., new VertexAI({ model: '...', projectId: '...', ... }))
|
|
221
257
|
*/
|
|
222
258
|
withMllm(vendor) {
|
|
223
|
-
var _a;
|
|
224
259
|
const newAgent = this._clone();
|
|
225
|
-
newAgent._mllm =
|
|
226
|
-
if (((_a = newAgent._advancedFeatures) === null || _a === void 0 ? void 0 : _a.enable_mllm) !== undefined) {
|
|
227
|
-
const advancedFeatures = Object.assign({}, newAgent._advancedFeatures);
|
|
228
|
-
delete advancedFeatures.enable_mllm;
|
|
229
|
-
newAgent._advancedFeatures = Object.keys(advancedFeatures).length > 0 ? advancedFeatures : undefined;
|
|
230
|
-
}
|
|
260
|
+
newAgent._mllm = withoutMllmEnable(vendor.toConfig());
|
|
231
261
|
return newAgent;
|
|
232
262
|
}
|
|
233
263
|
/**
|
|
@@ -618,10 +648,10 @@ export class Agent {
|
|
|
618
648
|
* and RTM privileges (required for RTM-enabled sessions).
|
|
619
649
|
*/
|
|
620
650
|
toProperties(opts) {
|
|
621
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
651
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
622
652
|
// In MLLM mode the backend handles audio end-to-end; LLM, TTS, and ASR
|
|
623
653
|
// are not required.
|
|
624
|
-
const isMllmMode =
|
|
654
|
+
const isMllmMode = this._mllm !== undefined;
|
|
625
655
|
// Reject incompatible combinations before any work (token generation, etc.).
|
|
626
656
|
// Avatars are currently supported only with the cascading ASR/LLM/TTS pipeline;
|
|
627
657
|
// the MLLM pipeline does not flow through the avatar publisher, so combining
|
|
@@ -651,7 +681,7 @@ export class Agent {
|
|
|
651
681
|
// to receive transcripts and state events. Default it automatically so
|
|
652
682
|
// callers only need to set advancedFeatures.enable_rtm: true.
|
|
653
683
|
let resolvedParameters = this._parameters;
|
|
654
|
-
if (((
|
|
684
|
+
if (((_a = this._advancedFeatures) === null || _a === void 0 ? void 0 : _a.enable_rtm) && !(resolvedParameters === null || resolvedParameters === void 0 ? void 0 : resolvedParameters.data_channel)) {
|
|
655
685
|
resolvedParameters = Object.assign(Object.assign({}, resolvedParameters), { data_channel: "rtm" });
|
|
656
686
|
}
|
|
657
687
|
if ((resolvedParameters === null || resolvedParameters === void 0 ? void 0 : resolvedParameters.audio_scenario) === undefined) {
|
|
@@ -676,7 +706,9 @@ export class Agent {
|
|
|
676
706
|
filler_words: this._fillerWords,
|
|
677
707
|
};
|
|
678
708
|
if (isMllmMode) {
|
|
679
|
-
|
|
709
|
+
// `mllm.enable` is never sent; `advanced_features.enable_mllm` enables MLLM.
|
|
710
|
+
// See withoutMllmEnable() for why.
|
|
711
|
+
const mllmConfig = toGeneratedMllm(this._mllm ? withoutMllmEnable(this._mllm) : undefined);
|
|
680
712
|
if (mllmConfig) {
|
|
681
713
|
// Vendor config wins: only apply agent-level values when the vendor hasn't already set them.
|
|
682
714
|
// Consistent with Python (setdefault) and Go (!exists) semantics.
|
|
@@ -693,15 +725,15 @@ export class Agent {
|
|
|
693
725
|
if (isOpenAIGPTLive && this._turnDetection !== undefined) {
|
|
694
726
|
console.warn("GPT Live v3 ignores agent-level turn_detection; endpointing is internal");
|
|
695
727
|
}
|
|
696
|
-
return Object.assign(Object.assign(Object.assign({}, base), { mllm: mllmConfig }), (!isOpenAIGPTLive &&
|
|
728
|
+
return Object.assign(Object.assign(Object.assign({}, base), { advanced_features: withEnableMllm(this._advancedFeatures), mllm: mllmConfig }), (!isOpenAIGPTLive &&
|
|
697
729
|
this._turnDetection !== undefined && {
|
|
698
730
|
turn_detection: Object.assign(Object.assign({}, this._turnDetection), (this._turnDetection.language !== undefined && {
|
|
699
731
|
language: toWireLanguage(this._turnDetection.language),
|
|
700
732
|
})),
|
|
701
733
|
}));
|
|
702
734
|
}
|
|
703
|
-
const skipCategories = new Set((
|
|
704
|
-
const allowMissingCategories = new Set((
|
|
735
|
+
const skipCategories = new Set((_b = opts.skipVendorValidationCategories) !== null && _b !== void 0 ? _b : []);
|
|
736
|
+
const allowMissingCategories = new Set((_c = opts.allowMissingVendorCategories) !== null && _c !== void 0 ? _c : []);
|
|
705
737
|
if (opts.skipVendorValidation) {
|
|
706
738
|
for (const category of ["asr", "llm", "tts"]) {
|
|
707
739
|
skipCategories.add(category);
|
|
@@ -724,7 +756,7 @@ export class Agent {
|
|
|
724
756
|
? this._llm.system_messages
|
|
725
757
|
: this._instructions
|
|
726
758
|
? [{ role: "system", content: this._instructions }]
|
|
727
|
-
: undefined, greeting_message: (
|
|
759
|
+
: undefined, greeting_message: (_d = this._llm.greeting_message) !== null && _d !== void 0 ? _d : this._greeting, greeting_configs: (_e = this._llm.greeting_configs) !== null && _e !== void 0 ? _e : this._greetingConfigs, failure_message: (_f = this._llm.failure_message) !== null && _f !== void 0 ? _f : this._failureMessage, max_history: (_g = this._llm.max_history) !== null && _g !== void 0 ? _g : this._maxHistory }) : undefined;
|
|
728
760
|
const turnDetectionConfig = resolveTurnDetectionConfig(this._turnDetection);
|
|
729
761
|
const asrConfig = this._stt !== undefined || !allowMissingAsr
|
|
730
762
|
? this._resolveAsrConfig(turnDetectionConfig)
|
|
@@ -194,11 +194,7 @@ export class AgentSession {
|
|
|
194
194
|
* Returns true when the agent is configured for MLLM (multimodal end-to-end audio).
|
|
195
195
|
*/
|
|
196
196
|
_isMllmMode() {
|
|
197
|
-
|
|
198
|
-
if ((mllm === null || mllm === void 0 ? void 0 : mllm.enable) === true) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
return mllm !== undefined;
|
|
197
|
+
return this._agent.mllm !== undefined;
|
|
202
198
|
}
|
|
203
199
|
/**
|
|
204
200
|
* Warns when agent-level `instructions` would be silently discarded.
|
|
@@ -44,8 +44,8 @@ export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions,
|
|
|
44
44
|
export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, MiniMaxDuplexTTS, QwenSTT, SensetimeAvatar, SpatiusAvatar, StepFunSTT, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
|
|
45
45
|
export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, CustomLLMOptions, DifyOptions, GeminiOptions, GroqOptions, OpenAIOptions, VertexAILLMOptions, } from "./vendors/llm.mjs";
|
|
46
46
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
47
|
-
export type { AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, GeminiLiveModel, GeminiLiveOptions, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, OpenAIRealtimeOptions, QwenOmniOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
|
|
48
|
-
export { AzureOpenAIRealtime, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
47
|
+
export type { AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, GeminiLiveModel, GeminiLiveModelRow, GeminiLiveModelSpec, GeminiLiveOptions, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, OpenAIRealtimeOptions, QwenOmniOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
|
|
48
|
+
export { AzureOpenAIRealtime, GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
49
49
|
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, ElevenLabsSTTOptions, FishAudioSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, RTZRSTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.mjs";
|
|
50
50
|
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, ElevenLabsSTT, FishAudioSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
51
51
|
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MistralTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, SmallestAITTSOptions, SonioxTTSOptions, TypecastTTSOptions, XAiTTSOptions, } from "./vendors/tts.mjs";
|
|
@@ -37,7 +37,7 @@ export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS
|
|
|
37
37
|
// LLM vendor classes
|
|
38
38
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
39
39
|
// MLLM vendor classes
|
|
40
|
-
export { AzureOpenAIRealtime, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
40
|
+
export { AzureOpenAIRealtime, GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
41
41
|
// STT vendor classes
|
|
42
42
|
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, ElevenLabsSTT, FishAudioSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
43
43
|
// TTS vendor classes
|
|
@@ -16,7 +16,7 @@ import type * as Agora from "../../api/index.mjs";
|
|
|
16
16
|
import { AgentManagementClient } from "../../api/resources/agentManagement/client/Client.mjs";
|
|
17
17
|
import { AgentsClient } from "../../api/resources/agents/client/Client.mjs";
|
|
18
18
|
/** Base URL that serves the preview providers. */
|
|
19
|
-
export declare const PREVIEW_API_BASE_URL = "https://
|
|
19
|
+
export declare const PREVIEW_API_BASE_URL = "https://us-west-1-preview.ai.agora.io/api/conversational-ai-agent";
|
|
20
20
|
/**
|
|
21
21
|
* Request header that opts a request into a preview provider family.
|
|
22
22
|
*
|
|
@@ -31,6 +31,8 @@ export declare const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
31
31
|
* preview endpoint.
|
|
32
32
|
*/
|
|
33
33
|
export declare const PreviewFeatures: {
|
|
34
|
+
/** Gemini Live EAP models. */
|
|
35
|
+
readonly Gemini: "gemini";
|
|
34
36
|
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
35
37
|
readonly GeminiLive: "gemini-live";
|
|
36
38
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
@@ -52,8 +54,13 @@ export interface PreviewRoute {
|
|
|
52
54
|
export declare function previewRequestHeaders(features: readonly PreviewFeature[], headers?: Record<string, string>): Record<string, string>;
|
|
53
55
|
/** Build generated resource clients for one preview session. */
|
|
54
56
|
export declare function createPreviewRoute(client: AgoraClient, features: readonly PreviewFeature[]): PreviewRoute;
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Returns the preview features a start request needs. Routing is chosen by
|
|
59
|
+
* `mllm.params.model` alone, using `GEMINI_LIVE_MODEL_TABLE`. It reads the
|
|
60
|
+
* request body rather than the vendor classes, so hand-written configs are
|
|
61
|
+
* covered too.
|
|
62
|
+
*/
|
|
63
|
+
export declare function requiredPreviewFeatures(properties: Agora.StartAgentsRequest.Properties): PreviewFeature[];
|
|
57
64
|
/**
|
|
58
65
|
* Normalizes the historical Gemini preview greeting field for production.
|
|
59
66
|
* Kept under its old name so callers importing this compatibility helper do
|
|
@@ -22,8 +22,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
import { AgentManagementClient } from "../../api/resources/agentManagement/client/Client.mjs";
|
|
24
24
|
import { AgentsClient } from "../../api/resources/agents/client/Client.mjs";
|
|
25
|
+
import { resolveGeminiLiveModel } from "../vendors/mllm.mjs";
|
|
25
26
|
/** Base URL that serves the preview providers. */
|
|
26
|
-
export const PREVIEW_API_BASE_URL = "https://
|
|
27
|
+
export const PREVIEW_API_BASE_URL = "https://us-west-1-preview.ai.agora.io/api/conversational-ai-agent";
|
|
27
28
|
/**
|
|
28
29
|
* Request header that opts a request into a preview provider family.
|
|
29
30
|
*
|
|
@@ -38,6 +39,8 @@ export const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
38
39
|
* preview endpoint.
|
|
39
40
|
*/
|
|
40
41
|
export const PreviewFeatures = {
|
|
42
|
+
/** Gemini Live EAP models. */
|
|
43
|
+
Gemini: "gemini",
|
|
41
44
|
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
42
45
|
GeminiLive: "gemini-live",
|
|
43
46
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
@@ -67,26 +70,32 @@ export function createPreviewRoute(client, features) {
|
|
|
67
70
|
features: [...features],
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
function geminiLiveModelSpec(properties) {
|
|
74
|
+
var _a;
|
|
75
|
+
const mllm = properties.mllm;
|
|
76
|
+
const model = (_a = mllm === null || mllm === void 0 ? void 0 : mllm.params) === null || _a === void 0 ? void 0 : _a.model;
|
|
77
|
+
return (mllm === null || mllm === void 0 ? void 0 : mllm.vendor) === "gemini" && typeof model === "string" ? resolveGeminiLiveModel(model) : undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the preview features a start request needs. Routing is chosen by
|
|
81
|
+
* `mllm.params.model` alone, using `GEMINI_LIVE_MODEL_TABLE`. It reads the
|
|
82
|
+
* request body rather than the vendor classes, so hand-written configs are
|
|
83
|
+
* covered too.
|
|
84
|
+
*/
|
|
85
|
+
export function requiredPreviewFeatures(properties) {
|
|
86
|
+
var _a;
|
|
87
|
+
return ((_a = geminiLiveModelSpec(properties)) === null || _a === void 0 ? void 0 : _a.preview) === true ? [PreviewFeatures.Gemini] : [];
|
|
73
88
|
}
|
|
74
|
-
const PRODUCTION_GEMINI_MLLM_MODELS = new Set([
|
|
75
|
-
"models/gemini-3.8-live",
|
|
76
|
-
"models/gemini-3.8-live-extended-thinking",
|
|
77
|
-
]);
|
|
78
89
|
/**
|
|
79
90
|
* Normalizes the historical Gemini preview greeting field for production.
|
|
80
91
|
* Kept under its old name so callers importing this compatibility helper do
|
|
81
92
|
* not need to change code when moving an existing request to production.
|
|
82
93
|
*/
|
|
83
94
|
export function applyPreviewShape(properties) {
|
|
84
|
-
|
|
95
|
+
// Applies to every model in GEMINI_LIVE_MODEL_TABLE, EAP models included,
|
|
96
|
+
// so an EAP body stays identical to the GA body.
|
|
85
97
|
const mllm = properties.mllm;
|
|
86
|
-
if (!mllm ||
|
|
87
|
-
mllm.vendor !== "gemini" ||
|
|
88
|
-
typeof ((_a = mllm.params) === null || _a === void 0 ? void 0 : _a.model) !== "string" ||
|
|
89
|
-
!PRODUCTION_GEMINI_MLLM_MODELS.has(mllm.params.model)) {
|
|
98
|
+
if (!mllm || geminiLiveModelSpec(properties) === undefined) {
|
|
90
99
|
return;
|
|
91
100
|
}
|
|
92
101
|
if (mllm.greeting_message === undefined && mllm.greeting !== undefined) {
|
|
@@ -12,5 +12,5 @@ export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "../vendo
|
|
|
12
12
|
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
13
13
|
export type { PreviewFeature, PreviewRoute } from "./client.mjs";
|
|
14
14
|
export { applyPreviewShape, createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.mjs";
|
|
15
|
-
export type { GeminiLiveModel, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, } from "./vendors.mjs";
|
|
16
|
-
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
15
|
+
export type { GeminiLiveModel, GeminiLiveModelRow, GeminiLiveModelSpec, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, } from "./vendors.mjs";
|
|
16
|
+
export { GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
@@ -8,4 +8,4 @@ export { OpenAIGPTLive } from "../vendors/mllm.mjs";
|
|
|
8
8
|
export { GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode } from "../vendors/stt.mjs";
|
|
9
9
|
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
10
10
|
export { applyPreviewShape, createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.mjs";
|
|
11
|
-
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
11
|
+
export { GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
@@ -3,7 +3,7 @@ import type { MllmConfig } from "../types.mjs";
|
|
|
3
3
|
import { type GeminiLiveOptions } from "../vendors/mllm.mjs";
|
|
4
4
|
/** Legacy preview import aliases for the production GPT Live implementation. */
|
|
5
5
|
/** Gemini 3.8 names remain available from the historical preview path. */
|
|
6
|
-
export type { GeminiLiveModel, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, } from "../vendors/mllm.mjs";
|
|
7
|
-
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, isOpenAIGPTLiveConfig, OPENAI_GPT_LIVE_VENDOR, OpenAIGPTLive, } from "../vendors/mllm.mjs";
|
|
6
|
+
export type { GeminiLiveModel, GeminiLiveModelRow, GeminiLiveModelSpec, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, } from "../vendors/mllm.mjs";
|
|
7
|
+
export { GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, isOpenAIGPTLiveConfig, OPENAI_GPT_LIVE_VENDOR, OpenAIGPTLive, } from "../vendors/mllm.mjs";
|
|
8
8
|
/** @deprecated Use `new GeminiLive(options).toConfig()`. */
|
|
9
9
|
export declare function buildGeminiPreviewConfig(options: GeminiLiveOptions): MllmConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Legacy preview import aliases for production MLLM implementations. */
|
|
2
2
|
import { GeminiLive } from "../vendors/mllm.mjs";
|
|
3
|
-
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, isOpenAIGPTLiveConfig, OPENAI_GPT_LIVE_VENDOR, OpenAIGPTLive, } from "../vendors/mllm.mjs";
|
|
3
|
+
export { GEMINI_EAP_MLLM_MODELS, GEMINI_LIVE_MODEL_TABLE, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, isOpenAIGPTLiveConfig, OPENAI_GPT_LIVE_VENDOR, OpenAIGPTLive, } from "../vendors/mllm.mjs";
|
|
4
4
|
/** @deprecated Use `new GeminiLive(options).toConfig()`. */
|
|
5
5
|
export function buildGeminiPreviewConfig(options) {
|
|
6
6
|
return new GeminiLive(options).toConfig();
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Type-safe MLLM (Multimodal Large Language Model) vendor classes.
|
|
3
3
|
*
|
|
4
4
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
5
|
-
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)`
|
|
6
|
-
*
|
|
5
|
+
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` makes the start
|
|
6
|
+
* request send `advanced_features.enable_mllm: true`. `mllm.enable` is never
|
|
7
|
+
* sent, because its presence stops RTM `message.metrics` from being delivered.
|
|
7
8
|
*/
|
|
8
9
|
import type { MllmConfig, MllmTurnDetectionConfig } from "../types.mjs";
|
|
9
10
|
import { BaseCNMLLM, BaseMLLM, type BaseMllmOptions } from "./base.mjs";
|
|
@@ -12,7 +13,49 @@ export declare const GeminiLiveModels: {
|
|
|
12
13
|
readonly Live38: "models/gemini-3.8-live";
|
|
13
14
|
/** Public ID for the reasoning voice model. */
|
|
14
15
|
readonly Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking";
|
|
16
|
+
/** Gemini Live EAP voice model. Accepts `thinkingLevel`. */
|
|
17
|
+
readonly Live4: "gemini-4-live";
|
|
18
|
+
/** Gemini Live EAP translation model. Set `translateTo` to use it. */
|
|
19
|
+
readonly Live4Translate: "gemini-4-live-translate";
|
|
15
20
|
};
|
|
21
|
+
/** How the SDK treats one Gemini Live model ID. */
|
|
22
|
+
export interface GeminiLiveModelSpec {
|
|
23
|
+
/**
|
|
24
|
+
* Served only by the preview endpoint. `AgentSession` routes these sessions
|
|
25
|
+
* to the preview host with `agora-feature: gemini`. The start body is the
|
|
26
|
+
* same as the GA body.
|
|
27
|
+
*/
|
|
28
|
+
readonly preview: boolean;
|
|
29
|
+
/** Accepts `thinkingLevel`, sent as `params.thinking_level`. */
|
|
30
|
+
readonly extendedThinking?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** A row in {@link GEMINI_LIVE_MODEL_TABLE}: a model spec, or an alias of another row. */
|
|
33
|
+
export type GeminiLiveModelRow = GeminiLiveModelSpec | {
|
|
34
|
+
readonly aliasOf: string;
|
|
35
|
+
readonly deprecated?: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Every Gemini Live model that uses the Gemini 3.8 builder path, keyed by the
|
|
39
|
+
* model ID sent in `mllm.params.model`. This one table selects the builder
|
|
40
|
+
* path, the production greeting normalization, and preview routing.
|
|
41
|
+
*
|
|
42
|
+
* A renamed model can keep its old ID as `{ aliasOf: "<new name>", deprecated: true }`.
|
|
43
|
+
* An alias takes the target's spec, and the SDK sends the model ID the caller
|
|
44
|
+
* wrote unchanged.
|
|
45
|
+
*
|
|
46
|
+
* Models missing from this table use the legacy Gemini path and the production
|
|
47
|
+
* route.
|
|
48
|
+
*/
|
|
49
|
+
export declare const GEMINI_LIVE_MODEL_TABLE: Readonly<Record<string, GeminiLiveModelRow>>;
|
|
50
|
+
/**
|
|
51
|
+
* Looks up a model in a Gemini Live model table, following alias rows.
|
|
52
|
+
* Returns `undefined` for models missing from the table.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveGeminiLiveModel(model: string, table?: Readonly<Record<string, GeminiLiveModelRow>>): GeminiLiveModelSpec | undefined;
|
|
55
|
+
/** Gemini Live EAP models, served only by the preview endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
56
|
+
export declare const GEMINI_EAP_MLLM_MODELS: ReadonlySet<string>;
|
|
57
|
+
/** Gemini Live models served by the production endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
58
|
+
export declare const PRODUCTION_GEMINI_MLLM_MODELS: ReadonlySet<string>;
|
|
16
59
|
/** The model Gemini Live sends by default. */
|
|
17
60
|
export declare const GEMINI_MLLM_DEFAULT_MODEL: string;
|
|
18
61
|
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
@@ -25,7 +68,7 @@ export type GeminiLiveModel = (typeof GeminiLiveModels)[keyof typeof GeminiLiveM
|
|
|
25
68
|
export declare const GeminiThinkingLevels: readonly ["low", "medium", "high"];
|
|
26
69
|
export type GeminiThinkingLevel = (typeof GeminiThinkingLevels)[number];
|
|
27
70
|
/** Known Gemini output voices; future voice names remain accepted. */
|
|
28
|
-
export type GeminiLiveVoice = "Puck" | "Charon" | "Kore" | "Fenrir" | "Aoede" | "Leda" | "Orus" | "Zephyr" | (string & {});
|
|
71
|
+
export type GeminiLiveVoice = "Puck" | "Charon" | "Kore" | "Fenrir" | "Aoede" | "Leda" | "Orus" | "Zephyr" | "Fola" | (string & {});
|
|
29
72
|
/** @deprecated Use {@link GeminiLiveVoice}. */
|
|
30
73
|
export type GeminiPreviewVoice = GeminiLiveVoice;
|
|
31
74
|
export declare const OPENAI_GPT_LIVE_VENDOR: "openai_gpt_live";
|
|
@@ -200,10 +243,19 @@ export interface GeminiLiveOptions extends BaseMllmOptions {
|
|
|
200
243
|
apiKey: string;
|
|
201
244
|
/** Model name (e.g., 'gemini-live-2.5-flash') */
|
|
202
245
|
model?: GeminiLiveModel;
|
|
203
|
-
/** Sent only for models/gemini-3.8-live-extended-thinking. */
|
|
246
|
+
/** Sent only for models/gemini-3.8-live-extended-thinking and gemini-4-live. */
|
|
204
247
|
thinkingLevel?: GeminiThinkingLevel;
|
|
205
248
|
/** Languages for Gemini 3.8, sent as params.language_codes. */
|
|
206
249
|
languageCodes?: readonly string[];
|
|
250
|
+
/**
|
|
251
|
+
* Switches the session to speech translation, sent as params.translate_to
|
|
252
|
+
* whenever set. The Gemini Live EAP `gemini-4-live-translate` model uses it. Codes are a vendor allow-list that the SDK does not
|
|
253
|
+
* validate: `es` and `pt-BR` work, `es-ES` does not. A rejected code closes
|
|
254
|
+
* the session mid-stream with a 1007.
|
|
255
|
+
*/
|
|
256
|
+
translateTo?: string;
|
|
257
|
+
/** Sent as params.echo_target_language whenever set. Used with `translateTo`. */
|
|
258
|
+
echoTargetLanguage?: boolean;
|
|
207
259
|
/** Endpoint override; Gemini 3.8 defaults to the Developer API host. */
|
|
208
260
|
url?: string;
|
|
209
261
|
/** System instructions for the model */
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Type-safe MLLM (Multimodal Large Language Model) vendor classes.
|
|
3
3
|
*
|
|
4
4
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
5
|
-
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)`
|
|
6
|
-
*
|
|
5
|
+
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` makes the start
|
|
6
|
+
* request send `advanced_features.enable_mllm: true`. `mllm.enable` is never
|
|
7
|
+
* sent, because its presence stops RTM `message.metrics` from being delivered.
|
|
7
8
|
*/
|
|
8
9
|
import { BaseCNMLLM, BaseMLLM } from "./base.mjs";
|
|
9
10
|
function requireString(value, field, vendor) {
|
|
@@ -24,7 +25,57 @@ export const GeminiLiveModels = {
|
|
|
24
25
|
Live38: "models/gemini-3.8-live",
|
|
25
26
|
/** Public ID for the reasoning voice model. */
|
|
26
27
|
Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking",
|
|
28
|
+
/** Gemini Live EAP voice model. Accepts `thinkingLevel`. */
|
|
29
|
+
Live4: "gemini-4-live",
|
|
30
|
+
/** Gemini Live EAP translation model. Set `translateTo` to use it. */
|
|
31
|
+
Live4Translate: "gemini-4-live-translate",
|
|
27
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Every Gemini Live model that uses the Gemini 3.8 builder path, keyed by the
|
|
35
|
+
* model ID sent in `mllm.params.model`. This one table selects the builder
|
|
36
|
+
* path, the production greeting normalization, and preview routing.
|
|
37
|
+
*
|
|
38
|
+
* A renamed model can keep its old ID as `{ aliasOf: "<new name>", deprecated: true }`.
|
|
39
|
+
* An alias takes the target's spec, and the SDK sends the model ID the caller
|
|
40
|
+
* wrote unchanged.
|
|
41
|
+
*
|
|
42
|
+
* Models missing from this table use the legacy Gemini path and the production
|
|
43
|
+
* route.
|
|
44
|
+
*/
|
|
45
|
+
export const GEMINI_LIVE_MODEL_TABLE = {
|
|
46
|
+
[GeminiLiveModels.Live38]: { preview: false },
|
|
47
|
+
[GeminiLiveModels.Live38ExtendedThinking]: { preview: false, extendedThinking: true },
|
|
48
|
+
[GeminiLiveModels.Live4]: { preview: true, extendedThinking: true },
|
|
49
|
+
[GeminiLiveModels.Live4Translate]: { preview: true },
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Looks up a model in a Gemini Live model table, following alias rows.
|
|
53
|
+
* Returns `undefined` for models missing from the table.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveGeminiLiveModel(model, table = GEMINI_LIVE_MODEL_TABLE) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
let id = model;
|
|
59
|
+
let row = (_a = Object.getOwnPropertyDescriptor(table, id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
60
|
+
while (row !== undefined && !seen.has(id)) {
|
|
61
|
+
if (!("aliasOf" in row))
|
|
62
|
+
return row;
|
|
63
|
+
seen.add(id);
|
|
64
|
+
id = row.aliasOf;
|
|
65
|
+
row = (_b = Object.getOwnPropertyDescriptor(table, id)) === null || _b === void 0 ? void 0 : _b.value;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
function geminiLiveModelsWhere(predicate) {
|
|
70
|
+
return new Set(Object.keys(GEMINI_LIVE_MODEL_TABLE).filter((model) => {
|
|
71
|
+
const spec = resolveGeminiLiveModel(model);
|
|
72
|
+
return spec !== undefined && predicate(spec);
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
/** Gemini Live EAP models, served only by the preview endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
76
|
+
export const GEMINI_EAP_MLLM_MODELS = geminiLiveModelsWhere((spec) => spec.preview);
|
|
77
|
+
/** Gemini Live models served by the production endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
78
|
+
export const PRODUCTION_GEMINI_MLLM_MODELS = geminiLiveModelsWhere((spec) => !spec.preview);
|
|
28
79
|
/** The model Gemini Live sends by default. */
|
|
29
80
|
export const GEMINI_MLLM_DEFAULT_MODEL = GeminiLiveModels.Live38;
|
|
30
81
|
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
@@ -196,12 +247,15 @@ export class GeminiLive extends BaseMLLM {
|
|
|
196
247
|
toConfig() {
|
|
197
248
|
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
198
249
|
const selectedModel = (model === null || model === void 0 ? void 0 : model.trim()) || GEMINI_MLLM_DEFAULT_MODEL;
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
const
|
|
250
|
+
const spec = resolveGeminiLiveModel(selectedModel);
|
|
251
|
+
const isGemini38 = spec !== undefined;
|
|
252
|
+
const isExtendedThinking = (spec === null || spec === void 0 ? void 0 : spec.extendedThinking) === true;
|
|
253
|
+
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({}, additionalParams), { model: selectedModel }), (instructions && { instructions })), ((voice || isGemini38) && { voice: voice || "Puck" })), (isExtendedThinking &&
|
|
202
254
|
this.options.thinkingLevel !== undefined && {
|
|
203
255
|
thinking_level: this.options.thinkingLevel,
|
|
204
|
-
})), (isGemini38 && this.options.languageCodes && { language_codes: [...this.options.languageCodes] })), (
|
|
256
|
+
})), (isGemini38 && this.options.languageCodes && { language_codes: [...this.options.languageCodes] })), (this.options.translateTo && { translate_to: this.options.translateTo })), (this.options.echoTargetLanguage !== undefined && {
|
|
257
|
+
echo_target_language: this.options.echoTargetLanguage,
|
|
258
|
+
})), (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
259
|
if (isGemini38) {
|
|
206
260
|
delete params.api_key;
|
|
207
261
|
if (!isExtendedThinking)
|