agora-agents 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cjs/AgoraPoolClient.d.ts +16 -3
- package/dist/cjs/AgoraPoolClient.js +26 -12
- package/dist/cjs/agentkit/Agent.js +17 -7
- package/dist/cjs/agentkit/AgentSession.js +6 -2
- package/dist/cjs/agentkit/avatar-types.d.ts +6 -0
- package/dist/cjs/agentkit/index.d.ts +5 -7
- package/dist/cjs/agentkit/index.js +7 -6
- package/dist/cjs/agentkit/presets.js +3 -3
- package/dist/cjs/agentkit/preview/client.d.ts +6 -5
- package/dist/cjs/agentkit/preview/client.js +7 -7
- package/dist/cjs/agentkit/preview/gemini-tts.d.ts +3 -31
- package/dist/cjs/agentkit/preview/gemini-tts.js +4 -30
- package/dist/cjs/agentkit/preview/index.d.ts +2 -2
- package/dist/cjs/agentkit/preview/index.js +4 -4
- package/dist/cjs/agentkit/token.d.ts +9 -7
- package/dist/cjs/agentkit/token.js +8 -7
- package/dist/cjs/agentkit/types.d.ts +12 -3
- package/dist/cjs/agentkit/v3.js +13 -7
- package/dist/cjs/agentkit/vendors/avatar.d.ts +6 -0
- package/dist/cjs/agentkit/vendors/avatar.js +14 -2
- package/dist/cjs/agentkit/vendors/stt.d.ts +35 -0
- package/dist/cjs/agentkit/vendors/stt.js +19 -2
- package/dist/cjs/agentkit/vendors/tts.d.ts +72 -18
- package/dist/cjs/agentkit/vendors/tts.js +60 -11
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +13 -0
- package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.d.ts +3 -1
- package/dist/cjs/api/types/Asr.d.ts +4 -1
- package/dist/cjs/api/types/CartesiaTts.d.ts +10 -0
- package/dist/cjs/api/types/CartesiaTts.js +9 -0
- package/dist/cjs/api/types/CartesiaTtsParams.d.ts +1 -1
- package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
- package/dist/cjs/api/types/FishAudioTts.d.ts +10 -0
- package/dist/cjs/api/types/FishAudioTts.js +9 -0
- package/dist/cjs/api/types/FishAudioTtsParams.d.ts +1 -1
- package/dist/cjs/api/types/GeminiTts.d.ts +9 -0
- package/dist/cjs/api/types/GeminiTts.js +3 -0
- package/dist/cjs/api/types/GeminiTtsParams.d.ts +15 -0
- package/dist/cjs/api/types/GeminiTtsParams.js +3 -0
- package/dist/cjs/api/types/RtzrAsr.d.ts +10 -0
- package/dist/cjs/api/types/RtzrAsr.js +3 -0
- package/dist/cjs/api/types/RtzrAsrParams.d.ts +31 -0
- package/dist/cjs/api/types/RtzrAsrParams.js +3 -0
- package/dist/cjs/api/types/SarvamTtsParams.d.ts +12 -8
- package/dist/cjs/api/types/SarvamTtsParams.js +1 -1
- package/dist/cjs/api/types/Tts.d.ts +4 -1
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/core/auth/publicAuthorization.d.ts +3 -0
- package/dist/cjs/core/auth/publicAuthorization.js +37 -0
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +7 -5
- package/dist/cjs/v3/transport.js +4 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.d.mts +16 -3
- package/dist/esm/AgoraPoolClient.mjs +26 -12
- package/dist/esm/agentkit/Agent.mjs +17 -7
- package/dist/esm/agentkit/AgentSession.mjs +6 -2
- package/dist/esm/agentkit/avatar-types.d.mts +6 -0
- package/dist/esm/agentkit/index.d.mts +5 -7
- package/dist/esm/agentkit/index.mjs +2 -3
- package/dist/esm/agentkit/presets.mjs +3 -3
- package/dist/esm/agentkit/preview/client.d.mts +6 -5
- package/dist/esm/agentkit/preview/client.mjs +7 -7
- package/dist/esm/agentkit/preview/gemini-tts.d.mts +3 -31
- package/dist/esm/agentkit/preview/gemini-tts.mjs +1 -28
- package/dist/esm/agentkit/preview/index.d.mts +2 -2
- package/dist/esm/agentkit/preview/index.mjs +1 -1
- package/dist/esm/agentkit/token.d.mts +9 -7
- package/dist/esm/agentkit/token.mjs +8 -7
- package/dist/esm/agentkit/types.d.mts +12 -3
- package/dist/esm/agentkit/v3.mjs +13 -7
- package/dist/esm/agentkit/vendors/avatar.d.mts +6 -0
- package/dist/esm/agentkit/vendors/avatar.mjs +14 -2
- package/dist/esm/agentkit/vendors/stt.d.mts +35 -0
- package/dist/esm/agentkit/vendors/stt.mjs +17 -1
- package/dist/esm/agentkit/vendors/tts.d.mts +72 -18
- package/dist/esm/agentkit/vendors/tts.mjs +58 -10
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +13 -0
- package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.d.mts +3 -1
- package/dist/esm/api/types/Asr.d.mts +4 -1
- package/dist/esm/api/types/CartesiaTts.d.mts +10 -0
- package/dist/esm/api/types/CartesiaTts.mjs +8 -1
- package/dist/esm/api/types/CartesiaTtsParams.d.mts +1 -1
- package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
- package/dist/esm/api/types/FishAudioTts.d.mts +10 -0
- package/dist/esm/api/types/FishAudioTts.mjs +8 -1
- package/dist/esm/api/types/FishAudioTtsParams.d.mts +1 -1
- package/dist/esm/api/types/GeminiTts.d.mts +9 -0
- package/dist/esm/api/types/GeminiTts.mjs +2 -0
- package/dist/esm/api/types/GeminiTtsParams.d.mts +15 -0
- package/dist/esm/api/types/GeminiTtsParams.mjs +2 -0
- package/dist/esm/api/types/RtzrAsr.d.mts +10 -0
- package/dist/esm/api/types/RtzrAsr.mjs +2 -0
- package/dist/esm/api/types/RtzrAsrParams.d.mts +31 -0
- package/dist/esm/api/types/RtzrAsrParams.mjs +2 -0
- package/dist/esm/api/types/SarvamTtsParams.d.mts +12 -8
- package/dist/esm/api/types/SarvamTtsParams.mjs +1 -1
- package/dist/esm/api/types/Tts.d.mts +4 -1
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/core/auth/publicAuthorization.d.mts +3 -0
- package/dist/esm/core/auth/publicAuthorization.mjs +33 -0
- package/dist/esm/index.d.mts +4 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/v3/transport.mjs +4 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi.yaml +13 -5
- package/package.json +2 -2
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - RTC tokens authenticate a specific (appId, channel, uid) combination with
|
|
6
6
|
* the Agora RTC network.
|
|
7
|
-
* - ConvoAI tokens are
|
|
8
|
-
* REST API calls via `Authorization: agora token=<token>`.
|
|
7
|
+
* - ConvoAI tokens are RTC + RTM + ConvoAI tokens used to authenticate
|
|
8
|
+
* ConvoAI REST API calls via `Authorization: agora token=<token>`.
|
|
9
9
|
*
|
|
10
|
-
* The `agora-token` library handles the
|
|
10
|
+
* The `agora-token` library handles the AccessToken2 signing.
|
|
11
11
|
*/
|
|
12
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -137,12 +137,13 @@ function generateRtcTokenWithAccount(opts) {
|
|
|
137
137
|
return _requireBuiltToken(agora_token_1.default.RtcTokenBuilder.buildTokenWithUserAccount(opts.appId, opts.appCertificate, opts.channel, opts.account, (_b = opts.role) !== null && _b !== void 0 ? _b : agora_token_1.default.RtcRole.PUBLISHER, expiry, expiry), opts.appId, opts.appCertificate);
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Builds a
|
|
140
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
141
141
|
*
|
|
142
142
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
143
143
|
*
|
|
144
|
-
* Uses `
|
|
145
|
-
*
|
|
144
|
+
* Uses `ConvoAITokenBuilder.buildTokenWithPrivilege`, which adds the ConvoAI service marker
|
|
145
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
146
|
+
* privileges in a single AccessToken2 token.
|
|
146
147
|
*/
|
|
147
148
|
function generateConvoAIToken(opts) {
|
|
148
149
|
var _a, _b;
|
|
@@ -152,7 +153,7 @@ function generateConvoAIToken(opts) {
|
|
|
152
153
|
const configuredPrivilegeExpire = (_b = opts.privilegeExpire) !== null && _b !== void 0 ? _b : 0;
|
|
153
154
|
const privilegeExpire = configuredPrivilegeExpire === 0 ? tokenExpire : configuredPrivilegeExpire;
|
|
154
155
|
const account = _uidToAccount(opts.uid);
|
|
155
|
-
return _requireBuiltToken(agora_token_1.default.
|
|
156
|
+
return _requireBuiltToken(agora_token_1.default.ConvoAITokenBuilder.buildTokenWithPrivilege(opts.appId, opts.appCertificate, opts.channelName, account, agora_token_1.default.RtcRole.PUBLISHER, tokenExpire, privilegeExpire, privilegeExpire, privilegeExpire, privilegeExpire, account, tokenExpire), opts.appId, opts.appCertificate);
|
|
156
157
|
}
|
|
157
158
|
function _uidToAccount(uid) {
|
|
158
159
|
if (!Number.isInteger(uid)) {
|
|
@@ -2,10 +2,9 @@
|
|
|
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, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, 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, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, 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.js";
|
|
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, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, 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, 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.js";
|
|
6
6
|
import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js";
|
|
7
7
|
import type { PresetInput } from "./presets.js";
|
|
8
|
-
import type { GeminiTTSConfig } from "./preview/gemini-tts.js";
|
|
9
8
|
/** LLM request style (openai, gemini, anthropic, dify) */
|
|
10
9
|
export type LlmStyle = Llm.Style;
|
|
11
10
|
/**
|
|
@@ -71,6 +70,10 @@ export type SttConfig = {
|
|
|
71
70
|
vendor: "sarvam";
|
|
72
71
|
language?: TurnDetectionLanguage;
|
|
73
72
|
params: SarvamAsrParams;
|
|
73
|
+
} | {
|
|
74
|
+
vendor: "rtzr";
|
|
75
|
+
language?: TurnDetectionLanguage;
|
|
76
|
+
params: RtzrAsrParamsType;
|
|
74
77
|
} | {
|
|
75
78
|
vendor: "xai";
|
|
76
79
|
language?: TurnDetectionLanguage;
|
|
@@ -85,7 +88,7 @@ export type AsrConfig = SttConfig;
|
|
|
85
88
|
/** Wire ASR vendor identifier (e.g. `"deepgram"`, `"fengming"`). */
|
|
86
89
|
export type AsrVendorName = string;
|
|
87
90
|
/** TTS (Text-to-Speech) configuration - discriminated union */
|
|
88
|
-
export type TtsConfig = Tts
|
|
91
|
+
export type TtsConfig = Tts;
|
|
89
92
|
/** Inline synchronous REST tool exposed to a standard text LLM. */
|
|
90
93
|
export type LlmTool = LlmToolType;
|
|
91
94
|
export type LlmToolExecution = LlmToolExecutionType;
|
|
@@ -155,6 +158,8 @@ export type AdvancedFeatures = StartAgentsRequest.Properties.AdvancedFeatures;
|
|
|
155
158
|
export type SessionParams = StartAgentsRequest.Properties.Parameters;
|
|
156
159
|
/** RTC audio scenario for the session parameters object. */
|
|
157
160
|
export type ParametersAudioScenario = StartAgentsRequest.Properties.Parameters.AudioScenario;
|
|
161
|
+
/** Speak request sentence-segmentation behavior. */
|
|
162
|
+
export type SpeakConfig = StartAgentsRequest.Properties.Parameters.Speak;
|
|
158
163
|
/**
|
|
159
164
|
* AgentKit session parameters input.
|
|
160
165
|
* Allows providing `audio_scenario` through the AgentKit layer.
|
|
@@ -470,6 +475,8 @@ export interface SpeechmaticsParams {
|
|
|
470
475
|
*/
|
|
471
476
|
export interface DeepgramParams {
|
|
472
477
|
/** Deepgram API key */
|
|
478
|
+
api_key?: string;
|
|
479
|
+
/** @deprecated Use `api_key` instead. AgentKit normalizes this alias before sending. */
|
|
473
480
|
key?: string;
|
|
474
481
|
/** Model to use (e.g., 'nova-2', 'enhanced', 'base') */
|
|
475
482
|
model?: string;
|
|
@@ -589,6 +596,8 @@ export type XAiAsr = XAiAsrType;
|
|
|
589
596
|
export type XAiAsrParams = XAiAsrParamsType;
|
|
590
597
|
export type SmallestAiAsr = SmallestAiAsrType;
|
|
591
598
|
export type SmallestAiAsrParams = SmallestAiAsrParamsType;
|
|
599
|
+
export type RtzrAsr = RtzrAsrType;
|
|
600
|
+
export type RtzrAsrParams = RtzrAsrParamsType;
|
|
592
601
|
/** Google Gemini STT parameters generated from the API schema. */
|
|
593
602
|
export type GeminiAsrParams = GeminiAsrParamsType;
|
|
594
603
|
export type MicrosoftTts = MicrosoftTtsType;
|
package/dist/cjs/agentkit/v3.js
CHANGED
|
@@ -102,7 +102,7 @@ const moved = [
|
|
|
102
102
|
"turn_detection",
|
|
103
103
|
];
|
|
104
104
|
function toV3Module(config, kind, errors = []) {
|
|
105
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
106
106
|
const c = Object.assign({}, config), params = Object.assign({}, c.params);
|
|
107
107
|
const path = `pipeline.${kind}`;
|
|
108
108
|
if (kind === "avatar" && c.vendor === "heygen")
|
|
@@ -113,20 +113,26 @@ function toV3Module(config, kind, errors = []) {
|
|
|
113
113
|
}
|
|
114
114
|
if (kind === "asr") {
|
|
115
115
|
(_a = c.language) !== null && _a !== void 0 ? _a : (c.language = (_b = params.language) !== null && _b !== void 0 ? _b : (c.vendor === "ares" ? "en-US" : undefined));
|
|
116
|
-
|
|
116
|
+
if (["assemblyai", "google", "microsoft", "sarvam", "speechmatics"].includes(c.vendor)) {
|
|
117
|
+
// These providers require their own language in addition to the interaction language.
|
|
118
|
+
(_c = params.language) !== null && _c !== void 0 ? _c : (params.language = c.language);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
delete params.language;
|
|
122
|
+
}
|
|
117
123
|
}
|
|
118
124
|
if (kind === "llm" && (c.vendor === "gemini" || c.style === "gemini") && c.url) {
|
|
119
125
|
// Legacy Gemini uses a query key; Platform credentials must never live in URLs.
|
|
120
126
|
const url = new URL(c.url);
|
|
121
127
|
const key = url.searchParams.get("key");
|
|
122
128
|
if (key !== null) {
|
|
123
|
-
(
|
|
129
|
+
(_d = c.api_key) !== null && _d !== void 0 ? _d : (c.api_key = key);
|
|
124
130
|
url.searchParams.delete("key");
|
|
125
131
|
c.url = url.toString();
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
if (kind === "llm" && c.style === "bedrock") {
|
|
129
|
-
(
|
|
135
|
+
(_e = c.vendor) !== null && _e !== void 0 ? _e : (c.vendor = "amazon");
|
|
130
136
|
for (const key of ["access_key", "secret_key", "region"]) {
|
|
131
137
|
if (c[key] !== undefined) {
|
|
132
138
|
if (params[key] !== undefined && params[key] !== c[key])
|
|
@@ -223,7 +229,7 @@ function toV3Module(config, kind, errors = []) {
|
|
|
223
229
|
: undefined;
|
|
224
230
|
const url = kind === "avatar"
|
|
225
231
|
? undefined
|
|
226
|
-
: ((
|
|
232
|
+
: ((_j = (_h = (_g = (_f = c.url) !== null && _f !== void 0 ? _f : (endpointAlias ? params[endpointAlias] : undefined)) !== null && _g !== void 0 ? _g : params.url) !== null && _h !== void 0 ? _h : params.base_url) !== null && _j !== void 0 ? _j : params.api_base_url);
|
|
227
233
|
if (kind !== "avatar") {
|
|
228
234
|
delete params.url;
|
|
229
235
|
delete params.base_url;
|
|
@@ -235,7 +241,7 @@ function toV3Module(config, kind, errors = []) {
|
|
|
235
241
|
if (url !== undefined)
|
|
236
242
|
result.url = url;
|
|
237
243
|
if ((kind === "llm" || kind === "asr") && params.model !== undefined) {
|
|
238
|
-
result.model = (
|
|
244
|
+
result.model = (_k = c.model) !== null && _k !== void 0 ? _k : params.model;
|
|
239
245
|
delete params.model;
|
|
240
246
|
}
|
|
241
247
|
if (kind === "tts" && c._minimaxPresetModel !== undefined)
|
|
@@ -243,7 +249,7 @@ function toV3Module(config, kind, errors = []) {
|
|
|
243
249
|
if (kind === "avatar") {
|
|
244
250
|
if (!["akool", "liveavatar", "anam", "generic", "sensetime", "spatius"].includes(c.vendor))
|
|
245
251
|
errors.push(`${path}.vendor`);
|
|
246
|
-
result.enabled = (
|
|
252
|
+
result.enabled = (_l = c.enable) !== null && _l !== void 0 ? _l : true;
|
|
247
253
|
}
|
|
248
254
|
else if (c.enable === false)
|
|
249
255
|
errors.push(`${path}.enable`);
|
|
@@ -153,6 +153,12 @@ export interface AnamAvatarOptions {
|
|
|
153
153
|
apiKey: string;
|
|
154
154
|
/** Anam avatar ID */
|
|
155
155
|
avatarId?: string;
|
|
156
|
+
/** Anam avatar model, such as `cara_mk4` for Cara 4 portrait mode */
|
|
157
|
+
avatarModel?: string;
|
|
158
|
+
/** Output video width in pixels. Set together with `videoHeight`. */
|
|
159
|
+
videoWidth?: number;
|
|
160
|
+
/** Output video height in pixels. Set together with `videoWidth`. */
|
|
161
|
+
videoHeight?: number;
|
|
156
162
|
/** Enable avatar (default: true) */
|
|
157
163
|
enable?: boolean;
|
|
158
164
|
/** Additional vendor-specific parameters */
|
|
@@ -183,6 +183,7 @@ exports.HeyGenAvatar = HeyGenAvatar;
|
|
|
183
183
|
*/
|
|
184
184
|
class AnamAvatar extends base_js_1.BaseAvatar {
|
|
185
185
|
constructor(options) {
|
|
186
|
+
var _a, _b;
|
|
186
187
|
super();
|
|
187
188
|
/**
|
|
188
189
|
* Anam does not enforce a specific TTS sample rate. Consult Anam documentation
|
|
@@ -193,13 +194,24 @@ class AnamAvatar extends base_js_1.BaseAvatar {
|
|
|
193
194
|
if (!options.apiKey) {
|
|
194
195
|
throw new Error("Anam avatar requires apiKey");
|
|
195
196
|
}
|
|
197
|
+
const hasVideoWidth = options.videoWidth !== undefined || ((_a = options.additionalParams) === null || _a === void 0 ? void 0 : _a.video_width) != null;
|
|
198
|
+
const hasVideoHeight = options.videoHeight !== undefined || ((_b = options.additionalParams) === null || _b === void 0 ? void 0 : _b.video_height) != null;
|
|
199
|
+
if (hasVideoWidth !== hasVideoHeight) {
|
|
200
|
+
throw new Error("Anam avatar requires videoWidth and videoHeight together");
|
|
201
|
+
}
|
|
196
202
|
}
|
|
197
203
|
toConfig() {
|
|
198
|
-
const { apiKey, avatarId, enable = true, additionalParams } = this.options;
|
|
204
|
+
const { apiKey, avatarId, avatarModel, videoWidth, videoHeight, enable = true, additionalParams, } = this.options;
|
|
205
|
+
const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (avatarId && { avatar_id: avatarId })), (avatarModel && { avatar_model: avatarModel })), (videoWidth !== undefined && { video_width: videoWidth })), (videoHeight !== undefined && { video_height: videoHeight }));
|
|
206
|
+
const hasVideoWidth = params.video_width != null;
|
|
207
|
+
const hasVideoHeight = params.video_height != null;
|
|
208
|
+
if (hasVideoWidth !== hasVideoHeight) {
|
|
209
|
+
throw new Error("Anam avatar requires videoWidth and videoHeight together");
|
|
210
|
+
}
|
|
199
211
|
return {
|
|
200
212
|
enable,
|
|
201
213
|
vendor: "anam",
|
|
202
|
-
params
|
|
214
|
+
params,
|
|
203
215
|
};
|
|
204
216
|
}
|
|
205
217
|
}
|
|
@@ -338,6 +338,41 @@ export declare class SarvamSTT extends BaseSTT {
|
|
|
338
338
|
constructor(options: SarvamSTTOptions);
|
|
339
339
|
toConfig(): SttConfig;
|
|
340
340
|
}
|
|
341
|
+
/** Constructor options for RTZR STT. */
|
|
342
|
+
export interface RTZRSTTOptions {
|
|
343
|
+
/** RTZR client ID. */
|
|
344
|
+
clientId: string;
|
|
345
|
+
/** RTZR client secret. */
|
|
346
|
+
clientSecret: string;
|
|
347
|
+
/** RTZR API base URL. */
|
|
348
|
+
apiBase?: string;
|
|
349
|
+
/** RTZR recognition model name. */
|
|
350
|
+
modelName?: string;
|
|
351
|
+
/** Recognition language code. Defaults server-side to Korean (`ko`). */
|
|
352
|
+
language?: string;
|
|
353
|
+
/** Input audio sample rate in Hz. */
|
|
354
|
+
sampleRate?: number;
|
|
355
|
+
/** Input audio encoding. */
|
|
356
|
+
encoding?: string;
|
|
357
|
+
/** Whether to enable inverse text normalization. */
|
|
358
|
+
useItn?: boolean;
|
|
359
|
+
/** Whether to filter disfluencies such as stuttering. */
|
|
360
|
+
useDisfluencyFilter?: boolean;
|
|
361
|
+
/** Whether to filter profanity. */
|
|
362
|
+
useProfanityFilter?: boolean;
|
|
363
|
+
/** Whether to add punctuation to recognized text. */
|
|
364
|
+
usePunctuation?: boolean;
|
|
365
|
+
/** Keywords used to improve recognition accuracy. */
|
|
366
|
+
keywords?: string[];
|
|
367
|
+
/** Additional RTZR parameters. Explicit options take precedence. */
|
|
368
|
+
additionalParams?: Partial<import("../types.js").RtzrAsrParams>;
|
|
369
|
+
}
|
|
370
|
+
/** RTZR streaming STT vendor. */
|
|
371
|
+
export declare class RTZRSTT extends BaseSTT {
|
|
372
|
+
private readonly options;
|
|
373
|
+
constructor(options: RTZRSTTOptions);
|
|
374
|
+
toConfig(): SttConfig;
|
|
375
|
+
}
|
|
341
376
|
/**
|
|
342
377
|
* Constructor options for xAI STT.
|
|
343
378
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type-safe STT (Speech-to-Text) vendor classes.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SmallestAISTT = exports.XAiSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = exports.GeminiSTT = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = void 0;
|
|
6
|
+
exports.SmallestAISTT = exports.XAiSTT = exports.RTZRSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = exports.GeminiSTT = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = void 0;
|
|
7
7
|
const presets_js_1 = require("../presets.js");
|
|
8
8
|
const base_js_1 = require("./base.js");
|
|
9
9
|
function _requireString(value, field, vendor) {
|
|
@@ -113,7 +113,7 @@ class DeepgramSTT extends base_js_1.BaseSTT {
|
|
|
113
113
|
const { apiKey, model, language, smartFormat, punctuation, keyterm, additionalParams } = this.options;
|
|
114
114
|
return {
|
|
115
115
|
vendor: "deepgram",
|
|
116
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey && {
|
|
116
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey && { api_key: apiKey })), (model && { model })), (language && { language })), (smartFormat !== undefined && { smart_format: smartFormat })), (punctuation !== undefined && { punctuation })), (keyterm && { keyterm })),
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -304,6 +304,23 @@ class SarvamSTT extends base_js_1.BaseSTT {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
exports.SarvamSTT = SarvamSTT;
|
|
307
|
+
/** RTZR streaming STT vendor. */
|
|
308
|
+
class RTZRSTT extends base_js_1.BaseSTT {
|
|
309
|
+
constructor(options) {
|
|
310
|
+
super();
|
|
311
|
+
this.options = options;
|
|
312
|
+
_requireString(options.clientId, "clientId", "RTZRSTT");
|
|
313
|
+
_requireString(options.clientSecret, "clientSecret", "RTZRSTT");
|
|
314
|
+
}
|
|
315
|
+
toConfig() {
|
|
316
|
+
const o = this.options;
|
|
317
|
+
return {
|
|
318
|
+
vendor: "rtzr",
|
|
319
|
+
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({}, o.additionalParams), { client_id: o.clientId, client_secret: o.clientSecret }), (o.apiBase !== undefined && { api_base: o.apiBase })), (o.modelName !== undefined && { model_name: o.modelName })), (o.language !== undefined && { language: o.language })), (o.sampleRate !== undefined && { sample_rate: o.sampleRate })), (o.encoding !== undefined && { encoding: o.encoding })), (o.useItn !== undefined && { use_itn: o.useItn })), (o.useDisfluencyFilter !== undefined && { use_disfluency_filter: o.useDisfluencyFilter })), (o.useProfanityFilter !== undefined && { use_profanity_filter: o.useProfanityFilter })), (o.usePunctuation !== undefined && { use_punctuation: o.usePunctuation })), (o.keywords !== undefined && { keywords: o.keywords })),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
exports.RTZRSTT = RTZRSTT;
|
|
307
324
|
/**
|
|
308
325
|
* xAI STT vendor.
|
|
309
326
|
*
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
3
3
|
*/
|
|
4
|
+
import type { Tts as GeneratedTts } from "../../api/index.js";
|
|
5
|
+
import { SarvamTtsParams as SarvamTtsParamsNS } from "../../api/types/SarvamTtsParams.js";
|
|
4
6
|
import { CredentialMode } from "../constants.js";
|
|
5
7
|
import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.js";
|
|
6
8
|
import type { TtsConfig } from "../types.js";
|
|
7
9
|
import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.js";
|
|
8
10
|
import { BaseTTS } from "./base.js";
|
|
11
|
+
/** Gemini 3.8 Flash TTS model. */
|
|
12
|
+
export declare const GeminiTTSModels: {
|
|
13
|
+
readonly Flash38: "gemini-3.8-flash-tts";
|
|
14
|
+
};
|
|
15
|
+
export type GeminiTTSModel = (typeof GeminiTTSModels)[keyof typeof GeminiTTSModels] | (string & {});
|
|
16
|
+
export interface GeminiTTSOptions {
|
|
17
|
+
apiKey: string;
|
|
18
|
+
/** Sent verbatim; defaults to Gemini 3.8 Flash TTS. */
|
|
19
|
+
model?: GeminiTTSModel;
|
|
20
|
+
/** Defaults to Puck. */
|
|
21
|
+
voice?: string;
|
|
22
|
+
/** Natural-language speaking instructions. Omitted unless supplied. */
|
|
23
|
+
style?: string;
|
|
24
|
+
/** Additional provider-specific parameters merged into `tts.params`. */
|
|
25
|
+
additionalParams?: Record<string, unknown>;
|
|
26
|
+
/** Skip patterns for bracketed content. */
|
|
27
|
+
skipPatterns?: number[];
|
|
28
|
+
}
|
|
29
|
+
/** Production Gemini TTS wire shape from the generated schema. */
|
|
30
|
+
export type GeminiTTSConfig = GeneratedTts.Gemini;
|
|
31
|
+
/** Gemini TTS uses the client's configured regional production endpoint. */
|
|
32
|
+
export declare class GeminiTTS extends BaseTTS {
|
|
33
|
+
private readonly options;
|
|
34
|
+
constructor(options: GeminiTTSOptions);
|
|
35
|
+
toConfig(): GeminiTTSConfig;
|
|
36
|
+
}
|
|
9
37
|
/**
|
|
10
38
|
* Constructor options for ElevenLabs TTS.
|
|
11
39
|
*/
|
|
@@ -148,9 +176,7 @@ export declare class OpenAITTS extends BaseTTS<24000> {
|
|
|
148
176
|
/**
|
|
149
177
|
* Constructor options for Cartesia TTS.
|
|
150
178
|
*/
|
|
151
|
-
|
|
152
|
-
/** Cartesia API key */
|
|
153
|
-
apiKey: string;
|
|
179
|
+
type CartesiaTTSCommonOptions<SR extends CartesiaSampleRate> = {
|
|
154
180
|
/** Voice ID */
|
|
155
181
|
voiceId: string;
|
|
156
182
|
/** Model ID */
|
|
@@ -166,7 +192,16 @@ export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSamp
|
|
|
166
192
|
sampleRate?: SR;
|
|
167
193
|
/** Skip patterns for bracketed content */
|
|
168
194
|
skipPatterns?: number[];
|
|
169
|
-
}
|
|
195
|
+
};
|
|
196
|
+
export type CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSampleRate> = CartesiaTTSCommonOptions<SR> & ({
|
|
197
|
+
/** Use Agora-managed credentials; the API key is optional. */
|
|
198
|
+
credentialMode: typeof CredentialMode.Managed;
|
|
199
|
+
apiKey?: string;
|
|
200
|
+
} | {
|
|
201
|
+
/** Bring your own credentials (default when omitted). */
|
|
202
|
+
credentialMode?: typeof CredentialMode.Byok;
|
|
203
|
+
apiKey: string;
|
|
204
|
+
});
|
|
170
205
|
/**
|
|
171
206
|
* Cartesia TTS vendor.
|
|
172
207
|
*
|
|
@@ -175,6 +210,7 @@ export interface CartesiaTTSOptions<SR extends CartesiaSampleRate = CartesiaSamp
|
|
|
175
210
|
* const tts = new CartesiaTTS({
|
|
176
211
|
* apiKey: process.env.CARTESIA_API_KEY,
|
|
177
212
|
* voiceId: 'voice-id-here',
|
|
213
|
+
* modelId: 'sonic-2',
|
|
178
214
|
* sampleRate: 24000,
|
|
179
215
|
* });
|
|
180
216
|
* ```
|
|
@@ -443,16 +479,23 @@ export declare class RimeTTS extends BaseTTS {
|
|
|
443
479
|
/**
|
|
444
480
|
* Constructor options for Fish Audio TTS.
|
|
445
481
|
*/
|
|
446
|
-
|
|
447
|
-
/** Fish Audio API key */
|
|
448
|
-
key: string;
|
|
482
|
+
type FishAudioTTSCommonOptions = {
|
|
449
483
|
/** Reference ID */
|
|
450
484
|
referenceId: string;
|
|
451
485
|
/** Backend used by Fish Audio */
|
|
452
486
|
backend: string;
|
|
453
487
|
/** Skip patterns for bracketed content */
|
|
454
488
|
skipPatterns?: number[];
|
|
455
|
-
}
|
|
489
|
+
};
|
|
490
|
+
export type FishAudioTTSOptions = FishAudioTTSCommonOptions & ({
|
|
491
|
+
/** Use Agora-managed credentials; the API key is optional. */
|
|
492
|
+
credentialMode: typeof CredentialMode.Managed;
|
|
493
|
+
key?: string;
|
|
494
|
+
} | {
|
|
495
|
+
/** Bring your own credentials (default when omitted). */
|
|
496
|
+
credentialMode?: typeof CredentialMode.Byok;
|
|
497
|
+
key: string;
|
|
498
|
+
});
|
|
456
499
|
/**
|
|
457
500
|
* Fish Audio TTS vendor.
|
|
458
501
|
*
|
|
@@ -538,21 +581,32 @@ export declare class MiniMaxTTS extends BaseTTS {
|
|
|
538
581
|
/**
|
|
539
582
|
* Constructor options for Sarvam TTS (Beta).
|
|
540
583
|
*/
|
|
541
|
-
export
|
|
584
|
+
export declare const SarvamTTSLanguage: typeof SarvamTtsParamsNS.TargetLanguageCode;
|
|
585
|
+
/** Target language supported by Sarvam TTS. */
|
|
586
|
+
export type SarvamTTSLanguage = (typeof SarvamTTSLanguage)[keyof typeof SarvamTTSLanguage];
|
|
587
|
+
export interface SarvamTTSOptions<SR extends number = number> {
|
|
542
588
|
/** Sarvam API subscription key */
|
|
543
589
|
key: string;
|
|
544
590
|
/** Speaker/voice ID (e.g., 'anushka', 'abhilash', 'karun', 'hitesh', 'manisha', 'vidya', 'arya') */
|
|
545
591
|
speaker: string;
|
|
546
|
-
/** Target language code
|
|
547
|
-
targetLanguageCode:
|
|
548
|
-
/** Pitch
|
|
592
|
+
/** Target language code. Use `SarvamTTSLanguage` for discoverable values. */
|
|
593
|
+
targetLanguageCode: SarvamTTSLanguage;
|
|
594
|
+
/** Pitch control for the `bulbul:v2` model. */
|
|
549
595
|
pitch?: number;
|
|
550
|
-
/**
|
|
596
|
+
/** Speech speed. Defaults server-side to `1.0`. */
|
|
551
597
|
pace?: number;
|
|
552
|
-
/**
|
|
598
|
+
/** Audio loudness control for the `bulbul:v2` model. */
|
|
553
599
|
loudness?: number;
|
|
554
|
-
/**
|
|
555
|
-
|
|
600
|
+
/** Output speech sample rate in Hz. Defaults server-side to 24000. */
|
|
601
|
+
speechSampleRate?: SR;
|
|
602
|
+
/** @deprecated Use `speechSampleRate` instead. */
|
|
603
|
+
sampleRate?: SR;
|
|
604
|
+
/** Whether to normalize English words and numeric entities. */
|
|
605
|
+
enablePreprocessing?: boolean;
|
|
606
|
+
/** TTS model to use. Defaults to `bulbul:v3`. */
|
|
607
|
+
model?: string;
|
|
608
|
+
/** Additional vendor-specific parameters. Explicit options take precedence. */
|
|
609
|
+
additionalParams?: Record<string, unknown>;
|
|
556
610
|
/** Skip patterns for bracketed content */
|
|
557
611
|
skipPatterns?: number[];
|
|
558
612
|
}
|
|
@@ -568,9 +622,9 @@ export interface SarvamTTSOptions {
|
|
|
568
622
|
* });
|
|
569
623
|
* ```
|
|
570
624
|
*/
|
|
571
|
-
export declare class SarvamTTS extends BaseTTS {
|
|
625
|
+
export declare class SarvamTTS<SR extends number = number> extends BaseTTS<SR> {
|
|
572
626
|
private readonly options;
|
|
573
|
-
constructor(options: SarvamTTSOptions);
|
|
627
|
+
constructor(options: SarvamTTSOptions<SR>);
|
|
574
628
|
toConfig(): TtsConfig;
|
|
575
629
|
}
|
|
576
630
|
/**
|
|
@@ -3,10 +3,37 @@
|
|
|
3
3
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SmallestAITTS = exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.TypecastTTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
|
|
6
|
+
exports.SmallestAITTS = exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.SarvamTTSLanguage = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.TypecastTTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = exports.GeminiTTS = exports.GeminiTTSModels = void 0;
|
|
7
|
+
const SarvamTtsParams_js_1 = require("../../api/types/SarvamTtsParams.js");
|
|
7
8
|
const constants_js_1 = require("../constants.js");
|
|
8
9
|
const presets_js_1 = require("../presets.js");
|
|
9
10
|
const base_js_1 = require("./base.js");
|
|
11
|
+
/** Gemini 3.8 Flash TTS model. */
|
|
12
|
+
exports.GeminiTTSModels = {
|
|
13
|
+
Flash38: "gemini-3.8-flash-tts",
|
|
14
|
+
};
|
|
15
|
+
/** Gemini TTS uses the client's configured regional production endpoint. */
|
|
16
|
+
class GeminiTTS extends base_js_1.BaseTTS {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super();
|
|
19
|
+
for (const field of ["apiKey", "model", "voice"]) {
|
|
20
|
+
const value = options[field];
|
|
21
|
+
if ((field === "apiKey" || value !== undefined) && (typeof value !== "string" || !value.trim())) {
|
|
22
|
+
throw new Error(`GeminiTTS requires ${field}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (options.style !== undefined && typeof options.style !== "string") {
|
|
26
|
+
throw new Error("GeminiTTS style must be a string");
|
|
27
|
+
}
|
|
28
|
+
this.options = Object.assign({}, options);
|
|
29
|
+
}
|
|
30
|
+
toConfig() {
|
|
31
|
+
const { apiKey, model = exports.GeminiTTSModels.Flash38, voice = "Puck", style, additionalParams, skipPatterns, } = this.options;
|
|
32
|
+
return Object.assign({ vendor: "gemini", params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, model,
|
|
33
|
+
voice }), (style !== undefined && { style })) }, (skipPatterns !== undefined && { skip_patterns: skipPatterns }));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.GeminiTTS = GeminiTTS;
|
|
10
37
|
function requireString(value, field, vendor) {
|
|
11
38
|
if (typeof value !== "string" || value.length === 0) {
|
|
12
39
|
throw new Error(`${vendor} requires ${field}`);
|
|
@@ -120,6 +147,7 @@ exports.OpenAITTS = OpenAITTS;
|
|
|
120
147
|
* const tts = new CartesiaTTS({
|
|
121
148
|
* apiKey: process.env.CARTESIA_API_KEY,
|
|
122
149
|
* voiceId: 'voice-id-here',
|
|
150
|
+
* modelId: 'sonic-2',
|
|
123
151
|
* sampleRate: 24000,
|
|
124
152
|
* });
|
|
125
153
|
* ```
|
|
@@ -127,11 +155,21 @@ exports.OpenAITTS = OpenAITTS;
|
|
|
127
155
|
class CartesiaTTS extends base_js_1.BaseTTS {
|
|
128
156
|
constructor(options) {
|
|
129
157
|
super();
|
|
158
|
+
if (options.credentialMode !== undefined &&
|
|
159
|
+
options.credentialMode !== constants_js_1.CredentialMode.Managed &&
|
|
160
|
+
options.credentialMode !== constants_js_1.CredentialMode.Byok) {
|
|
161
|
+
throw new Error("CartesiaTTS credentialMode must be one of: managed, byok");
|
|
162
|
+
}
|
|
163
|
+
if (options.credentialMode !== constants_js_1.CredentialMode.Managed) {
|
|
164
|
+
requireString(options.apiKey, "apiKey", "CartesiaTTS");
|
|
165
|
+
}
|
|
166
|
+
requireString(options.voiceId, "voiceId", "CartesiaTTS");
|
|
167
|
+
requireString(options.modelId, "modelId", "CartesiaTTS");
|
|
130
168
|
this.options = options;
|
|
131
169
|
}
|
|
132
170
|
toConfig() {
|
|
133
|
-
const { apiKey, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
|
|
134
|
-
return Object.assign({ vendor: "cartesia", params: Object.assign(Object.assign(Object.assign({ api_key: apiKey, voice: { mode: "id", id: voiceId }, model_id: modelId }, (baseUrl && { base_url: baseUrl })), (sampleRate && { output_format: { container: "raw", sample_rate: sampleRate } })), (language && { language })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
171
|
+
const { apiKey, credentialMode, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
|
|
172
|
+
return Object.assign(Object.assign(Object.assign({ vendor: "cartesia" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (apiKey && { api_key: apiKey })), { voice: { mode: "id", id: voiceId }, model_id: modelId }), (baseUrl && { base_url: baseUrl })), (sampleRate && { output_format: { container: "raw", sample_rate: sampleRate } })), (language && { language })) }), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
135
173
|
}
|
|
136
174
|
}
|
|
137
175
|
exports.CartesiaTTS = CartesiaTTS;
|
|
@@ -322,15 +360,21 @@ exports.RimeTTS = RimeTTS;
|
|
|
322
360
|
class FishAudioTTS extends base_js_1.BaseTTS {
|
|
323
361
|
constructor(options) {
|
|
324
362
|
super();
|
|
363
|
+
if (options.credentialMode !== undefined &&
|
|
364
|
+
options.credentialMode !== constants_js_1.CredentialMode.Managed &&
|
|
365
|
+
options.credentialMode !== constants_js_1.CredentialMode.Byok) {
|
|
366
|
+
throw new Error("FishAudioTTS credentialMode must be one of: managed, byok");
|
|
367
|
+
}
|
|
368
|
+
if (options.credentialMode !== constants_js_1.CredentialMode.Managed) {
|
|
369
|
+
requireString(options.key, "key", "FishAudioTTS");
|
|
370
|
+
}
|
|
371
|
+
requireString(options.referenceId, "referenceId", "FishAudioTTS");
|
|
372
|
+
requireString(options.backend, "backend", "FishAudioTTS");
|
|
325
373
|
this.options = options;
|
|
326
374
|
}
|
|
327
375
|
toConfig() {
|
|
328
|
-
const { key, referenceId, backend, skipPatterns } = this.options;
|
|
329
|
-
return Object.assign({ vendor: "fishaudio", params: {
|
|
330
|
-
api_key: key,
|
|
331
|
-
reference_id: referenceId,
|
|
332
|
-
backend,
|
|
333
|
-
} }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
376
|
+
const { key, credentialMode, referenceId, backend, skipPatterns } = this.options;
|
|
377
|
+
return Object.assign(Object.assign(Object.assign({ vendor: "fishaudio" }, (credentialMode !== undefined && { credential_mode: credentialMode })), { params: Object.assign(Object.assign({}, (key && { api_key: key })), { reference_id: referenceId, backend }) }), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
334
378
|
}
|
|
335
379
|
}
|
|
336
380
|
exports.FishAudioTTS = FishAudioTTS;
|
|
@@ -371,6 +415,10 @@ class MiniMaxTTS extends base_js_1.BaseTTS {
|
|
|
371
415
|
}
|
|
372
416
|
}
|
|
373
417
|
exports.MiniMaxTTS = MiniMaxTTS;
|
|
418
|
+
/**
|
|
419
|
+
* Constructor options for Sarvam TTS (Beta).
|
|
420
|
+
*/
|
|
421
|
+
exports.SarvamTTSLanguage = SarvamTtsParams_js_1.SarvamTtsParams.TargetLanguageCode;
|
|
374
422
|
/**
|
|
375
423
|
* Sarvam TTS vendor (Beta).
|
|
376
424
|
*
|
|
@@ -389,8 +437,9 @@ class SarvamTTS extends base_js_1.BaseTTS {
|
|
|
389
437
|
this.options = options;
|
|
390
438
|
}
|
|
391
439
|
toConfig() {
|
|
392
|
-
const { key, speaker, targetLanguageCode, pitch, pace, loudness, sampleRate, skipPatterns } = this.options;
|
|
393
|
-
|
|
440
|
+
const { key, speaker, targetLanguageCode, pitch, pace, loudness, speechSampleRate, sampleRate, enablePreprocessing, model, additionalParams, skipPatterns, } = this.options;
|
|
441
|
+
const resolvedSampleRate = speechSampleRate !== null && speechSampleRate !== void 0 ? speechSampleRate : sampleRate;
|
|
442
|
+
return Object.assign({ vendor: "sarvam", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: "bulbul:v3" }, additionalParams), { api_subscription_key: key, speaker, target_language_code: targetLanguageCode }), (pitch !== undefined && { pitch })), (pace !== undefined && { pace })), (loudness !== undefined && { loudness })), (resolvedSampleRate !== undefined && { speech_sample_rate: resolvedSampleRate })), (enablePreprocessing !== undefined && { enable_preprocessing: enablePreprocessing })), (model !== undefined && { model })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
394
443
|
}
|
|
395
444
|
}
|
|
396
445
|
exports.SarvamTTS = SarvamTTS;
|
|
@@ -688,6 +688,8 @@ export declare namespace StartAgentsRequest {
|
|
|
688
688
|
* Agent configuration parameters.
|
|
689
689
|
*/
|
|
690
690
|
interface Parameters {
|
|
691
|
+
/** Settings for the agent's speak behavior. */
|
|
692
|
+
speak?: Parameters.Speak;
|
|
691
693
|
/** Settings related to agent silence behavior. Does not apply when you integrate a `mllm`. */
|
|
692
694
|
silence_config?: Parameters.SilenceConfig;
|
|
693
695
|
/** Graceful hang-up settings for the agent. */
|
|
@@ -717,6 +719,17 @@ export declare namespace StartAgentsRequest {
|
|
|
717
719
|
opt_out?: boolean;
|
|
718
720
|
}
|
|
719
721
|
namespace Parameters {
|
|
722
|
+
/**
|
|
723
|
+
* Settings for the agent's speak behavior.
|
|
724
|
+
*/
|
|
725
|
+
interface Speak {
|
|
726
|
+
/**
|
|
727
|
+
* Whether to skip sentence segmentation for speak requests:
|
|
728
|
+
* - `false`: Skip sentence segmentation.
|
|
729
|
+
* - Omitted or `true`: Preserve sentence segmentation.
|
|
730
|
+
*/
|
|
731
|
+
batch?: boolean | null;
|
|
732
|
+
}
|
|
720
733
|
/**
|
|
721
734
|
* Settings related to agent silence behavior. Does not apply when you integrate a `mllm`.
|
|
722
735
|
*/
|
|
@@ -133,8 +133,10 @@ export declare namespace GetTurnsAgentsResponse {
|
|
|
133
133
|
* Additional context about the turn end event. Included fields depend on the value of the `type` field.
|
|
134
134
|
*/
|
|
135
135
|
interface Metadata {
|
|
136
|
-
/** The audio playback duration in milliseconds. Included
|
|
136
|
+
/** The actual audio playback duration in milliseconds. Included when `type` is `ok` or `interrupted`. */
|
|
137
137
|
playback_duration_ms?: number;
|
|
138
|
+
/** The intended audio playback duration in milliseconds. Included only when `type` is `interrupted`. */
|
|
139
|
+
intended_playback_duration_ms?: number;
|
|
138
140
|
/**
|
|
139
141
|
* The cause of the turn ending.
|
|
140
142
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Agora from "../index.js";
|
|
2
|
-
export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai;
|
|
2
|
+
export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Rtzr | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai;
|
|
3
3
|
export declare namespace Asr {
|
|
4
4
|
interface Ares extends Agora.AresAsr {
|
|
5
5
|
vendor: "ares";
|
|
@@ -37,6 +37,9 @@ export declare namespace Asr {
|
|
|
37
37
|
interface Sarvam extends Agora.SarvamAsr {
|
|
38
38
|
vendor: "sarvam";
|
|
39
39
|
}
|
|
40
|
+
interface Rtzr extends Agora.RtzrAsr {
|
|
41
|
+
vendor: "rtzr";
|
|
42
|
+
}
|
|
40
43
|
interface Xai extends Agora.XAiAsr {
|
|
41
44
|
vendor: "xai";
|
|
42
45
|
}
|