agora-agents 2.11.0 → 2.13.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/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 +10 -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 +6 -5
- package/dist/cjs/agentkit/token.js +7 -6
- package/dist/cjs/agentkit/types.d.ts +12 -3
- package/dist/cjs/agentkit/vendors/avatar.d.ts +30 -0
- package/dist/cjs/agentkit/vendors/avatar.js +63 -3
- 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 +11 -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 +6 -5
- package/dist/esm/agentkit/token.mjs +7 -6
- package/dist/esm/agentkit/types.d.mts +12 -3
- package/dist/esm/agentkit/vendors/avatar.d.mts +30 -0
- package/dist/esm/agentkit/vendors/avatar.mjs +59 -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/index.d.mts +4 -4
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -3,8 +3,8 @@
|
|
|
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>`.
|
|
8
8
|
*
|
|
9
9
|
* The `agora-token` library handles the JWT signing.
|
|
10
10
|
*/
|
|
@@ -86,11 +86,12 @@ export interface GenerateConvoAITokenOptions {
|
|
|
86
86
|
privilegeExpire?: number;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Builds a
|
|
89
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
90
90
|
*
|
|
91
91
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
92
92
|
*
|
|
93
|
-
* Uses `
|
|
94
|
-
*
|
|
93
|
+
* Uses `ConvoAITokenBuilder.buildToken`, which adds the ConvoAI service marker
|
|
94
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
95
|
+
* privileges in a single AccessToken2 token.
|
|
95
96
|
*/
|
|
96
97
|
export declare function generateConvoAIToken(opts: GenerateConvoAITokenOptions): string;
|
|
@@ -3,8 +3,8 @@
|
|
|
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>`.
|
|
8
8
|
*
|
|
9
9
|
* The `agora-token` library handles the JWT signing.
|
|
10
10
|
*/
|
|
@@ -128,12 +128,13 @@ export function generateRtcTokenWithAccount(opts) {
|
|
|
128
128
|
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
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
* Builds a
|
|
131
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
132
132
|
*
|
|
133
133
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
134
134
|
*
|
|
135
|
-
* Uses `
|
|
136
|
-
*
|
|
135
|
+
* Uses `ConvoAITokenBuilder.buildToken`, which adds the ConvoAI service marker
|
|
136
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
137
|
+
* privileges in a single AccessToken2 token.
|
|
137
138
|
*/
|
|
138
139
|
export function generateConvoAIToken(opts) {
|
|
139
140
|
var _a, _b;
|
|
@@ -143,7 +144,7 @@ export function generateConvoAIToken(opts) {
|
|
|
143
144
|
const configuredPrivilegeExpire = (_b = opts.privilegeExpire) !== null && _b !== void 0 ? _b : 0;
|
|
144
145
|
const privilegeExpire = configuredPrivilegeExpire === 0 ? tokenExpire : configuredPrivilegeExpire;
|
|
145
146
|
const account = _uidToAccount(opts.uid);
|
|
146
|
-
return _requireBuiltToken(agoraToken.
|
|
147
|
+
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
148
|
}
|
|
148
149
|
function _uidToAccount(uid) {
|
|
149
150
|
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.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,3 +234,27 @@ export declare class GenericAvatar extends BaseAvatar<number> {
|
|
|
228
234
|
constructor(options: GenericAvatarOptions);
|
|
229
235
|
toConfig(): AvatarConfig;
|
|
230
236
|
}
|
|
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,3 +248,48 @@ export class GenericAvatar extends BaseAvatar {
|
|
|
236
248
|
};
|
|
237
249
|
}
|
|
238
250
|
}
|
|
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
|
/**
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe TTS (Text-to-Speech) vendor classes.
|
|
3
3
|
*/
|
|
4
|
+
import { SarvamTtsParams as SarvamTtsParamsNS } from "../../api/types/SarvamTtsParams.mjs";
|
|
4
5
|
import { CredentialMode } from "../constants.mjs";
|
|
5
6
|
import { MiniMaxPresetModels, OpenAITtsPresetModels, } from "../presets.mjs";
|
|
6
7
|
import { BaseTTS } from "./base.mjs";
|
|
8
|
+
/** Gemini 3.8 Flash TTS model. */
|
|
9
|
+
export const GeminiTTSModels = {
|
|
10
|
+
Flash38: "gemini-3.8-flash-tts",
|
|
11
|
+
};
|
|
12
|
+
/** Gemini TTS uses the client's configured regional production endpoint. */
|
|
13
|
+
export class GeminiTTS extends BaseTTS {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super();
|
|
16
|
+
for (const field of ["apiKey", "model", "voice"]) {
|
|
17
|
+
const value = options[field];
|
|
18
|
+
if ((field === "apiKey" || value !== undefined) && (typeof value !== "string" || !value.trim())) {
|
|
19
|
+
throw new Error(`GeminiTTS requires ${field}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (options.style !== undefined && typeof options.style !== "string") {
|
|
23
|
+
throw new Error("GeminiTTS style must be a string");
|
|
24
|
+
}
|
|
25
|
+
this.options = Object.assign({}, options);
|
|
26
|
+
}
|
|
27
|
+
toConfig() {
|
|
28
|
+
const { apiKey, model = GeminiTTSModels.Flash38, voice = "Puck", style, additionalParams, skipPatterns, } = this.options;
|
|
29
|
+
return Object.assign({ vendor: "gemini", params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, model,
|
|
30
|
+
voice }), (style !== undefined && { style })) }, (skipPatterns !== undefined && { skip_patterns: skipPatterns }));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
7
33
|
function requireString(value, field, vendor) {
|
|
8
34
|
if (typeof value !== "string" || value.length === 0) {
|
|
9
35
|
throw new Error(`${vendor} requires ${field}`);
|
|
@@ -114,6 +140,7 @@ export class OpenAITTS extends BaseTTS {
|
|
|
114
140
|
* const tts = new CartesiaTTS({
|
|
115
141
|
* apiKey: process.env.CARTESIA_API_KEY,
|
|
116
142
|
* voiceId: 'voice-id-here',
|
|
143
|
+
* modelId: 'sonic-2',
|
|
117
144
|
* sampleRate: 24000,
|
|
118
145
|
* });
|
|
119
146
|
* ```
|
|
@@ -121,11 +148,21 @@ export class OpenAITTS extends BaseTTS {
|
|
|
121
148
|
export class CartesiaTTS extends BaseTTS {
|
|
122
149
|
constructor(options) {
|
|
123
150
|
super();
|
|
151
|
+
if (options.credentialMode !== undefined &&
|
|
152
|
+
options.credentialMode !== CredentialMode.Managed &&
|
|
153
|
+
options.credentialMode !== CredentialMode.Byok) {
|
|
154
|
+
throw new Error("CartesiaTTS credentialMode must be one of: managed, byok");
|
|
155
|
+
}
|
|
156
|
+
if (options.credentialMode !== CredentialMode.Managed) {
|
|
157
|
+
requireString(options.apiKey, "apiKey", "CartesiaTTS");
|
|
158
|
+
}
|
|
159
|
+
requireString(options.voiceId, "voiceId", "CartesiaTTS");
|
|
160
|
+
requireString(options.modelId, "modelId", "CartesiaTTS");
|
|
124
161
|
this.options = options;
|
|
125
162
|
}
|
|
126
163
|
toConfig() {
|
|
127
|
-
const { apiKey, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
|
|
128
|
-
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 }));
|
|
164
|
+
const { apiKey, credentialMode, voiceId, modelId, baseUrl, language, sampleRate, skipPatterns } = this.options;
|
|
165
|
+
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 }));
|
|
129
166
|
}
|
|
130
167
|
}
|
|
131
168
|
/**
|
|
@@ -307,15 +344,21 @@ export class RimeTTS extends BaseTTS {
|
|
|
307
344
|
export class FishAudioTTS extends BaseTTS {
|
|
308
345
|
constructor(options) {
|
|
309
346
|
super();
|
|
347
|
+
if (options.credentialMode !== undefined &&
|
|
348
|
+
options.credentialMode !== CredentialMode.Managed &&
|
|
349
|
+
options.credentialMode !== CredentialMode.Byok) {
|
|
350
|
+
throw new Error("FishAudioTTS credentialMode must be one of: managed, byok");
|
|
351
|
+
}
|
|
352
|
+
if (options.credentialMode !== CredentialMode.Managed) {
|
|
353
|
+
requireString(options.key, "key", "FishAudioTTS");
|
|
354
|
+
}
|
|
355
|
+
requireString(options.referenceId, "referenceId", "FishAudioTTS");
|
|
356
|
+
requireString(options.backend, "backend", "FishAudioTTS");
|
|
310
357
|
this.options = options;
|
|
311
358
|
}
|
|
312
359
|
toConfig() {
|
|
313
|
-
const { key, referenceId, backend, skipPatterns } = this.options;
|
|
314
|
-
return Object.assign({ vendor: "fishaudio", params: {
|
|
315
|
-
api_key: key,
|
|
316
|
-
reference_id: referenceId,
|
|
317
|
-
backend,
|
|
318
|
-
} }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
360
|
+
const { key, credentialMode, referenceId, backend, skipPatterns } = this.options;
|
|
361
|
+
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 }));
|
|
319
362
|
}
|
|
320
363
|
}
|
|
321
364
|
/**
|
|
@@ -351,6 +394,10 @@ export class MiniMaxTTS extends BaseTTS {
|
|
|
351
394
|
return Object.assign(Object.assign({ vendor: "minimax", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (key && { key })), (key && groupId && { group_id: groupId })), (key && { model })), (voiceId && { voice_setting: { voice_id: voiceId } })), (key && url && { url })) }, (!key && { _minimaxPresetModel: model })), (skipPatterns && { skip_patterns: skipPatterns }));
|
|
352
395
|
}
|
|
353
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Constructor options for Sarvam TTS (Beta).
|
|
399
|
+
*/
|
|
400
|
+
export const SarvamTTSLanguage = SarvamTtsParamsNS.TargetLanguageCode;
|
|
354
401
|
/**
|
|
355
402
|
* Sarvam TTS vendor (Beta).
|
|
356
403
|
*
|
|
@@ -369,8 +416,9 @@ export class SarvamTTS extends BaseTTS {
|
|
|
369
416
|
this.options = options;
|
|
370
417
|
}
|
|
371
418
|
toConfig() {
|
|
372
|
-
const { key, speaker, targetLanguageCode, pitch, pace, loudness, sampleRate, skipPatterns } = this.options;
|
|
373
|
-
|
|
419
|
+
const { key, speaker, targetLanguageCode, pitch, pace, loudness, speechSampleRate, sampleRate, enablePreprocessing, model, additionalParams, skipPatterns, } = this.options;
|
|
420
|
+
const resolvedSampleRate = speechSampleRate !== null && speechSampleRate !== void 0 ? speechSampleRate : sampleRate;
|
|
421
|
+
return Object.assign({ vendor: "sarvam", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, 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 }));
|
|
374
422
|
}
|
|
375
423
|
}
|
|
376
424
|
/**
|
|
@@ -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
|
*
|