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
|
@@ -711,9 +711,8 @@ export class Agent {
|
|
|
711
711
|
else {
|
|
712
712
|
// opts is narrowed to the appId/appCertificate branch here
|
|
713
713
|
const { appId, appCertificate, expiresIn } = opts;
|
|
714
|
-
//
|
|
715
|
-
//
|
|
716
|
-
// works for both numeric and string UIDs.
|
|
714
|
+
// Build the ConvoAI-specific Token007 with RTC, RTM, and ConvoAI
|
|
715
|
+
// services. The account string works for numeric UIDs.
|
|
717
716
|
token = generateConvoAIToken({
|
|
718
717
|
appId,
|
|
719
718
|
appCertificate,
|
|
@@ -841,11 +840,14 @@ export class Agent {
|
|
|
841
840
|
return newAgent;
|
|
842
841
|
}
|
|
843
842
|
_resolvePlatformAsrConfig() {
|
|
844
|
-
var _a, _b, _c, _d;
|
|
843
|
+
var _a, _b, _c, _d, _e;
|
|
845
844
|
const config = this._stt ? Object.assign({}, this._stt) : { vendor: this._client.area === Area.CN ? "fengming" : "ares" };
|
|
846
|
-
const params = config.params;
|
|
847
|
-
|
|
848
|
-
|
|
845
|
+
const params = Object.assign({}, config.params);
|
|
846
|
+
if (["assemblyai", "google", "microsoft", "sarvam", "speechmatics"].includes(config.vendor)) {
|
|
847
|
+
(_a = params.language) !== null && _a !== void 0 ? _a : (params.language = config.language);
|
|
848
|
+
}
|
|
849
|
+
const language = (_e = (_d = (_c = (_b = this._turnDetection) === null || _b === void 0 ? void 0 : _b.language) !== null && _c !== void 0 ? _c : config.language) !== null && _d !== void 0 ? _d : params === null || params === void 0 ? void 0 : params.language) !== null && _e !== void 0 ? _e : (["ares", "fengming"].includes(config.vendor) ? DEFAULT_TURN_DETECTION_LANGUAGE : undefined);
|
|
850
|
+
return Object.assign(Object.assign(Object.assign({}, config), { params }), (typeof language === "string" ? { language } : {}));
|
|
849
851
|
}
|
|
850
852
|
_resolveAsrConfig(turnDetectionConfig) {
|
|
851
853
|
const asrConfig = this._stt !== undefined
|
|
@@ -861,6 +863,14 @@ export class Agent {
|
|
|
861
863
|
delete params.language_codes;
|
|
862
864
|
asrConfig.params = params;
|
|
863
865
|
}
|
|
866
|
+
if (asrConfig.vendor === "deepgram" && asrConfig.params !== undefined) {
|
|
867
|
+
const params = Object.assign({}, asrConfig.params);
|
|
868
|
+
if (params.api_key === undefined && params.key !== undefined) {
|
|
869
|
+
params.api_key = params.key;
|
|
870
|
+
}
|
|
871
|
+
delete params.key;
|
|
872
|
+
asrConfig.params = params;
|
|
873
|
+
}
|
|
864
874
|
// Turn detection is the single source of truth for the top-level
|
|
865
875
|
// interaction language. Provider-specific languages remain in params.
|
|
866
876
|
asrConfig.language = turnDetectionConfig.language;
|
|
@@ -292,9 +292,13 @@ export class AgentSession {
|
|
|
292
292
|
}
|
|
293
293
|
// Validate TTS sample rate against avatar requirements
|
|
294
294
|
// Note: tts can be a string (shorthand) or an object with params
|
|
295
|
-
//
|
|
295
|
+
// Sample-rate fields vary by provider, so check the generated wire names dynamically.
|
|
296
296
|
const ttsParams = tts && typeof tts !== "string" ? tts.params : undefined;
|
|
297
|
-
const sampleRate = ttsParams && "sample_rate" in ttsParams
|
|
297
|
+
const sampleRate = ttsParams && "sample_rate" in ttsParams
|
|
298
|
+
? ttsParams.sample_rate
|
|
299
|
+
: ttsParams && "speech_sample_rate" in ttsParams
|
|
300
|
+
? ttsParams.speech_sample_rate
|
|
301
|
+
: undefined;
|
|
298
302
|
if (typeof sampleRate === "number") {
|
|
299
303
|
if (isHeyGenAvatar(strictAvatar) || isLiveAvatarAvatar(strictAvatar) || isAkoolAvatar(strictAvatar)) {
|
|
300
304
|
validateTtsSampleRate(strictAvatar, sampleRate);
|
|
@@ -77,6 +77,12 @@ export interface AnamAvatarConfig {
|
|
|
77
77
|
api_key: string;
|
|
78
78
|
/** Anam avatar ID (optional) */
|
|
79
79
|
avatar_id?: string;
|
|
80
|
+
/** Anam avatar model, such as `cara_mk4` for Cara 4 portrait mode */
|
|
81
|
+
avatar_model?: string;
|
|
82
|
+
/** Output video width in pixels; set together with `video_height` */
|
|
83
|
+
video_width?: number;
|
|
84
|
+
/** Output video height in pixels; set together with `video_width` */
|
|
85
|
+
video_height?: number;
|
|
80
86
|
[key: string]: unknown;
|
|
81
87
|
};
|
|
82
88
|
}
|
|
@@ -31,13 +31,11 @@ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPre
|
|
|
31
31
|
export { AgentPresets, normalizePresetInput } from "./presets.mjs";
|
|
32
32
|
export type { PreviewFeature, PreviewRoute } from "./preview/client.mjs";
|
|
33
33
|
export { createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./preview/client.mjs";
|
|
34
|
-
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "./preview/gemini-tts.mjs";
|
|
35
|
-
export { GeminiTTS, GeminiTTSModels } from "./preview/gemini-tts.mjs";
|
|
36
34
|
export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.mjs";
|
|
37
35
|
export { UnsupportedSessionOperationError } from "./session-backend.mjs";
|
|
38
36
|
export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.mjs";
|
|
39
37
|
export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.mjs";
|
|
40
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CallOptions, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, LlmTool, LlmToolExecution, LlmToolFunction, LlmToolServer, McpServer, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SmallestAiAsr, SmallestAiAsrParams, SmallestAiTts, SmallestAiTtsParams, SpatiusAvatarParams, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTts, TypecastTtsParams, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } from "./types.mjs";
|
|
38
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CallOptions, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, LlmTool, LlmToolExecution, LlmToolFunction, LlmToolServer, McpServer, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, RtzrAsr, RtzrAsrParams, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SmallestAiAsr, SmallestAiAsrParams, SmallestAiTts, SmallestAiTtsParams, SpatiusAvatarParams, SpeakConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTts, TypecastTtsParams, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } from "./types.mjs";
|
|
41
39
|
export type { AssignNumberOptions, DeployOptions, SaveOptions, SecretRef, VariableDefinition } from "./v3.mjs";
|
|
42
40
|
export { DeployedAgent, NumberNotFoundError, SavedAgent, SecretRefNotSupportedError, secretRef, UnsupportedFieldError, } from "./v3.mjs";
|
|
43
41
|
export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LemonSliceOptions, LiveAvatarAvatarOptions, ProtofaceOptions, TavusOptions, } from "./vendors/avatar.mjs";
|
|
@@ -50,7 +48,7 @@ export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, Custom
|
|
|
50
48
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
|
|
51
49
|
export type { AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, GeminiLiveModel, GeminiLiveOptions, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, OpenAIRealtimeOptions, QwenOmniOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
|
|
52
50
|
export { AzureOpenAIRealtime, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
53
|
-
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.mjs";
|
|
54
|
-
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
55
|
-
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MistralTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, SmallestAITTSOptions, TypecastTTSOptions, XAiTTSOptions, } from "./vendors/tts.mjs";
|
|
56
|
-
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
51
|
+
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, RTZRSTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.mjs";
|
|
52
|
+
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
53
|
+
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MistralTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, SmallestAITTSOptions, TypecastTTSOptions, XAiTTSOptions, } from "./vendors/tts.mjs";
|
|
54
|
+
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SarvamTTSLanguage, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
@@ -27,7 +27,6 @@ export { AudioScenario, CredentialMode, DataChannel, FillerWordsSelectionRule, G
|
|
|
27
27
|
export { REDACTED, redactHeadersForDebug, redactSecrets } from "./debug.mjs";
|
|
28
28
|
export { AgentPresets, normalizePresetInput } from "./presets.mjs";
|
|
29
29
|
export { createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./preview/client.mjs";
|
|
30
|
-
export { GeminiTTS, GeminiTTSModels } from "./preview/gemini-tts.mjs";
|
|
31
30
|
export { UnsupportedSessionOperationError } from "./session-backend.mjs";
|
|
32
31
|
// Token generation
|
|
33
32
|
export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.mjs";
|
|
@@ -42,6 +41,6 @@ export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, O
|
|
|
42
41
|
// MLLM vendor classes
|
|
43
42
|
export { AzureOpenAIRealtime, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.mjs";
|
|
44
43
|
// STT vendor classes
|
|
45
|
-
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
44
|
+
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.mjs";
|
|
46
45
|
// TTS vendor classes
|
|
47
|
-
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
46
|
+
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SarvamTTSLanguage, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.mjs";
|
|
@@ -84,10 +84,10 @@ function omitUndefinedKeys(value) {
|
|
|
84
84
|
return Object.keys(next).length > 0 ? next : undefined;
|
|
85
85
|
}
|
|
86
86
|
export function inferAsrPreset(asr) {
|
|
87
|
-
var _a, _b, _c;
|
|
88
|
-
if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.key))
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.api_key) || ((_b = asr.params) === null || _b === void 0 ? void 0 : _b.key))
|
|
89
89
|
return undefined;
|
|
90
|
-
const preset = deepgramModelToPreset[(
|
|
90
|
+
const preset = deepgramModelToPreset[(_d = normalizeModelName((_c = asr.params) === null || _c === void 0 ? void 0 : _c.model)) !== null && _d !== void 0 ? _d : ""];
|
|
91
91
|
if (!preset)
|
|
92
92
|
return undefined;
|
|
93
93
|
return {
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
8
8
|
* remain on the regional production endpoint.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Preview registrations are temporary. When a provider ships on the production
|
|
11
|
+
* gateway, remove its registration and move its class into the corresponding
|
|
12
|
+
* production vendor module, retaining historical imports as aliases.
|
|
13
13
|
*/
|
|
14
14
|
import type { AgoraClient } from "../../AgoraPoolClient.mjs";
|
|
15
15
|
import type * as Agora from "../../api/index.mjs";
|
|
@@ -31,7 +31,7 @@ export declare const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
31
31
|
* preview endpoint.
|
|
32
32
|
*/
|
|
33
33
|
export declare const PreviewFeatures: {
|
|
34
|
-
/**
|
|
34
|
+
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
35
35
|
readonly GeminiLive: "gemini-live";
|
|
36
36
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
37
37
|
readonly LiveModels: "live-models";
|
|
@@ -52,7 +52,8 @@ export interface PreviewRoute {
|
|
|
52
52
|
export declare function previewRequestHeaders(features: readonly PreviewFeature[], headers?: Record<string, string>): Record<string, string>;
|
|
53
53
|
/** Build generated resource clients for one preview session. */
|
|
54
54
|
export declare function createPreviewRoute(client: AgoraClient, features: readonly PreviewFeature[]): PreviewRoute;
|
|
55
|
-
|
|
55
|
+
/** Compatibility helper; all formerly registered providers now use production. */
|
|
56
|
+
export declare function requiredPreviewFeatures(_properties: Agora.StartAgentsRequest.Properties): PreviewFeature[];
|
|
56
57
|
/**
|
|
57
58
|
* Normalizes the historical Gemini preview greeting field for production.
|
|
58
59
|
* Kept under its old name so callers importing this compatibility helper do
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
8
8
|
* remain on the regional production endpoint.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Preview registrations are temporary. When a provider ships on the production
|
|
11
|
+
* gateway, remove its registration and move its class into the corresponding
|
|
12
|
+
* production vendor module, retaining historical imports as aliases.
|
|
13
13
|
*/
|
|
14
14
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
15
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -38,7 +38,7 @@ export const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
38
38
|
* preview endpoint.
|
|
39
39
|
*/
|
|
40
40
|
export const PreviewFeatures = {
|
|
41
|
-
/**
|
|
41
|
+
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
42
42
|
GeminiLive: "gemini-live",
|
|
43
43
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
44
44
|
LiveModels: "live-models",
|
|
@@ -67,9 +67,9 @@ export function createPreviewRoute(client, features) {
|
|
|
67
67
|
features: [...features],
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
70
|
+
/** Compatibility helper; all formerly registered providers now use production. */
|
|
71
|
+
export function requiredPreviewFeatures(_properties) {
|
|
72
|
+
return [];
|
|
73
73
|
}
|
|
74
74
|
const PRODUCTION_GEMINI_MLLM_MODELS = new Set([
|
|
75
75
|
"models/gemini-3.8-live",
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
readonly Flash38: "gemini-3.8-flash-tts";
|
|
5
|
-
};
|
|
6
|
-
export type GeminiTTSModel = (typeof GeminiTTSModels)[keyof typeof GeminiTTSModels] | (string & {});
|
|
7
|
-
export interface GeminiTTSOptions {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
/** Sent verbatim; defaults to Gemini 3.8 Flash TTS. */
|
|
10
|
-
model?: GeminiTTSModel;
|
|
11
|
-
/** Defaults to Puck. */
|
|
12
|
-
voice?: string;
|
|
13
|
-
/** Natural-language speaking instructions. Omitted unless supplied. */
|
|
14
|
-
style?: string;
|
|
15
|
-
}
|
|
16
|
-
/** Preview wire shape, kept separate from the generated production schema. */
|
|
17
|
-
export interface GeminiTTSConfig {
|
|
18
|
-
vendor: "gemini";
|
|
19
|
-
params: {
|
|
20
|
-
api_key: string;
|
|
21
|
-
model: string;
|
|
22
|
-
voice: string;
|
|
23
|
-
style?: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/** Preview-only TTS. AgentSession selects the gemini-live gate automatically. */
|
|
27
|
-
export declare class GeminiTTS extends BaseTTS {
|
|
28
|
-
private readonly options;
|
|
29
|
-
constructor(options: GeminiTTSOptions);
|
|
30
|
-
toConfig(): GeminiTTSConfig;
|
|
31
|
-
}
|
|
1
|
+
/** Legacy preview import aliases for the production Gemini TTS implementation. */
|
|
2
|
+
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "../vendors/tts.mjs";
|
|
3
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** Gemini 3.8 Flash TTS preview model. */
|
|
3
|
-
export const GeminiTTSModels = {
|
|
4
|
-
Flash38: "gemini-3.8-flash-tts",
|
|
5
|
-
};
|
|
6
|
-
/** Preview-only TTS. AgentSession selects the gemini-live gate automatically. */
|
|
7
|
-
export class GeminiTTS extends BaseTTS {
|
|
8
|
-
constructor(options) {
|
|
9
|
-
super();
|
|
10
|
-
for (const field of ["apiKey", "model", "voice"]) {
|
|
11
|
-
const value = options[field];
|
|
12
|
-
if ((field === "apiKey" || value !== undefined) && (typeof value !== "string" || !value.trim())) {
|
|
13
|
-
throw new Error(`GeminiTTS requires ${field}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (options.style !== undefined && typeof options.style !== "string") {
|
|
17
|
-
throw new Error("GeminiTTS style must be a string");
|
|
18
|
-
}
|
|
19
|
-
this.options = Object.assign({}, options);
|
|
20
|
-
}
|
|
21
|
-
toConfig() {
|
|
22
|
-
const { apiKey, model = GeminiTTSModels.Flash38, voice = "Puck", style } = this.options;
|
|
23
|
-
return {
|
|
24
|
-
vendor: "gemini",
|
|
25
|
-
params: Object.assign({ api_key: apiKey, model, voice }, (style !== undefined && { style })),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.mjs";
|
|
@@ -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,10 +3,10 @@
|
|
|
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
|
-
* The `agora-token` library handles the
|
|
9
|
+
* The `agora-token` library handles the AccessToken2 signing.
|
|
10
10
|
*/
|
|
11
11
|
export declare const MAX_EXPIRY_SECONDS = 86400;
|
|
12
12
|
/**
|
|
@@ -79,18 +79,20 @@ export interface GenerateConvoAITokenOptions {
|
|
|
79
79
|
/** Seconds until the token expires (default: 86400) */
|
|
80
80
|
tokenExpire?: number;
|
|
81
81
|
/**
|
|
82
|
-
* Seconds until privileges expire. Defaults to
|
|
82
|
+
* Seconds until RTC privileges expire. Defaults to `tokenExpire`.
|
|
83
|
+
* RTM login retains the token lifetime; ConvoAI carries no privilege map.
|
|
83
84
|
* Per Agora docs, setting this to 0 would expire privileges immediately — the SDK
|
|
84
85
|
* always substitutes `tokenExpire` when this is 0 or omitted.
|
|
85
86
|
*/
|
|
86
87
|
privilegeExpire?: number;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
|
-
* Builds a
|
|
90
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
90
91
|
*
|
|
91
92
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
92
93
|
*
|
|
93
|
-
* Uses `
|
|
94
|
-
*
|
|
94
|
+
* Uses `ConvoAITokenBuilder.buildTokenWithPrivilege`, which adds the ConvoAI service marker
|
|
95
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
96
|
+
* privileges in a single AccessToken2 token.
|
|
95
97
|
*/
|
|
96
98
|
export declare function generateConvoAIToken(opts: GenerateConvoAITokenOptions): string;
|
|
@@ -3,10 +3,10 @@
|
|
|
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
|
-
* The `agora-token` library handles the
|
|
9
|
+
* The `agora-token` library handles the AccessToken2 signing.
|
|
10
10
|
*/
|
|
11
11
|
import agoraToken from "agora-token";
|
|
12
12
|
const DEFAULT_EXPIRY_SECONDS = 86400;
|
|
@@ -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.buildTokenWithPrivilege`, 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.buildTokenWithPrivilege(opts.appId, opts.appCertificate, opts.channelName, account, agoraToken.RtcRole.PUBLISHER, tokenExpire, privilegeExpire, privilegeExpire, privilegeExpire, privilegeExpire, account, tokenExpire), 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.
|
|
@@ -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/esm/agentkit/v3.mjs
CHANGED
|
@@ -89,7 +89,7 @@ const moved = [
|
|
|
89
89
|
"turn_detection",
|
|
90
90
|
];
|
|
91
91
|
export function toV3Module(config, kind, errors = []) {
|
|
92
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
93
93
|
const c = Object.assign({}, config), params = Object.assign({}, c.params);
|
|
94
94
|
const path = `pipeline.${kind}`;
|
|
95
95
|
if (kind === "avatar" && c.vendor === "heygen")
|
|
@@ -100,20 +100,26 @@ export function toV3Module(config, kind, errors = []) {
|
|
|
100
100
|
}
|
|
101
101
|
if (kind === "asr") {
|
|
102
102
|
(_a = c.language) !== null && _a !== void 0 ? _a : (c.language = (_b = params.language) !== null && _b !== void 0 ? _b : (c.vendor === "ares" ? "en-US" : undefined));
|
|
103
|
-
|
|
103
|
+
if (["assemblyai", "google", "microsoft", "sarvam", "speechmatics"].includes(c.vendor)) {
|
|
104
|
+
// These providers require their own language in addition to the interaction language.
|
|
105
|
+
(_c = params.language) !== null && _c !== void 0 ? _c : (params.language = c.language);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
delete params.language;
|
|
109
|
+
}
|
|
104
110
|
}
|
|
105
111
|
if (kind === "llm" && (c.vendor === "gemini" || c.style === "gemini") && c.url) {
|
|
106
112
|
// Legacy Gemini uses a query key; Platform credentials must never live in URLs.
|
|
107
113
|
const url = new URL(c.url);
|
|
108
114
|
const key = url.searchParams.get("key");
|
|
109
115
|
if (key !== null) {
|
|
110
|
-
(
|
|
116
|
+
(_d = c.api_key) !== null && _d !== void 0 ? _d : (c.api_key = key);
|
|
111
117
|
url.searchParams.delete("key");
|
|
112
118
|
c.url = url.toString();
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
if (kind === "llm" && c.style === "bedrock") {
|
|
116
|
-
(
|
|
122
|
+
(_e = c.vendor) !== null && _e !== void 0 ? _e : (c.vendor = "amazon");
|
|
117
123
|
for (const key of ["access_key", "secret_key", "region"]) {
|
|
118
124
|
if (c[key] !== undefined) {
|
|
119
125
|
if (params[key] !== undefined && params[key] !== c[key])
|
|
@@ -210,7 +216,7 @@ export function toV3Module(config, kind, errors = []) {
|
|
|
210
216
|
: undefined;
|
|
211
217
|
const url = kind === "avatar"
|
|
212
218
|
? undefined
|
|
213
|
-
: ((
|
|
219
|
+
: ((_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);
|
|
214
220
|
if (kind !== "avatar") {
|
|
215
221
|
delete params.url;
|
|
216
222
|
delete params.base_url;
|
|
@@ -222,7 +228,7 @@ export function toV3Module(config, kind, errors = []) {
|
|
|
222
228
|
if (url !== undefined)
|
|
223
229
|
result.url = url;
|
|
224
230
|
if ((kind === "llm" || kind === "asr") && params.model !== undefined) {
|
|
225
|
-
result.model = (
|
|
231
|
+
result.model = (_k = c.model) !== null && _k !== void 0 ? _k : params.model;
|
|
226
232
|
delete params.model;
|
|
227
233
|
}
|
|
228
234
|
if (kind === "tts" && c._minimaxPresetModel !== undefined)
|
|
@@ -230,7 +236,7 @@ export function toV3Module(config, kind, errors = []) {
|
|
|
230
236
|
if (kind === "avatar") {
|
|
231
237
|
if (!["akool", "liveavatar", "anam", "generic", "sensetime", "spatius"].includes(c.vendor))
|
|
232
238
|
errors.push(`${path}.vendor`);
|
|
233
|
-
result.enabled = (
|
|
239
|
+
result.enabled = (_l = c.enable) !== null && _l !== void 0 ? _l : true;
|
|
234
240
|
}
|
|
235
241
|
else if (c.enable === false)
|
|
236
242
|
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 */
|
|
@@ -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
|
}
|
|
@@ -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
|
*/
|