agora-agents 2.13.1 → 2.15.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 +0 -1
- package/dist/cjs/agentkit/Agent.js +39 -11
- package/dist/cjs/agentkit/AgentSession.js +8 -5
- package/dist/cjs/agentkit/index.d.ts +8 -7
- package/dist/cjs/agentkit/index.js +9 -4
- package/dist/cjs/agentkit/types.d.ts +51 -6
- package/dist/cjs/agentkit/vendors/cn.d.ts +46 -0
- package/dist/cjs/agentkit/vendors/cn.js +48 -1
- package/dist/cjs/agentkit/vendors/stt.d.ts +24 -0
- package/dist/cjs/agentkit/vendors/stt.js +31 -1
- package/dist/cjs/agentkit/vendors/tts.d.ts +22 -38
- package/dist/cjs/agentkit/vendors/tts.js +17 -24
- package/dist/cjs/api/types/Asr.d.ts +13 -1
- package/dist/cjs/api/types/ElevenLabsAsr.d.ts +10 -0
- package/dist/cjs/api/types/ElevenLabsAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/ElevenLabsAsrParams.js +3 -0
- package/dist/cjs/api/types/FishAudioAsr.d.ts +10 -0
- package/dist/cjs/api/types/FishAudioAsr.js +3 -0
- package/dist/cjs/api/types/FishAudioAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/FishAudioAsrParams.js +3 -0
- package/dist/cjs/api/types/MinimaxDuplexTts.d.ts +13 -0
- package/dist/cjs/api/types/MinimaxDuplexTts.js +3 -0
- package/dist/cjs/api/types/MinimaxDuplexTtsParams.d.ts +87 -0
- package/dist/cjs/api/types/MinimaxDuplexTtsParams.js +3 -0
- package/dist/cjs/api/types/QwenAsr.d.ts +10 -0
- package/dist/cjs/api/types/QwenAsr.js +3 -0
- package/dist/cjs/api/types/QwenAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/QwenAsrParams.js +3 -0
- package/dist/cjs/api/types/{HumeAiTts.d.ts → SonioxTts.d.ts} +3 -3
- package/dist/cjs/api/types/SonioxTts.js +3 -0
- package/dist/cjs/api/types/SonioxTtsParams.d.ts +29 -0
- package/dist/cjs/api/types/SonioxTtsParams.js +3 -0
- package/dist/cjs/api/types/StepfunAsr.d.ts +10 -0
- package/dist/cjs/api/types/StepfunAsr.js +3 -0
- package/dist/cjs/api/types/StepfunAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/StepfunAsrParams.js +3 -0
- package/dist/cjs/api/types/Tts.d.ts +7 -4
- package/dist/cjs/api/types/index.d.ts +12 -2
- package/dist/cjs/api/types/index.js +12 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +10 -5
- 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 +0 -1
- package/dist/esm/agentkit/Agent.mjs +39 -11
- package/dist/esm/agentkit/AgentSession.mjs +8 -5
- package/dist/esm/agentkit/index.d.mts +8 -7
- package/dist/esm/agentkit/index.mjs +3 -3
- package/dist/esm/agentkit/types.d.mts +51 -6
- package/dist/esm/agentkit/vendors/cn.d.mts +46 -0
- package/dist/esm/agentkit/vendors/cn.mjs +44 -0
- package/dist/esm/agentkit/vendors/stt.d.mts +24 -0
- package/dist/esm/agentkit/vendors/stt.mjs +28 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +22 -38
- package/dist/esm/agentkit/vendors/tts.mjs +15 -22
- package/dist/esm/api/types/Asr.d.mts +13 -1
- package/dist/esm/api/types/ElevenLabsAsr.d.mts +10 -0
- package/dist/esm/api/types/ElevenLabsAsrParams.d.mts +9 -0
- package/dist/esm/api/types/ElevenLabsAsrParams.mjs +2 -0
- package/dist/esm/api/types/FishAudioAsr.d.mts +10 -0
- package/dist/esm/api/types/FishAudioAsr.mjs +2 -0
- package/dist/esm/api/types/FishAudioAsrParams.d.mts +9 -0
- package/dist/esm/api/types/FishAudioAsrParams.mjs +2 -0
- package/dist/esm/api/types/MinimaxDuplexTts.d.mts +13 -0
- package/dist/esm/api/types/MinimaxDuplexTts.mjs +2 -0
- package/dist/esm/api/types/MinimaxDuplexTtsParams.d.mts +87 -0
- package/dist/esm/api/types/MinimaxDuplexTtsParams.mjs +2 -0
- package/dist/esm/api/types/QwenAsr.d.mts +10 -0
- package/dist/esm/api/types/QwenAsr.mjs +2 -0
- package/dist/esm/api/types/QwenAsrParams.d.mts +9 -0
- package/dist/esm/api/types/QwenAsrParams.mjs +2 -0
- package/dist/esm/api/types/{HumeAiTts.d.mts → SonioxTts.d.mts} +3 -3
- package/dist/esm/api/types/SonioxTts.mjs +2 -0
- package/dist/esm/api/types/SonioxTtsParams.d.mts +29 -0
- package/dist/esm/api/types/SonioxTtsParams.mjs +2 -0
- package/dist/esm/api/types/StepfunAsr.d.mts +10 -0
- package/dist/esm/api/types/StepfunAsr.mjs +2 -0
- package/dist/esm/api/types/StepfunAsrParams.d.mts +9 -0
- package/dist/esm/api/types/StepfunAsrParams.mjs +2 -0
- package/dist/esm/api/types/Tts.d.mts +7 -4
- package/dist/esm/api/types/index.d.mts +12 -2
- package/dist/esm/api/types/index.mjs +12 -2
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/api/types/HumeAiTtsParams.d.ts +0 -29
- package/dist/cjs/api/types/HumeAiTtsParams.js +0 -12
- package/dist/esm/api/types/HumeAiTtsParams.d.mts +0 -29
- package/dist/esm/api/types/HumeAiTtsParams.mjs +0 -9
- /package/dist/cjs/api/types/{HumeAiTts.js → ElevenLabsAsr.js} +0 -0
- /package/dist/esm/api/types/{HumeAiTts.mjs → ElevenLabsAsr.mjs} +0 -0
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 = void 0;
|
|
39
|
+
exports.Gemini = exports.GEMINI_PREVIEW_MLLM_URL = exports.GEMINI_MLLM_URL = exports.GEMINI_MLLM_DEFAULT_MODEL = 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.OpenAIGPTLive = exports.OpenAI = 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 = void 0;
|
|
41
|
+
exports.validateTtsSampleRate = exports.validateAvatarConfig = 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 = 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 = 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
|
|
@@ -83,11 +83,13 @@ Object.defineProperty(exports, "DeepgramSTT", { enumerable: true, get: function
|
|
|
83
83
|
Object.defineProperty(exports, "DeepgramTTS", { enumerable: true, get: function () { return index_js_1.DeepgramTTS; } });
|
|
84
84
|
Object.defineProperty(exports, "DeepSeekLLM", { enumerable: true, get: function () { return index_js_1.DeepSeekLLM; } });
|
|
85
85
|
Object.defineProperty(exports, "Dify", { enumerable: true, get: function () { return index_js_1.Dify; } });
|
|
86
|
+
Object.defineProperty(exports, "ElevenLabsSTT", { enumerable: true, get: function () { return index_js_1.ElevenLabsSTT; } });
|
|
86
87
|
// TTS vendors
|
|
87
88
|
Object.defineProperty(exports, "ElevenLabsTTS", { enumerable: true, get: function () { return index_js_1.ElevenLabsTTS; } });
|
|
88
89
|
Object.defineProperty(exports, "ExpiresIn", { enumerable: true, get: function () { return index_js_1.ExpiresIn; } });
|
|
89
90
|
Object.defineProperty(exports, "FengmingSTT", { enumerable: true, get: function () { return index_js_1.FengmingSTT; } });
|
|
90
91
|
Object.defineProperty(exports, "FillerWordsSelectionRule", { enumerable: true, get: function () { return index_js_1.FillerWordsSelectionRule; } });
|
|
92
|
+
Object.defineProperty(exports, "FishAudioSTT", { enumerable: true, get: function () { return index_js_1.FishAudioSTT; } });
|
|
91
93
|
Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return index_js_1.FishAudioTTS; } });
|
|
92
94
|
Object.defineProperty(exports, "GEMINI_MLLM_DEFAULT_MODEL", { enumerable: true, get: function () { return index_js_1.GEMINI_MLLM_DEFAULT_MODEL; } });
|
|
93
95
|
Object.defineProperty(exports, "GEMINI_MLLM_URL", { enumerable: true, get: function () { return index_js_1.GEMINI_MLLM_URL; } });
|
|
@@ -111,7 +113,6 @@ Object.defineProperty(exports, "generateConvoAIToken", { enumerable: true, get:
|
|
|
111
113
|
Object.defineProperty(exports, "generateRtcToken", { enumerable: true, get: function () { return index_js_1.generateRtcToken; } });
|
|
112
114
|
// Avatar vendors
|
|
113
115
|
Object.defineProperty(exports, "HeyGenAvatar", { enumerable: true, get: function () { return index_js_1.HeyGenAvatar; } });
|
|
114
|
-
Object.defineProperty(exports, "HumeAITTS", { enumerable: true, get: function () { return index_js_1.HumeAITTS; } });
|
|
115
116
|
Object.defineProperty(exports, "InterruptionDisabledStrategy", { enumerable: true, get: function () { return index_js_1.InterruptionDisabledStrategy; } });
|
|
116
117
|
Object.defineProperty(exports, "InterruptionDisabledStrategyAppend", { enumerable: true, get: function () { return index_js_1.InterruptionDisabledStrategyAppend; } });
|
|
117
118
|
Object.defineProperty(exports, "InterruptionDisabledStrategyIgnore", { enumerable: true, get: function () { return index_js_1.InterruptionDisabledStrategyIgnore; } });
|
|
@@ -134,6 +135,7 @@ Object.defineProperty(exports, "MicrosoftCNTTS", { enumerable: true, get: functi
|
|
|
134
135
|
Object.defineProperty(exports, "MicrosoftSTT", { enumerable: true, get: function () { return index_js_1.MicrosoftSTT; } });
|
|
135
136
|
Object.defineProperty(exports, "MicrosoftTTS", { enumerable: true, get: function () { return index_js_1.MicrosoftTTS; } });
|
|
136
137
|
Object.defineProperty(exports, "MiniMaxCNTTS", { enumerable: true, get: function () { return index_js_1.MiniMaxCNTTS; } });
|
|
138
|
+
Object.defineProperty(exports, "MiniMaxDuplexTTS", { enumerable: true, get: function () { return index_js_1.MiniMaxDuplexTTS; } });
|
|
137
139
|
Object.defineProperty(exports, "MiniMaxTTS", { enumerable: true, get: function () { return index_js_1.MiniMaxTTS; } });
|
|
138
140
|
Object.defineProperty(exports, "MistralTTS", { enumerable: true, get: function () { return index_js_1.MistralTTS; } });
|
|
139
141
|
Object.defineProperty(exports, "MllmTurnDetectionModeAgoraVad", { enumerable: true, get: function () { return index_js_1.MllmTurnDetectionModeAgoraVad; } });
|
|
@@ -155,6 +157,7 @@ Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: funct
|
|
|
155
157
|
Object.defineProperty(exports, "Protoface", { enumerable: true, get: function () { return index_js_1.Protoface; } });
|
|
156
158
|
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return index_js_1.previewRequestHeaders; } });
|
|
157
159
|
Object.defineProperty(exports, "QwenOmni", { enumerable: true, get: function () { return index_js_1.QwenOmni; } });
|
|
160
|
+
Object.defineProperty(exports, "QwenSTT", { enumerable: true, get: function () { return index_js_1.QwenSTT; } });
|
|
158
161
|
Object.defineProperty(exports, "REDACTED", { enumerable: true, get: function () { return index_js_1.REDACTED; } });
|
|
159
162
|
Object.defineProperty(exports, "RimeTTS", { enumerable: true, get: function () { return index_js_1.RimeTTS; } });
|
|
160
163
|
Object.defineProperty(exports, "RTZRSTT", { enumerable: true, get: function () { return index_js_1.RTZRSTT; } });
|
|
@@ -168,6 +171,7 @@ Object.defineProperty(exports, "SensetimeAvatar", { enumerable: true, get: funct
|
|
|
168
171
|
Object.defineProperty(exports, "SilenceActionValues", { enumerable: true, get: function () { return index_js_1.SilenceActionValues; } });
|
|
169
172
|
Object.defineProperty(exports, "SmallestAISTT", { enumerable: true, get: function () { return index_js_1.SmallestAISTT; } });
|
|
170
173
|
Object.defineProperty(exports, "SmallestAITTS", { enumerable: true, get: function () { return index_js_1.SmallestAITTS; } });
|
|
174
|
+
Object.defineProperty(exports, "SonioxTTS", { enumerable: true, get: function () { return index_js_1.SonioxTTS; } });
|
|
171
175
|
Object.defineProperty(exports, "SpatiusAvatar", { enumerable: true, get: function () { return index_js_1.SpatiusAvatar; } });
|
|
172
176
|
Object.defineProperty(exports, "SpeakPriorityAppend", { enumerable: true, get: function () { return index_js_1.SpeakPriorityAppend; } });
|
|
173
177
|
Object.defineProperty(exports, "SpeakPriorityIgnore", { enumerable: true, get: function () { return index_js_1.SpeakPriorityIgnore; } });
|
|
@@ -175,6 +179,7 @@ Object.defineProperty(exports, "SpeakPriorityInterrupt", { enumerable: true, get
|
|
|
175
179
|
Object.defineProperty(exports, "SpeakPriorityValues", { enumerable: true, get: function () { return index_js_1.SpeakPriorityValues; } });
|
|
176
180
|
// STT vendors
|
|
177
181
|
Object.defineProperty(exports, "SpeechmaticsSTT", { enumerable: true, get: function () { return index_js_1.SpeechmaticsSTT; } });
|
|
182
|
+
Object.defineProperty(exports, "StepFunSTT", { enumerable: true, get: function () { return index_js_1.StepFunSTT; } });
|
|
178
183
|
Object.defineProperty(exports, "StepFunTTS", { enumerable: true, get: function () { return index_js_1.StepFunTTS; } });
|
|
179
184
|
Object.defineProperty(exports, "Tavus", { enumerable: true, get: function () { return index_js_1.Tavus; } });
|
|
180
185
|
Object.defineProperty(exports, "TencentLLM", { enumerable: true, get: function () { return index_js_1.TencentLLM; } });
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.
|
|
1
|
+
export declare const SDK_VERSION = "v2.15.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.15.0",
|
|
9
|
+
"User-Agent": "agora-agents/v2.15.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);
|
|
@@ -58,6 +58,41 @@ function assertTurnDetectionLanguage(value) {
|
|
|
58
58
|
throw new Error(`Invalid turnDetection.language: ${value}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/** Joins a language list into the comma-separated string the API expects. */
|
|
62
|
+
function toWireLanguage(language) {
|
|
63
|
+
return typeof language === "string" ? language : [...new Set(language)].join(",");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Validates `turnDetection` and resolves `language` to the wire string.
|
|
67
|
+
*
|
|
68
|
+
* - Defaults `language` to en-US.
|
|
69
|
+
* - Semantic EoS takes only one English or Chinese language. The types already
|
|
70
|
+
* enforce this; the runtime check covers untyped callers.
|
|
71
|
+
* - Several languages with no EoS mode set fall back to silence VAD.
|
|
72
|
+
*/
|
|
73
|
+
function resolveTurnDetectionConfig(config) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const language = (_a = config === null || config === void 0 ? void 0 : config.language) !== null && _a !== void 0 ? _a : DEFAULT_TURN_DETECTION_LANGUAGE;
|
|
76
|
+
const languages = typeof language === "string" ? [language] : [...new Set(language)];
|
|
77
|
+
if (languages.length === 0) {
|
|
78
|
+
throw new Error("turnDetection.language must not be an empty list");
|
|
79
|
+
}
|
|
80
|
+
languages.forEach(assertTurnDetectionLanguage);
|
|
81
|
+
const endOfSpeech = (_b = config === null || config === void 0 ? void 0 : config.config) === null || _b === void 0 ? void 0 : _b.end_of_speech;
|
|
82
|
+
if ((endOfSpeech === null || endOfSpeech === void 0 ? void 0 : endOfSpeech.mode) === "semantic") {
|
|
83
|
+
if (typeof language !== "string") {
|
|
84
|
+
throw new Error("turnDetection.language cannot be a list when end_of_speech.mode is semantic; use one English or Chinese language, or use end_of_speech.mode vad. Otherwise the service silently uses VAD instead of semantic end of speech");
|
|
85
|
+
}
|
|
86
|
+
if (!/^(en|zh)-/.test(language)) {
|
|
87
|
+
throw new Error(`Semantic end_of_speech supports only English and Chinese languages; got turnDetection.language: ${language}. Otherwise the service silently uses VAD instead of semantic end of speech`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const resolved = Object.assign(Object.assign({}, config), { language: languages.join(",") });
|
|
91
|
+
if (languages.length > 1 && (endOfSpeech === null || endOfSpeech === void 0 ? void 0 : endOfSpeech.mode) === undefined) {
|
|
92
|
+
resolved.config = Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.config), { end_of_speech: Object.assign(Object.assign({}, endOfSpeech), { mode: "vad" }) });
|
|
93
|
+
}
|
|
94
|
+
return resolved;
|
|
95
|
+
}
|
|
61
96
|
/**
|
|
62
97
|
* Agent class representing a reusable agent configuration.
|
|
63
98
|
*
|
|
@@ -660,7 +695,9 @@ export class Agent {
|
|
|
660
695
|
}
|
|
661
696
|
return Object.assign(Object.assign(Object.assign({}, base), { mllm: mllmConfig }), (!isOpenAIGPTLive &&
|
|
662
697
|
this._turnDetection !== undefined && {
|
|
663
|
-
turn_detection: this._turnDetection,
|
|
698
|
+
turn_detection: Object.assign(Object.assign({}, this._turnDetection), (this._turnDetection.language !== undefined && {
|
|
699
|
+
language: toWireLanguage(this._turnDetection.language),
|
|
700
|
+
})),
|
|
664
701
|
}));
|
|
665
702
|
}
|
|
666
703
|
const skipCategories = new Set((_c = opts.skipVendorValidationCategories) !== null && _c !== void 0 ? _c : []);
|
|
@@ -688,7 +725,7 @@ export class Agent {
|
|
|
688
725
|
: this._instructions
|
|
689
726
|
? [{ role: "system", content: this._instructions }]
|
|
690
727
|
: undefined, greeting_message: (_e = this._llm.greeting_message) !== null && _e !== void 0 ? _e : this._greeting, greeting_configs: (_f = this._llm.greeting_configs) !== null && _f !== void 0 ? _f : this._greetingConfigs, failure_message: (_g = this._llm.failure_message) !== null && _g !== void 0 ? _g : this._failureMessage, max_history: (_h = this._llm.max_history) !== null && _h !== void 0 ? _h : this._maxHistory }) : undefined;
|
|
691
|
-
const turnDetectionConfig = this.
|
|
728
|
+
const turnDetectionConfig = resolveTurnDetectionConfig(this._turnDetection);
|
|
692
729
|
const asrConfig = this._stt !== undefined || !allowMissingAsr
|
|
693
730
|
? this._resolveAsrConfig(turnDetectionConfig)
|
|
694
731
|
: undefined;
|
|
@@ -756,15 +793,6 @@ export class Agent {
|
|
|
756
793
|
asrConfig.language = turnDetectionConfig.language;
|
|
757
794
|
return Object.keys(asrConfig).length > 0 ? asrConfig : undefined;
|
|
758
795
|
}
|
|
759
|
-
_resolveTurnDetectionConfig() {
|
|
760
|
-
var _a;
|
|
761
|
-
const turnDetection = Object.assign({}, ((_a = this._turnDetection) !== null && _a !== void 0 ? _a : {}));
|
|
762
|
-
const existingTurnDetectionLanguage = turnDetection.language;
|
|
763
|
-
const language = existingTurnDetectionLanguage !== null && existingTurnDetectionLanguage !== void 0 ? existingTurnDetectionLanguage : DEFAULT_TURN_DETECTION_LANGUAGE;
|
|
764
|
-
assertTurnDetectionLanguage(language);
|
|
765
|
-
turnDetection.language = language;
|
|
766
|
-
return turnDetection;
|
|
767
|
-
}
|
|
768
796
|
}
|
|
769
797
|
function _parseNumericUid(uid, label) {
|
|
770
798
|
if (!/^\d+$/.test(uid)) {
|
|
@@ -230,6 +230,7 @@ export class AgentSession {
|
|
|
230
230
|
* @throws {Error} If configuration is invalid
|
|
231
231
|
*/
|
|
232
232
|
_validateAvatarConfig() {
|
|
233
|
+
var _a;
|
|
233
234
|
const agentConfig = this._agent.config;
|
|
234
235
|
const avatar = agentConfig.avatar;
|
|
235
236
|
const tts = this._agent.tts;
|
|
@@ -261,11 +262,13 @@ export class AgentSession {
|
|
|
261
262
|
// Note: tts can be a string (shorthand) or an object with params
|
|
262
263
|
// Sample-rate fields vary by provider, so check the generated wire names dynamically.
|
|
263
264
|
const ttsParams = tts && typeof tts !== "string" ? tts.params : undefined;
|
|
264
|
-
const sampleRate =
|
|
265
|
-
?
|
|
266
|
-
: ttsParams && "
|
|
267
|
-
? ttsParams.
|
|
268
|
-
:
|
|
265
|
+
const sampleRate = tts && typeof tts !== "string" && tts.vendor === "minimax_duplex"
|
|
266
|
+
? (_a = tts.params.audio_setting) === null || _a === void 0 ? void 0 : _a.sample_rate
|
|
267
|
+
: ttsParams && "sample_rate" in ttsParams
|
|
268
|
+
? ttsParams.sample_rate
|
|
269
|
+
: ttsParams && "speech_sample_rate" in ttsParams
|
|
270
|
+
? ttsParams.speech_sample_rate
|
|
271
|
+
: undefined;
|
|
269
272
|
if (typeof sampleRate === "number") {
|
|
270
273
|
if (isHeyGenAvatar(strictAvatar) || isLiveAvatarAvatar(strictAvatar) || isAkoolAvatar(strictAvatar)) {
|
|
271
274
|
validateTtsSampleRate(strictAvatar, sampleRate);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* 3. **Convenience methods** (say, stop, interrupt, etc.) are the only
|
|
19
19
|
* parts that need manual updates when adding new sugar.
|
|
20
20
|
*/
|
|
21
|
+
export type { MinimaxDuplexTts, MinimaxDuplexTtsParams, SonioxTts, SonioxTtsParams, StepfunAsr, StepfunAsrParams, } from "../api/index.mjs";
|
|
21
22
|
export type { AgentsClient } from "../api/resources/agents/client/Client.mjs";
|
|
22
23
|
export type { AgentOptions } from "./Agent.mjs";
|
|
23
24
|
export { Agent } from "./Agent.mjs";
|
|
@@ -34,18 +35,18 @@ export { createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, Previ
|
|
|
34
35
|
export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.mjs";
|
|
35
36
|
export type { GenerateClientTokenOptions, GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.mjs";
|
|
36
37
|
export { ExpiresIn, generateClientToken, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.mjs";
|
|
37
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams,
|
|
38
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, LlmTool, LlmToolExecution, LlmToolFunction, LlmToolServer, McpServer, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, RtzrAsr, RtzrAsrParams, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SemanticEndOfSpeechLanguage, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SmallestAiAsr, SmallestAiAsrParams, SmallestAiTts, SmallestAiTtsParams, SpatiusAvatarParams, SpeakConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionLanguages, TurnDetectionNestedConfig, TurnDetectionType, TypecastTts, TypecastTtsParams, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } from "./types.mjs";
|
|
38
39
|
export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LemonSliceOptions, LiveAvatarAvatarOptions, ProtofaceOptions, TavusOptions, } from "./vendors/avatar.mjs";
|
|
39
40
|
export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LemonSlice, LiveAvatarAvatar, Protoface, Tavus, } from "./vendors/avatar.mjs";
|
|
40
41
|
export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.mjs";
|
|
41
42
|
export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNMLLM, BaseCNSTT, BaseCNTTS, BaseLLM, type BaseLlmOptions, BaseMLLM, type BaseMllmOptions, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.mjs";
|
|
42
|
-
export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CosyVoiceTTSOptions, DeepSeekLLMOptions, FengmingSTTOptions, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MiniMaxCNTTSOptions, SensetimeAvatarOptions, SpatiusAvatarOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.mjs";
|
|
43
|
-
export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, SpatiusAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
|
|
43
|
+
export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CosyVoiceTTSOptions, DeepSeekLLMOptions, FengmingSTTOptions, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MiniMaxCNTTSOptions, MiniMaxDuplexTTSOptions, QwenSTTOptions, SensetimeAvatarOptions, SpatiusAvatarOptions, StepFunSTTOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.mjs";
|
|
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";
|
|
44
45
|
export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, CustomLLMOptions, DifyOptions, GeminiOptions, GroqOptions, OpenAIOptions, VertexAILLMOptions, } from "./vendors/llm.mjs";
|
|
45
46
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
46
47
|
export type { AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, GeminiLiveModel, GeminiLiveOptions, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, OpenAIRealtimeOptions, QwenOmniOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
|
|
47
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";
|
|
48
|
-
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, RTZRSTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.mjs";
|
|
49
|
-
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
50
|
-
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions,
|
|
51
|
-
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS,
|
|
49
|
+
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, ElevenLabsSTTOptions, FishAudioSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, RTZRSTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.mjs";
|
|
50
|
+
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, ElevenLabsSTT, FishAudioSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
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";
|
|
52
|
+
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SarvamTTSLanguage, SmallestAITTS, SonioxTTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
@@ -33,12 +33,12 @@ export { ExpiresIn, generateClientToken, generateConvoAIToken, generateRtcToken,
|
|
|
33
33
|
export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LemonSlice, LiveAvatarAvatar, Protoface, Tavus, } from "./vendors/avatar.mjs";
|
|
34
34
|
// Base vendor classes
|
|
35
35
|
export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNMLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, } from "./vendors/base.mjs";
|
|
36
|
-
export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, SpatiusAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
|
|
36
|
+
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";
|
|
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
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";
|
|
41
41
|
// STT vendor classes
|
|
42
|
-
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
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
|
|
44
|
-
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS,
|
|
44
|
+
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SarvamTTSLanguage, SmallestAITTS, SonioxTTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Clean type aliases for the Agora Conversational AI SDK.
|
|
3
3
|
* These provide shorter, more intuitive names for the verbose Fern-generated types.
|
|
4
4
|
*/
|
|
5
|
-
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GeminiAsrParams as GeminiAsrParamsType, GenericHttpTtsParams as GenericTtsParamsType, GenericHttpTts as GenericTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, GradiumTtsParams as GradiumTtsParamsType, GradiumTts as GradiumTtsType,
|
|
5
|
+
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsAsrParams, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioAsrParams, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GeminiAsrParams as GeminiAsrParamsType, GenericHttpTtsParams as GenericTtsParamsType, GenericHttpTts as GenericTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, GradiumTtsParams as GradiumTtsParamsType, GradiumTts as GradiumTtsType, ListAgentsResponse, Llm, LlmToolExecution as LlmToolExecutionType, LlmToolFunction as LlmToolFunctionType, LlmToolServer as LlmToolServerType, LlmTool as LlmToolType, McpServer as McpServerType, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, MistralTtsParams as MistralTtsParamsType, MistralTts as MistralTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, QwenAsrParams, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, RtzrAsrParams as RtzrAsrParamsType, RtzrAsr as RtzrAsrType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SmallestAiAsrParams as SmallestAiAsrParamsType, SmallestAiAsr as SmallestAiAsrType, SmallestAiTtsParams as SmallestAiTtsParamsType, SmallestAiTts as SmallestAiTtsType, SpatiusAvatarParams as SpatiusAvatarParamsType, SpeakAgentsRequest, StartAgentsRequest, Tts, TypecastTtsParams as TypecastTtsParamsType, TypecastTts as TypecastTtsType, UpdateAgentsRequest, XAiAsrParams as XAiAsrParamsType, XAiAsr as XAiAsrType, XAiTtsParams as XAiTtsParamsType, XAiTts as XAiTtsType } from "../api/index.mjs";
|
|
6
6
|
import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs";
|
|
7
7
|
import type { PresetInput } from "./presets.mjs";
|
|
8
8
|
/** LLM request style (openai, gemini, anthropic, dify) */
|
|
@@ -13,6 +13,18 @@ export type LlmStyle = Llm.Style;
|
|
|
13
13
|
* When using shorthand strings or minimal configs, the untyped variant is available.
|
|
14
14
|
*/
|
|
15
15
|
export type SttConfig = {
|
|
16
|
+
vendor: "elevenlabs";
|
|
17
|
+
language?: TurnDetectionLanguage;
|
|
18
|
+
params: ElevenLabsAsrParams;
|
|
19
|
+
} | {
|
|
20
|
+
vendor: "fishaudio";
|
|
21
|
+
language?: TurnDetectionLanguage;
|
|
22
|
+
params: FishAudioAsrParams;
|
|
23
|
+
} | {
|
|
24
|
+
vendor: "qwen";
|
|
25
|
+
language?: TurnDetectionLanguage;
|
|
26
|
+
params: QwenAsrParams;
|
|
27
|
+
} | {
|
|
16
28
|
vendor: "fengming";
|
|
17
29
|
language?: TurnDetectionLanguage;
|
|
18
30
|
keywords?: string[];
|
|
@@ -107,10 +119,45 @@ export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
|
|
|
107
119
|
export type AvatarWireVendor = StartAgentsRequest.Properties.Avatar.Vendor;
|
|
108
120
|
/** BCP-47 language tag used by `turn_detection.language`. */
|
|
109
121
|
export type TurnDetectionLanguage = AsrLanguage;
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Languages supported by semantic end-of-speech detection
|
|
124
|
+
* (`turn_detection.config.end_of_speech.mode = "semantic"`): English and Chinese only.
|
|
125
|
+
*/
|
|
126
|
+
export type SemanticEndOfSpeechLanguage = Extract<TurnDetectionLanguage, `en-${string}` | `zh-${string}`>;
|
|
127
|
+
/**
|
|
128
|
+
* One language, or a non-empty list of languages for multi-language sessions.
|
|
129
|
+
* A list is sent to `asr.language` as a comma-separated string.
|
|
130
|
+
*/
|
|
131
|
+
export type TurnDetectionLanguages = TurnDetectionLanguage | readonly [TurnDetectionLanguage, ...TurnDetectionLanguage[]];
|
|
132
|
+
type TurnDetectionBase = Omit<StartAgentsRequest.Properties.TurnDetection, "language" | "config">;
|
|
133
|
+
type GeneratedEndOfSpeech = StartAgentsRequest.Properties.TurnDetection.Config.EndOfSpeech;
|
|
134
|
+
/** Semantic EoS: only one English or Chinese language. */
|
|
135
|
+
type SemanticTurnDetectionConfig = TurnDetectionBase & {
|
|
136
|
+
config: TurnDetectionNestedConfig & {
|
|
137
|
+
end_of_speech: GeneratedEndOfSpeech & {
|
|
138
|
+
mode: "semantic";
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
language?: SemanticEndOfSpeechLanguage;
|
|
113
142
|
};
|
|
143
|
+
/** VAD or manual EoS (or unset): one language or a list of languages. */
|
|
144
|
+
type NonSemanticTurnDetectionConfig = TurnDetectionBase & {
|
|
145
|
+
config?: TurnDetectionNestedConfig & {
|
|
146
|
+
end_of_speech?: Omit<GeneratedEndOfSpeech, "mode"> & {
|
|
147
|
+
mode?: Exclude<EndOfSpeechMode, "semantic">;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
language?: TurnDetectionLanguages;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Turn detection configuration.
|
|
154
|
+
*
|
|
155
|
+
* `language` takes one BCP-47 tag or a list of tags. A list cannot be used with
|
|
156
|
+
* semantic end-of-speech: TypeScript reports an error at compile time, and the
|
|
157
|
+
* SDK also throws at runtime. When a list has more than one language and
|
|
158
|
+
* `end_of_speech.mode` is unset, the SDK sends `end_of_speech.mode = "vad"`.
|
|
159
|
+
*/
|
|
160
|
+
export type TurnDetectionConfig = NonSemanticTurnDetectionConfig | SemanticTurnDetectionConfig;
|
|
114
161
|
/** Detailed nested config for turn detection (`turn_detection.config`) */
|
|
115
162
|
export type TurnDetectionNestedConfig = StartAgentsRequest.Properties.TurnDetection.Config;
|
|
116
163
|
/** Start of Speech (SoS) detection configuration (`turn_detection.config.start_of_speech`) */
|
|
@@ -585,8 +632,6 @@ export type CartesiaTts = CartesiaTtsType;
|
|
|
585
632
|
export type CartesiaTtsParams = CartesiaTtsParamsType;
|
|
586
633
|
export type OpenAiTts = OpenAiTtsType;
|
|
587
634
|
export type OpenAiTtsParams = OpenAiTtsParamsType;
|
|
588
|
-
export type HumeAiTts = HumeAiTtsType;
|
|
589
|
-
export type HumeAiTtsParams = HumeAiTtsParamsType;
|
|
590
635
|
export type RimeTts = RimeTtsType;
|
|
591
636
|
export type RimeTtsParams = RimeTtsParamsType;
|
|
592
637
|
export type FishAudioTts = FishAudioTtsType;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import type { MinimaxDuplexTtsParams } from "../../api/index.mjs";
|
|
1
2
|
import type { AvatarConfig, LlmConfig, SttConfig, TtsConfig } from "../types.mjs";
|
|
2
3
|
import { BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, type BaseLlmOptions } from "./base.mjs";
|
|
4
|
+
/** Constructor options for mainland China Qwen ASR. */
|
|
5
|
+
export interface QwenSTTOptions {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
8
|
+
additionalParams?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/** Qwen ASR for mainland China. */
|
|
11
|
+
export declare class QwenSTT extends BaseCNSTT {
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(options: QwenSTTOptions);
|
|
14
|
+
toConfig(): SttConfig;
|
|
15
|
+
}
|
|
3
16
|
export interface FengmingSTTOptions {
|
|
4
17
|
/** Hotwords that improve recognition accuracy */
|
|
5
18
|
keywords?: string[];
|
|
@@ -11,6 +24,16 @@ export declare class FengmingSTT extends BaseCNSTT {
|
|
|
11
24
|
constructor(options?: FengmingSTTOptions);
|
|
12
25
|
toConfig(): SttConfig;
|
|
13
26
|
}
|
|
27
|
+
export interface StepFunSTTOptions {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
additionalParams?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/** StepFun ASR for mainland China. */
|
|
32
|
+
export declare class StepFunSTT extends BaseCNSTT {
|
|
33
|
+
private readonly options;
|
|
34
|
+
constructor(options: StepFunSTTOptions);
|
|
35
|
+
toConfig(): SttConfig;
|
|
36
|
+
}
|
|
14
37
|
export interface MicrosoftCNSTTOptions {
|
|
15
38
|
key: string;
|
|
16
39
|
region: string;
|
|
@@ -74,6 +97,29 @@ export declare class XfyunDialectSTT extends BaseCNSTT {
|
|
|
74
97
|
constructor(options: XfyunDialectSTTOptions);
|
|
75
98
|
toConfig(): SttConfig;
|
|
76
99
|
}
|
|
100
|
+
export interface MiniMaxDuplexTTSOptions {
|
|
101
|
+
key: string;
|
|
102
|
+
model: string;
|
|
103
|
+
url?: string;
|
|
104
|
+
voiceSetting: MinimaxDuplexTtsParams.VoiceSetting;
|
|
105
|
+
audioSetting?: MinimaxDuplexTtsParams.AudioSetting;
|
|
106
|
+
pronunciationDict?: MinimaxDuplexTtsParams.PronunciationDict;
|
|
107
|
+
voiceModify?: MinimaxDuplexTtsParams.VoiceModify;
|
|
108
|
+
languageBoost?: string;
|
|
109
|
+
textNormalizationMode?: string;
|
|
110
|
+
subtitleEnable?: boolean;
|
|
111
|
+
subtitleType?: string;
|
|
112
|
+
continuousSound?: boolean;
|
|
113
|
+
sessionId?: string;
|
|
114
|
+
skipPatterns?: number[];
|
|
115
|
+
additionalParams?: Record<string, unknown>;
|
|
116
|
+
}
|
|
117
|
+
/** MiniMax duplex streaming TTS. Currently available only in mainland China. */
|
|
118
|
+
export declare class MiniMaxDuplexTTS extends BaseCNTTS {
|
|
119
|
+
private readonly options;
|
|
120
|
+
constructor(options: MiniMaxDuplexTTSOptions);
|
|
121
|
+
toConfig(): TtsConfig;
|
|
122
|
+
}
|
|
77
123
|
export interface MiniMaxCNVoiceSetting {
|
|
78
124
|
voice_id: string;
|
|
79
125
|
speed?: number;
|
|
@@ -4,6 +4,20 @@ function requireString(value, field, vendor) {
|
|
|
4
4
|
throw new Error(`${vendor} requires ${field}`);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
/** Qwen ASR for mainland China. */
|
|
8
|
+
export class QwenSTT extends BaseCNSTT {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super();
|
|
11
|
+
this.options = options;
|
|
12
|
+
requireString(options.apiKey, "apiKey", "QwenSTT");
|
|
13
|
+
}
|
|
14
|
+
toConfig() {
|
|
15
|
+
return {
|
|
16
|
+
vendor: "qwen",
|
|
17
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
export class FengmingSTT extends BaseCNSTT {
|
|
8
22
|
constructor(options = {}) {
|
|
9
23
|
var _a;
|
|
@@ -19,6 +33,20 @@ export class FengmingSTT extends BaseCNSTT {
|
|
|
19
33
|
return Object.assign(Object.assign({ vendor: "fengming" }, (keywords !== undefined && { keywords })), (hasParams && { params: Object.assign({}, additionalParams) }));
|
|
20
34
|
}
|
|
21
35
|
}
|
|
36
|
+
/** StepFun ASR for mainland China. */
|
|
37
|
+
export class StepFunSTT extends BaseCNSTT {
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super();
|
|
40
|
+
this.options = options;
|
|
41
|
+
requireString(options.apiKey, "apiKey", "StepFunSTT");
|
|
42
|
+
}
|
|
43
|
+
toConfig() {
|
|
44
|
+
return {
|
|
45
|
+
vendor: "stepfun",
|
|
46
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
22
50
|
export class MicrosoftCNSTT extends BaseCNSTT {
|
|
23
51
|
constructor(options) {
|
|
24
52
|
super();
|
|
@@ -107,6 +135,22 @@ export class XfyunDialectSTT extends BaseCNSTT {
|
|
|
107
135
|
};
|
|
108
136
|
}
|
|
109
137
|
}
|
|
138
|
+
/** MiniMax duplex streaming TTS. Currently available only in mainland China. */
|
|
139
|
+
export class MiniMaxDuplexTTS extends BaseCNTTS {
|
|
140
|
+
constructor(options) {
|
|
141
|
+
var _a;
|
|
142
|
+
super();
|
|
143
|
+
this.options = options;
|
|
144
|
+
requireString(options.key, "key", "MiniMaxDuplexTTS");
|
|
145
|
+
requireString(options.model, "model", "MiniMaxDuplexTTS");
|
|
146
|
+
requireString((_a = options.voiceSetting) === null || _a === void 0 ? void 0 : _a.voice_id, "voiceSetting.voice_id", "MiniMaxDuplexTTS");
|
|
147
|
+
}
|
|
148
|
+
toConfig() {
|
|
149
|
+
const { key, model, url, voiceSetting, audioSetting, pronunciationDict, voiceModify, languageBoost, textNormalizationMode, subtitleEnable, subtitleType, continuousSound, sessionId, skipPatterns, additionalParams, } = this.options;
|
|
150
|
+
return Object.assign({ vendor: "minimax_duplex", 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({}, additionalParams), { key,
|
|
151
|
+
model, voice_setting: voiceSetting }), (url !== undefined && { url })), (audioSetting !== undefined && { audio_setting: audioSetting })), (pronunciationDict !== undefined && { pronunciation_dict: pronunciationDict })), (voiceModify !== undefined && { voice_modify: voiceModify })), (languageBoost !== undefined && { language_boost: languageBoost })), (textNormalizationMode !== undefined && { text_normalization_mode: textNormalizationMode })), (subtitleEnable !== undefined && { subtitle_enable: subtitleEnable })), (subtitleType !== undefined && { subtitle_type: subtitleType })), (continuousSound !== undefined && { continuous_sound: continuousSound })), (sessionId !== undefined && { session_id: sessionId })) }, (skipPatterns !== undefined && { skip_patterns: skipPatterns }));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
110
154
|
export class MiniMaxCNTTS extends BaseCNTTS {
|
|
111
155
|
constructor(options) {
|
|
112
156
|
super();
|
|
@@ -4,6 +4,30 @@
|
|
|
4
4
|
import { type DeepgramPresetModel } from "../presets.mjs";
|
|
5
5
|
import type { SttConfig, TurnDetectionLanguage } from "../types.mjs";
|
|
6
6
|
import { BaseSTT, type SampleRate } from "./base.mjs";
|
|
7
|
+
/** Constructor options for global ElevenLabs ASR. */
|
|
8
|
+
export interface ElevenLabsSTTOptions {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
11
|
+
additionalParams?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/** ElevenLabs ASR for global deployments. */
|
|
14
|
+
export declare class ElevenLabsSTT extends BaseSTT {
|
|
15
|
+
private readonly options;
|
|
16
|
+
constructor(options: ElevenLabsSTTOptions);
|
|
17
|
+
toConfig(): SttConfig;
|
|
18
|
+
}
|
|
19
|
+
/** Constructor options for global Fish Audio ASR. */
|
|
20
|
+
export interface FishAudioSTTOptions {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
23
|
+
additionalParams?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/** Fish Audio ASR for global deployments. */
|
|
26
|
+
export declare class FishAudioSTT extends BaseSTT {
|
|
27
|
+
private readonly options;
|
|
28
|
+
constructor(options: FishAudioSTTOptions);
|
|
29
|
+
toConfig(): SttConfig;
|
|
30
|
+
}
|
|
7
31
|
/** Gemini transcription models. */
|
|
8
32
|
export declare const GeminiSTTModels: {
|
|
9
33
|
readonly Transcribe35Live: "gemini-3.5-transcribe-live";
|
|
@@ -8,6 +8,34 @@ function _requireString(value, field, vendor) {
|
|
|
8
8
|
throw new Error(`${vendor} requires ${field}`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/** ElevenLabs ASR for global deployments. */
|
|
12
|
+
export class ElevenLabsSTT extends BaseSTT {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
super();
|
|
15
|
+
this.options = options;
|
|
16
|
+
_requireString(options.apiKey, "apiKey", "ElevenLabsSTT");
|
|
17
|
+
}
|
|
18
|
+
toConfig() {
|
|
19
|
+
return {
|
|
20
|
+
vendor: "elevenlabs",
|
|
21
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Fish Audio ASR for global deployments. */
|
|
26
|
+
export class FishAudioSTT extends BaseSTT {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super();
|
|
29
|
+
this.options = options;
|
|
30
|
+
_requireString(options.apiKey, "apiKey", "FishAudioSTT");
|
|
31
|
+
}
|
|
32
|
+
toConfig() {
|
|
33
|
+
return {
|
|
34
|
+
vendor: "fishaudio",
|
|
35
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
11
39
|
function isDeepgramManagedModel(model) {
|
|
12
40
|
return model !== undefined && DeepgramPresetModels.includes(model.trim().toLowerCase());
|
|
13
41
|
}
|