agora-agents 2.12.0 → 2.13.1
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 +2 -2
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/agentkit/Agent.js +10 -3
- 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 +7 -9
- package/dist/cjs/agentkit/index.js +8 -5
- 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 +43 -7
- package/dist/cjs/agentkit/token.js +34 -6
- package/dist/cjs/agentkit/types.d.ts +12 -3
- package/dist/cjs/agentkit/vendors/avatar.d.ts +30 -12
- package/dist/cjs/agentkit/vendors/avatar.js +62 -5
- 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/index.d.ts +4 -4
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/agentkit/Agent.mjs +10 -3
- 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 +7 -9
- package/dist/esm/agentkit/index.mjs +3 -4
- 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 +43 -7
- package/dist/esm/agentkit/token.mjs +33 -6
- package/dist/esm/agentkit/types.d.mts +12 -3
- package/dist/esm/agentkit/vendors/avatar.d.mts +30 -12
- package/dist/esm/agentkit/vendors/avatar.mjs +59 -8
- 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/index.d.mts +4 -4
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -8,9 +8,9 @@ export type { OpenAIGPTLiveOptions } from "../vendors/mllm.mjs";
|
|
|
8
8
|
export { OpenAIGPTLive } from "../vendors/mllm.mjs";
|
|
9
9
|
export type { GeminiSTTModel, GeminiSTTOptions } from "../vendors/stt.mjs";
|
|
10
10
|
export { GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode } from "../vendors/stt.mjs";
|
|
11
|
+
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "../vendors/tts.mjs";
|
|
12
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
11
13
|
export type { PreviewFeature, PreviewRoute } from "./client.mjs";
|
|
12
14
|
export { applyPreviewShape, createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.mjs";
|
|
13
|
-
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "./gemini-tts.mjs";
|
|
14
|
-
export { GeminiTTS, GeminiTTSModels } from "./gemini-tts.mjs";
|
|
15
15
|
export type { GeminiLiveModel, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, } from "./vendors.mjs";
|
|
16
16
|
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { OpenAIGPTLive } from "../vendors/mllm.mjs";
|
|
8
8
|
export { GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode } from "../vendors/stt.mjs";
|
|
9
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
9
10
|
export { applyPreviewShape, createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.mjs";
|
|
10
|
-
export { GeminiTTS, GeminiTTSModels } from "./gemini-tts.mjs";
|
|
11
11
|
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.mjs";
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - RTC tokens authenticate a specific (appId, channel, uid) combination with
|
|
5
5
|
* the Agora RTC network.
|
|
6
|
-
* - ConvoAI tokens are
|
|
7
|
-
* REST API calls via `Authorization: agora token=<token>`.
|
|
6
|
+
* - ConvoAI tokens are RTC + RTM + ConvoAI tokens used to authenticate
|
|
7
|
+
* ConvoAI REST API calls via `Authorization: agora token=<token>`. Keep them
|
|
8
|
+
* on the server.
|
|
9
|
+
* - Client tokens are RTC + RTM only, for front-end token routes. They join a
|
|
10
|
+
* channel and log in to RTM but cannot call the ConvoAI REST API.
|
|
8
11
|
*
|
|
9
12
|
* The `agora-token` library handles the JWT signing.
|
|
10
13
|
*/
|
|
@@ -74,8 +77,12 @@ export interface GenerateConvoAITokenOptions {
|
|
|
74
77
|
appCertificate: string;
|
|
75
78
|
/** The channel the agent will join — must match the channel used in the start request */
|
|
76
79
|
channelName: string;
|
|
77
|
-
/**
|
|
78
|
-
|
|
80
|
+
/**
|
|
81
|
+
* ConvoAI participant UID: a numeric RTC UID or a string user account. Use the
|
|
82
|
+
* RTC UID for a user, agent, or avatar. Both forms are signed as the UID's
|
|
83
|
+
* string form, which is also the RTM user ID.
|
|
84
|
+
*/
|
|
85
|
+
uid: number | string;
|
|
79
86
|
/** Seconds until the token expires (default: 86400) */
|
|
80
87
|
tokenExpire?: number;
|
|
81
88
|
/**
|
|
@@ -86,11 +93,40 @@ export interface GenerateConvoAITokenOptions {
|
|
|
86
93
|
privilegeExpire?: number;
|
|
87
94
|
}
|
|
88
95
|
/**
|
|
89
|
-
* Builds a
|
|
96
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
90
97
|
*
|
|
91
98
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
92
99
|
*
|
|
93
|
-
* Uses `
|
|
94
|
-
*
|
|
100
|
+
* Uses `ConvoAITokenBuilder.buildToken`, which adds the ConvoAI service marker
|
|
101
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
102
|
+
* privileges in a single AccessToken2 token.
|
|
95
103
|
*/
|
|
96
104
|
export declare function generateConvoAIToken(opts: GenerateConvoAITokenOptions): string;
|
|
105
|
+
export interface GenerateClientTokenOptions {
|
|
106
|
+
appId: string;
|
|
107
|
+
appCertificate: string;
|
|
108
|
+
/** The channel the client will join. */
|
|
109
|
+
channelName: string;
|
|
110
|
+
/**
|
|
111
|
+
* The client's RTC UID or string user account. It is also the RTM user ID, so
|
|
112
|
+
* it must be nonzero and nonempty.
|
|
113
|
+
*/
|
|
114
|
+
uid: number | string;
|
|
115
|
+
/** Seconds until the token expires (default: 86400) */
|
|
116
|
+
tokenExpire?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Seconds until RTC privileges expire. Defaults to `tokenExpire`. RTM login
|
|
119
|
+
* keeps the token lifetime.
|
|
120
|
+
*/
|
|
121
|
+
privilegeExpire?: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Builds an RTC + RTM token for a front-end client. Use it in token routes that
|
|
125
|
+
* hand tokens to browsers or apps.
|
|
126
|
+
*
|
|
127
|
+
* The token joins the RTC channel as a publisher and logs in to RTM, the data
|
|
128
|
+
* channel for agent transcripts and state. It carries no ConvoAI service, so it
|
|
129
|
+
* cannot authenticate ConvoAI REST calls. Use {@link generateConvoAIToken} for
|
|
130
|
+
* server-side REST authentication and agent tokens instead.
|
|
131
|
+
*/
|
|
132
|
+
export declare function generateClientToken(opts: GenerateClientTokenOptions): string;
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - RTC tokens authenticate a specific (appId, channel, uid) combination with
|
|
5
5
|
* the Agora RTC network.
|
|
6
|
-
* - ConvoAI tokens are
|
|
7
|
-
* REST API calls via `Authorization: agora token=<token>`.
|
|
6
|
+
* - ConvoAI tokens are RTC + RTM + ConvoAI tokens used to authenticate
|
|
7
|
+
* ConvoAI REST API calls via `Authorization: agora token=<token>`. Keep them
|
|
8
|
+
* on the server.
|
|
9
|
+
* - Client tokens are RTC + RTM only, for front-end token routes. They join a
|
|
10
|
+
* channel and log in to RTM but cannot call the ConvoAI REST API.
|
|
8
11
|
*
|
|
9
12
|
* The `agora-token` library handles the JWT signing.
|
|
10
13
|
*/
|
|
@@ -128,12 +131,13 @@ export function generateRtcTokenWithAccount(opts) {
|
|
|
128
131
|
return _requireBuiltToken(agoraToken.RtcTokenBuilder.buildTokenWithUserAccount(opts.appId, opts.appCertificate, opts.channel, opts.account, (_b = opts.role) !== null && _b !== void 0 ? _b : agoraToken.RtcRole.PUBLISHER, expiry, expiry), opts.appId, opts.appCertificate);
|
|
129
132
|
}
|
|
130
133
|
/**
|
|
131
|
-
* Builds a
|
|
134
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
132
135
|
*
|
|
133
136
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
134
137
|
*
|
|
135
|
-
* Uses `
|
|
136
|
-
*
|
|
138
|
+
* Uses `ConvoAITokenBuilder.buildToken`, which adds the ConvoAI service marker
|
|
139
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
140
|
+
* privileges in a single AccessToken2 token.
|
|
137
141
|
*/
|
|
138
142
|
export function generateConvoAIToken(opts) {
|
|
139
143
|
var _a, _b;
|
|
@@ -143,11 +147,34 @@ export function generateConvoAIToken(opts) {
|
|
|
143
147
|
const configuredPrivilegeExpire = (_b = opts.privilegeExpire) !== null && _b !== void 0 ? _b : 0;
|
|
144
148
|
const privilegeExpire = configuredPrivilegeExpire === 0 ? tokenExpire : configuredPrivilegeExpire;
|
|
145
149
|
const account = _uidToAccount(opts.uid);
|
|
146
|
-
return _requireBuiltToken(agoraToken.
|
|
150
|
+
return _requireBuiltToken(agoraToken.ConvoAITokenBuilder.buildToken(opts.appId, opts.appCertificate, opts.channelName, account, agoraToken.RtcRole.PUBLISHER, tokenExpire, privilegeExpire, privilegeExpire, privilegeExpire, privilegeExpire, account, privilegeExpire), opts.appId, opts.appCertificate);
|
|
147
151
|
}
|
|
148
152
|
function _uidToAccount(uid) {
|
|
153
|
+
if (typeof uid === "string") {
|
|
154
|
+
return uid;
|
|
155
|
+
}
|
|
149
156
|
if (!Number.isInteger(uid)) {
|
|
150
157
|
throw new Error("uid must be an integer when provided as a number");
|
|
151
158
|
}
|
|
152
159
|
return String(uid);
|
|
153
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Builds an RTC + RTM token for a front-end client. Use it in token routes that
|
|
163
|
+
* hand tokens to browsers or apps.
|
|
164
|
+
*
|
|
165
|
+
* The token joins the RTC channel as a publisher and logs in to RTM, the data
|
|
166
|
+
* channel for agent transcripts and state. It carries no ConvoAI service, so it
|
|
167
|
+
* cannot authenticate ConvoAI REST calls. Use {@link generateConvoAIToken} for
|
|
168
|
+
* server-side REST authentication and agent tokens instead.
|
|
169
|
+
*/
|
|
170
|
+
export function generateClientToken(opts) {
|
|
171
|
+
var _a;
|
|
172
|
+
const account = _uidToAccount(opts.uid);
|
|
173
|
+
if (account === "" || /^0+$/.test(account)) {
|
|
174
|
+
throw new Error("uid must be nonzero and nonempty: it is also the RTM user ID");
|
|
175
|
+
}
|
|
176
|
+
const tokenExpire = (_a = opts.tokenExpire) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRY_SECONDS;
|
|
177
|
+
// Per Agora docs, privilegeExpire=0 means "expires immediately", which is invalid.
|
|
178
|
+
const privilegeExpire = opts.privilegeExpire || tokenExpire;
|
|
179
|
+
return _requireBuiltToken(agoraToken.RtcTokenBuilder.buildTokenWithRtm(opts.appId, opts.appCertificate, opts.channelName, account, agoraToken.RtcRole.PUBLISHER, tokenExpire, privilegeExpire), opts.appId, opts.appCertificate);
|
|
180
|
+
}
|
|
@@ -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.mjs";
|
|
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.mjs";
|
|
6
6
|
import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs";
|
|
7
7
|
import type { PresetInput } from "./presets.mjs";
|
|
8
|
-
import type { GeminiTTSConfig } from "./preview/gemini-tts.mjs";
|
|
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.
|
|
@@ -447,6 +452,8 @@ export interface SpeechmaticsParams {
|
|
|
447
452
|
*/
|
|
448
453
|
export interface DeepgramParams {
|
|
449
454
|
/** Deepgram API key */
|
|
455
|
+
api_key?: string;
|
|
456
|
+
/** @deprecated Use `api_key` instead. AgentKit normalizes this alias before sending. */
|
|
450
457
|
key?: string;
|
|
451
458
|
/** Model to use (e.g., 'nova-2', 'enhanced', 'base') */
|
|
452
459
|
model?: string;
|
|
@@ -566,6 +573,8 @@ export type XAiAsr = XAiAsrType;
|
|
|
566
573
|
export type XAiAsrParams = XAiAsrParamsType;
|
|
567
574
|
export type SmallestAiAsr = SmallestAiAsrType;
|
|
568
575
|
export type SmallestAiAsrParams = SmallestAiAsrParamsType;
|
|
576
|
+
export type RtzrAsr = RtzrAsrType;
|
|
577
|
+
export type RtzrAsrParams = RtzrAsrParamsType;
|
|
569
578
|
/** Google Gemini STT parameters generated from the API schema. */
|
|
570
579
|
export type GeminiAsrParams = GeminiAsrParamsType;
|
|
571
580
|
export type MicrosoftTts = MicrosoftTtsType;
|
|
@@ -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 */
|
|
@@ -228,15 +234,27 @@ export declare class GenericAvatar extends BaseAvatar<number> {
|
|
|
228
234
|
constructor(options: GenericAvatarOptions);
|
|
229
235
|
toConfig(): AvatarConfig;
|
|
230
236
|
}
|
|
231
|
-
/** Tavus
|
|
232
|
-
export
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
export
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
export
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
/** Tavus options with an optional provider endpoint override. */
|
|
238
|
+
export type TavusOptions = Omit<GenericAvatarOptions, "apiBaseUrl"> & {
|
|
239
|
+
apiBaseUrl?: string;
|
|
240
|
+
};
|
|
241
|
+
/** Protoface options with an optional provider endpoint override. */
|
|
242
|
+
export type ProtofaceOptions = TavusOptions;
|
|
243
|
+
export declare class Tavus extends GenericAvatar {
|
|
244
|
+
constructor(options: TavusOptions);
|
|
245
|
+
}
|
|
246
|
+
export declare class Protoface extends GenericAvatar {
|
|
247
|
+
constructor(options: ProtofaceOptions);
|
|
248
|
+
}
|
|
249
|
+
export interface LemonSliceOptions extends Omit<TavusOptions, "avatarId"> {
|
|
250
|
+
/** Provider-recommended fixed ID is lemonslice. Explicit overrides remain supported. */
|
|
251
|
+
avatarId?: string;
|
|
252
|
+
agentImageUrl?: string;
|
|
253
|
+
agentId?: string;
|
|
254
|
+
agentImageBase64?: string;
|
|
255
|
+
/** Omit to use the provider default of 2x3. */
|
|
256
|
+
aspectRatio?: "2x3" | "9x16" | "1x1";
|
|
257
|
+
}
|
|
258
|
+
export declare class LemonSlice extends GenericAvatar {
|
|
259
|
+
constructor(options: LemonSliceOptions);
|
|
260
|
+
}
|
|
@@ -177,6 +177,7 @@ export class HeyGenAvatar extends BaseAvatar {
|
|
|
177
177
|
*/
|
|
178
178
|
export class AnamAvatar extends BaseAvatar {
|
|
179
179
|
constructor(options) {
|
|
180
|
+
var _a, _b;
|
|
180
181
|
super();
|
|
181
182
|
/**
|
|
182
183
|
* Anam does not enforce a specific TTS sample rate. Consult Anam documentation
|
|
@@ -187,13 +188,24 @@ export class AnamAvatar extends BaseAvatar {
|
|
|
187
188
|
if (!options.apiKey) {
|
|
188
189
|
throw new Error("Anam avatar requires apiKey");
|
|
189
190
|
}
|
|
191
|
+
const hasVideoWidth = options.videoWidth !== undefined || ((_a = options.additionalParams) === null || _a === void 0 ? void 0 : _a.video_width) != null;
|
|
192
|
+
const hasVideoHeight = options.videoHeight !== undefined || ((_b = options.additionalParams) === null || _b === void 0 ? void 0 : _b.video_height) != null;
|
|
193
|
+
if (hasVideoWidth !== hasVideoHeight) {
|
|
194
|
+
throw new Error("Anam avatar requires videoWidth and videoHeight together");
|
|
195
|
+
}
|
|
190
196
|
}
|
|
191
197
|
toConfig() {
|
|
192
|
-
const { apiKey, avatarId, enable = true, additionalParams } = this.options;
|
|
198
|
+
const { apiKey, avatarId, avatarModel, videoWidth, videoHeight, enable = true, additionalParams, } = this.options;
|
|
199
|
+
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 }));
|
|
200
|
+
const hasVideoWidth = params.video_width != null;
|
|
201
|
+
const hasVideoHeight = params.video_height != null;
|
|
202
|
+
if (hasVideoWidth !== hasVideoHeight) {
|
|
203
|
+
throw new Error("Anam avatar requires videoWidth and videoHeight together");
|
|
204
|
+
}
|
|
193
205
|
return {
|
|
194
206
|
enable,
|
|
195
207
|
vendor: "anam",
|
|
196
|
-
params
|
|
208
|
+
params,
|
|
197
209
|
};
|
|
198
210
|
}
|
|
199
211
|
}
|
|
@@ -236,9 +248,48 @@ export class GenericAvatar extends BaseAvatar {
|
|
|
236
248
|
};
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
export class Tavus extends GenericAvatar {
|
|
252
|
+
constructor(options) {
|
|
253
|
+
var _a;
|
|
254
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://tavusapi.com/v2/conversations/agora" }));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export class Protoface extends GenericAvatar {
|
|
258
|
+
constructor(options) {
|
|
259
|
+
var _a;
|
|
260
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://api.protoface.com/v1/agora" }));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export class LemonSlice extends GenericAvatar {
|
|
264
|
+
constructor(options) {
|
|
265
|
+
var _a, _b;
|
|
266
|
+
const params = Object.assign({}, options.additionalParams);
|
|
267
|
+
for (const [key, value] of [
|
|
268
|
+
["agent_image_url", options.agentImageUrl],
|
|
269
|
+
["agent_id", options.agentId],
|
|
270
|
+
["agent_image_base64", options.agentImageBase64],
|
|
271
|
+
["aspect_ratio", options.aspectRatio],
|
|
272
|
+
]) {
|
|
273
|
+
if (value !== undefined)
|
|
274
|
+
params[key] = value;
|
|
275
|
+
}
|
|
276
|
+
let selectors = 0;
|
|
277
|
+
for (const key of ["agent_id", "agent_image_url", "agent_image_base64"]) {
|
|
278
|
+
if (Object.keys(params).includes(key)) {
|
|
279
|
+
const value = params[key];
|
|
280
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
281
|
+
throw new Error(`LemonSlice ${key} must be a nonempty string`);
|
|
282
|
+
}
|
|
283
|
+
selectors++;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (selectors !== 1) {
|
|
287
|
+
throw new Error("LemonSlice requires exactly one of agent_id, agent_image_url, agent_image_base64");
|
|
288
|
+
}
|
|
289
|
+
if (Object.keys(params).includes("aspect_ratio") &&
|
|
290
|
+
!["2x3", "9x16", "1x1"].includes(params.aspect_ratio)) {
|
|
291
|
+
throw new Error("LemonSlice aspect_ratio must be 2x3, 9x16, or 1x1");
|
|
292
|
+
}
|
|
293
|
+
super(Object.assign(Object.assign({}, options), { apiBaseUrl: (_a = options.apiBaseUrl) !== null && _a !== void 0 ? _a : "https://lemonslice.com/api/liveai/agora", avatarId: (_b = options.avatarId) !== null && _b !== void 0 ? _b : "lemonslice", additionalParams: params }));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -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.mjs").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
|
*/
|
|
@@ -108,7 +108,7 @@ export class DeepgramSTT extends BaseSTT {
|
|
|
108
108
|
const { apiKey, model, language, smartFormat, punctuation, keyterm, additionalParams } = this.options;
|
|
109
109
|
return {
|
|
110
110
|
vendor: "deepgram",
|
|
111
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey && {
|
|
111
|
+
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 })),
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -291,6 +291,22 @@ export class SarvamSTT extends BaseSTT {
|
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
/** RTZR streaming STT vendor. */
|
|
295
|
+
export class RTZRSTT extends BaseSTT {
|
|
296
|
+
constructor(options) {
|
|
297
|
+
super();
|
|
298
|
+
this.options = options;
|
|
299
|
+
_requireString(options.clientId, "clientId", "RTZRSTT");
|
|
300
|
+
_requireString(options.clientSecret, "clientSecret", "RTZRSTT");
|
|
301
|
+
}
|
|
302
|
+
toConfig() {
|
|
303
|
+
const o = this.options;
|
|
304
|
+
return {
|
|
305
|
+
vendor: "rtzr",
|
|
306
|
+
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 })),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
294
310
|
/**
|
|
295
311
|
* xAI STT vendor.
|
|
296
312
|
*
|
|
@@ -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.mjs";
|
|
5
|
+
import { SarvamTtsParams as SarvamTtsParamsNS } from "../../api/types/SarvamTtsParams.mjs";
|
|
4
6
|
import { CredentialMode } from "../constants.mjs";
|
|
5
7
|
import { type MiniMaxPresetModel, type OpenAITtsPresetModel } from "../presets.mjs";
|
|
6
8
|
import type { TtsConfig } from "../types.mjs";
|
|
7
9
|
import type { CartesiaSampleRate, ElevenLabsSampleRate, GoogleTTSSampleRate, MicrosoftSampleRate } from "./base.mjs";
|
|
8
10
|
import { BaseTTS } from "./base.mjs";
|
|
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
|
*
|
|
@@ -518,21 +561,32 @@ export declare class MiniMaxTTS extends BaseTTS {
|
|
|
518
561
|
/**
|
|
519
562
|
* Constructor options for Sarvam TTS (Beta).
|
|
520
563
|
*/
|
|
521
|
-
export
|
|
564
|
+
export declare const SarvamTTSLanguage: typeof SarvamTtsParamsNS.TargetLanguageCode;
|
|
565
|
+
/** Target language supported by Sarvam TTS. */
|
|
566
|
+
export type SarvamTTSLanguage = (typeof SarvamTTSLanguage)[keyof typeof SarvamTTSLanguage];
|
|
567
|
+
export interface SarvamTTSOptions<SR extends number = number> {
|
|
522
568
|
/** Sarvam API subscription key */
|
|
523
569
|
key: string;
|
|
524
570
|
/** Speaker/voice ID (e.g., 'anushka', 'abhilash', 'karun', 'hitesh', 'manisha', 'vidya', 'arya') */
|
|
525
571
|
speaker: string;
|
|
526
|
-
/** Target language code
|
|
527
|
-
targetLanguageCode:
|
|
528
|
-
/** Pitch
|
|
572
|
+
/** Target language code. Use `SarvamTTSLanguage` for discoverable values. */
|
|
573
|
+
targetLanguageCode: SarvamTTSLanguage;
|
|
574
|
+
/** Pitch control for the `bulbul:v2` model. */
|
|
529
575
|
pitch?: number;
|
|
530
|
-
/**
|
|
576
|
+
/** Speech speed. Defaults server-side to `1.0`. */
|
|
531
577
|
pace?: number;
|
|
532
|
-
/**
|
|
578
|
+
/** Audio loudness control for the `bulbul:v2` model. */
|
|
533
579
|
loudness?: number;
|
|
534
|
-
/**
|
|
535
|
-
|
|
580
|
+
/** Output speech sample rate in Hz. Defaults server-side to 24000. */
|
|
581
|
+
speechSampleRate?: SR;
|
|
582
|
+
/** @deprecated Use `speechSampleRate` instead. */
|
|
583
|
+
sampleRate?: SR;
|
|
584
|
+
/** Whether to normalize English words and numeric entities. */
|
|
585
|
+
enablePreprocessing?: boolean;
|
|
586
|
+
/** TTS model to use. Defaults server-side to `bulbul:v3`. */
|
|
587
|
+
model?: string;
|
|
588
|
+
/** Additional vendor-specific parameters. Explicit options take precedence. */
|
|
589
|
+
additionalParams?: Record<string, unknown>;
|
|
536
590
|
/** Skip patterns for bracketed content */
|
|
537
591
|
skipPatterns?: number[];
|
|
538
592
|
}
|
|
@@ -548,9 +602,9 @@ export interface SarvamTTSOptions {
|
|
|
548
602
|
* });
|
|
549
603
|
* ```
|
|
550
604
|
*/
|
|
551
|
-
export declare class SarvamTTS extends BaseTTS {
|
|
605
|
+
export declare class SarvamTTS<SR extends number = number> extends BaseTTS<SR> {
|
|
552
606
|
private readonly options;
|
|
553
|
-
constructor(options: SarvamTTSOptions);
|
|
607
|
+
constructor(options: SarvamTTSOptions<SR>);
|
|
554
608
|
toConfig(): TtsConfig;
|
|
555
609
|
}
|
|
556
610
|
/**
|