agora-agents 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/agentkit/Agent.d.ts +6 -4
- package/dist/cjs/agentkit/Agent.js +89 -29
- package/dist/cjs/agentkit/AgentSession.js +1 -5
- package/dist/cjs/agentkit/index.d.ts +9 -9
- package/dist/cjs/agentkit/index.js +8 -4
- package/dist/cjs/agentkit/preview/client.d.ts +10 -3
- package/dist/cjs/agentkit/preview/client.js +22 -13
- package/dist/cjs/agentkit/preview/index.d.ts +2 -2
- package/dist/cjs/agentkit/preview/index.js +3 -1
- package/dist/cjs/agentkit/preview/vendors.d.ts +2 -2
- package/dist/cjs/agentkit/preview/vendors.js +3 -1
- package/dist/cjs/agentkit/types.d.ts +51 -6
- package/dist/cjs/agentkit/vendors/cn.d.ts +12 -0
- package/dist/cjs/agentkit/vendors/cn.js +16 -1
- package/dist/cjs/agentkit/vendors/mllm.d.ts +56 -4
- package/dist/cjs/agentkit/vendors/mllm.js +62 -7
- package/dist/cjs/agentkit/vendors/stt.d.ts +24 -0
- package/dist/cjs/agentkit/vendors/stt.js +31 -1
- package/dist/cjs/agentkit/vendors/tts.d.ts +0 -38
- package/dist/cjs/agentkit/vendors/tts.js +1 -24
- package/dist/cjs/api/types/Asr.d.ts +10 -1
- package/dist/cjs/api/types/ElevenLabsAsr.d.ts +10 -0
- package/dist/cjs/api/types/ElevenLabsAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/ElevenLabsAsrParams.js +3 -0
- package/dist/cjs/api/types/FishAudioAsr.d.ts +10 -0
- package/dist/cjs/api/types/FishAudioAsr.js +3 -0
- package/dist/cjs/api/types/FishAudioAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/FishAudioAsrParams.js +3 -0
- package/dist/cjs/api/types/QwenAsr.d.ts +10 -0
- package/dist/cjs/api/types/QwenAsr.js +3 -0
- package/dist/cjs/api/types/QwenAsrParams.d.ts +9 -0
- package/dist/cjs/api/types/QwenAsrParams.js +3 -0
- package/dist/cjs/api/types/Tts.d.ts +1 -4
- package/dist/cjs/api/types/index.d.ts +6 -2
- package/dist/cjs/api/types/index.js +6 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +9 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/agentkit/Agent.d.mts +6 -4
- package/dist/esm/agentkit/Agent.mjs +89 -29
- package/dist/esm/agentkit/AgentSession.mjs +1 -5
- package/dist/esm/agentkit/index.d.mts +9 -9
- package/dist/esm/agentkit/index.mjs +4 -4
- package/dist/esm/agentkit/preview/client.d.mts +10 -3
- package/dist/esm/agentkit/preview/client.mjs +22 -13
- package/dist/esm/agentkit/preview/index.d.mts +2 -2
- package/dist/esm/agentkit/preview/index.mjs +1 -1
- package/dist/esm/agentkit/preview/vendors.d.mts +2 -2
- package/dist/esm/agentkit/preview/vendors.mjs +1 -1
- package/dist/esm/agentkit/types.d.mts +51 -6
- package/dist/esm/agentkit/vendors/cn.d.mts +12 -0
- package/dist/esm/agentkit/vendors/cn.mjs +14 -0
- package/dist/esm/agentkit/vendors/mllm.d.mts +56 -4
- package/dist/esm/agentkit/vendors/mllm.mjs +60 -6
- package/dist/esm/agentkit/vendors/stt.d.mts +24 -0
- package/dist/esm/agentkit/vendors/stt.mjs +28 -0
- package/dist/esm/agentkit/vendors/tts.d.mts +0 -38
- package/dist/esm/agentkit/vendors/tts.mjs +0 -22
- package/dist/esm/api/types/Asr.d.mts +10 -1
- package/dist/esm/api/types/ElevenLabsAsr.d.mts +10 -0
- package/dist/esm/api/types/ElevenLabsAsrParams.d.mts +9 -0
- package/dist/esm/api/types/ElevenLabsAsrParams.mjs +2 -0
- package/dist/esm/api/types/FishAudioAsr.d.mts +10 -0
- package/dist/esm/api/types/FishAudioAsr.mjs +2 -0
- package/dist/esm/api/types/FishAudioAsrParams.d.mts +9 -0
- package/dist/esm/api/types/FishAudioAsrParams.mjs +2 -0
- package/dist/esm/api/types/QwenAsr.d.mts +10 -0
- package/dist/esm/api/types/QwenAsr.mjs +2 -0
- package/dist/esm/api/types/QwenAsrParams.d.mts +9 -0
- package/dist/esm/api/types/QwenAsrParams.mjs +2 -0
- package/dist/esm/api/types/Tts.d.mts +1 -4
- package/dist/esm/api/types/index.d.mts +6 -2
- package/dist/esm/api/types/index.mjs +6 -2
- package/dist/esm/index.d.mts +2 -2
- 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 +1 -1
- package/dist/cjs/api/types/HumeAiTts.d.ts +0 -9
- package/dist/cjs/api/types/HumeAiTtsParams.d.ts +0 -29
- package/dist/cjs/api/types/HumeAiTtsParams.js +0 -12
- package/dist/esm/api/types/HumeAiTts.d.mts +0 -9
- package/dist/esm/api/types/HumeAiTtsParams.d.mts +0 -29
- package/dist/esm/api/types/HumeAiTtsParams.mjs +0 -9
- /package/dist/cjs/api/types/{HumeAiTts.js → ElevenLabsAsr.js} +0 -0
- /package/dist/esm/api/types/{HumeAiTts.mjs → ElevenLabsAsr.mjs} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Clean type aliases for the Agora Conversational AI SDK.
|
|
3
3
|
* These provide shorter, more intuitive names for the verbose Fern-generated types.
|
|
4
4
|
*/
|
|
5
|
-
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GeminiAsrParams as GeminiAsrParamsType, GenericHttpTtsParams as GenericTtsParamsType, GenericHttpTts as GenericTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, GradiumTtsParams as GradiumTtsParamsType, GradiumTts as GradiumTtsType,
|
|
5
|
+
import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsAsrParams, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioAsrParams, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GeminiAsrParams as GeminiAsrParamsType, GenericHttpTtsParams as GenericTtsParamsType, GenericHttpTts as GenericTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, GradiumTtsParams as GradiumTtsParamsType, GradiumTts as GradiumTtsType, ListAgentsResponse, Llm, LlmToolExecution as LlmToolExecutionType, LlmToolFunction as LlmToolFunctionType, LlmToolServer as LlmToolServerType, LlmTool as LlmToolType, McpServer as McpServerType, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, MistralTtsParams as MistralTtsParamsType, MistralTts as MistralTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, QwenAsrParams, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, RtzrAsrParams as RtzrAsrParamsType, RtzrAsr as RtzrAsrType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SmallestAiAsrParams as SmallestAiAsrParamsType, SmallestAiAsr as SmallestAiAsrType, SmallestAiTtsParams as SmallestAiTtsParamsType, SmallestAiTts as SmallestAiTtsType, SpatiusAvatarParams as SpatiusAvatarParamsType, SpeakAgentsRequest, StartAgentsRequest, Tts, TypecastTtsParams as TypecastTtsParamsType, TypecastTts as TypecastTtsType, UpdateAgentsRequest, XAiAsrParams as XAiAsrParamsType, XAiAsr as XAiAsrType, XAiTtsParams as XAiTtsParamsType, XAiTts as XAiTtsType } from "../api/index.mjs";
|
|
6
6
|
import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs";
|
|
7
7
|
import type { PresetInput } from "./presets.mjs";
|
|
8
8
|
/** LLM request style (openai, gemini, anthropic, dify) */
|
|
@@ -13,6 +13,18 @@ export type LlmStyle = Llm.Style;
|
|
|
13
13
|
* When using shorthand strings or minimal configs, the untyped variant is available.
|
|
14
14
|
*/
|
|
15
15
|
export type SttConfig = {
|
|
16
|
+
vendor: "elevenlabs";
|
|
17
|
+
language?: TurnDetectionLanguage;
|
|
18
|
+
params: ElevenLabsAsrParams;
|
|
19
|
+
} | {
|
|
20
|
+
vendor: "fishaudio";
|
|
21
|
+
language?: TurnDetectionLanguage;
|
|
22
|
+
params: FishAudioAsrParams;
|
|
23
|
+
} | {
|
|
24
|
+
vendor: "qwen";
|
|
25
|
+
language?: TurnDetectionLanguage;
|
|
26
|
+
params: QwenAsrParams;
|
|
27
|
+
} | {
|
|
16
28
|
vendor: "fengming";
|
|
17
29
|
language?: TurnDetectionLanguage;
|
|
18
30
|
keywords?: string[];
|
|
@@ -107,10 +119,45 @@ export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
|
|
|
107
119
|
export type AvatarWireVendor = StartAgentsRequest.Properties.Avatar.Vendor;
|
|
108
120
|
/** BCP-47 language tag used by `turn_detection.language`. */
|
|
109
121
|
export type TurnDetectionLanguage = AsrLanguage;
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Languages supported by semantic end-of-speech detection
|
|
124
|
+
* (`turn_detection.config.end_of_speech.mode = "semantic"`): English and Chinese only.
|
|
125
|
+
*/
|
|
126
|
+
export type SemanticEndOfSpeechLanguage = Extract<TurnDetectionLanguage, `en-${string}` | `zh-${string}`>;
|
|
127
|
+
/**
|
|
128
|
+
* One language, or a non-empty list of languages for multi-language sessions.
|
|
129
|
+
* A list is sent to `asr.language` as a comma-separated string.
|
|
130
|
+
*/
|
|
131
|
+
export type TurnDetectionLanguages = TurnDetectionLanguage | readonly [TurnDetectionLanguage, ...TurnDetectionLanguage[]];
|
|
132
|
+
type TurnDetectionBase = Omit<StartAgentsRequest.Properties.TurnDetection, "language" | "config">;
|
|
133
|
+
type GeneratedEndOfSpeech = StartAgentsRequest.Properties.TurnDetection.Config.EndOfSpeech;
|
|
134
|
+
/** Semantic EoS: only one English or Chinese language. */
|
|
135
|
+
type SemanticTurnDetectionConfig = TurnDetectionBase & {
|
|
136
|
+
config: TurnDetectionNestedConfig & {
|
|
137
|
+
end_of_speech: GeneratedEndOfSpeech & {
|
|
138
|
+
mode: "semantic";
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
language?: SemanticEndOfSpeechLanguage;
|
|
113
142
|
};
|
|
143
|
+
/** VAD or manual EoS (or unset): one language or a list of languages. */
|
|
144
|
+
type NonSemanticTurnDetectionConfig = TurnDetectionBase & {
|
|
145
|
+
config?: TurnDetectionNestedConfig & {
|
|
146
|
+
end_of_speech?: Omit<GeneratedEndOfSpeech, "mode"> & {
|
|
147
|
+
mode?: Exclude<EndOfSpeechMode, "semantic">;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
language?: TurnDetectionLanguages;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Turn detection configuration.
|
|
154
|
+
*
|
|
155
|
+
* `language` takes one BCP-47 tag or a list of tags. A list cannot be used with
|
|
156
|
+
* semantic end-of-speech: TypeScript reports an error at compile time, and the
|
|
157
|
+
* SDK also throws at runtime. When a list has more than one language and
|
|
158
|
+
* `end_of_speech.mode` is unset, the SDK sends `end_of_speech.mode = "vad"`.
|
|
159
|
+
*/
|
|
160
|
+
export type TurnDetectionConfig = NonSemanticTurnDetectionConfig | SemanticTurnDetectionConfig;
|
|
114
161
|
/** Detailed nested config for turn detection (`turn_detection.config`) */
|
|
115
162
|
export type TurnDetectionNestedConfig = StartAgentsRequest.Properties.TurnDetection.Config;
|
|
116
163
|
/** Start of Speech (SoS) detection configuration (`turn_detection.config.start_of_speech`) */
|
|
@@ -585,8 +632,6 @@ export type CartesiaTts = CartesiaTtsType;
|
|
|
585
632
|
export type CartesiaTtsParams = CartesiaTtsParamsType;
|
|
586
633
|
export type OpenAiTts = OpenAiTtsType;
|
|
587
634
|
export type OpenAiTtsParams = OpenAiTtsParamsType;
|
|
588
|
-
export type HumeAiTts = HumeAiTtsType;
|
|
589
|
-
export type HumeAiTtsParams = HumeAiTtsParamsType;
|
|
590
635
|
export type RimeTts = RimeTtsType;
|
|
591
636
|
export type RimeTtsParams = RimeTtsParamsType;
|
|
592
637
|
export type FishAudioTts = FishAudioTtsType;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { MinimaxDuplexTtsParams } from "../../api/index.mjs";
|
|
2
2
|
import type { AvatarConfig, LlmConfig, SttConfig, TtsConfig } from "../types.mjs";
|
|
3
3
|
import { BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, type BaseLlmOptions } from "./base.mjs";
|
|
4
|
+
/** Constructor options for mainland China Qwen ASR. */
|
|
5
|
+
export interface QwenSTTOptions {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
8
|
+
additionalParams?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/** Qwen ASR for mainland China. */
|
|
11
|
+
export declare class QwenSTT extends BaseCNSTT {
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(options: QwenSTTOptions);
|
|
14
|
+
toConfig(): SttConfig;
|
|
15
|
+
}
|
|
4
16
|
export interface FengmingSTTOptions {
|
|
5
17
|
/** Hotwords that improve recognition accuracy */
|
|
6
18
|
keywords?: string[];
|
|
@@ -4,6 +4,20 @@ function requireString(value, field, vendor) {
|
|
|
4
4
|
throw new Error(`${vendor} requires ${field}`);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
/** Qwen ASR for mainland China. */
|
|
8
|
+
export class QwenSTT extends BaseCNSTT {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super();
|
|
11
|
+
this.options = options;
|
|
12
|
+
requireString(options.apiKey, "apiKey", "QwenSTT");
|
|
13
|
+
}
|
|
14
|
+
toConfig() {
|
|
15
|
+
return {
|
|
16
|
+
vendor: "qwen",
|
|
17
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
export class FengmingSTT extends BaseCNSTT {
|
|
8
22
|
constructor(options = {}) {
|
|
9
23
|
var _a;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Type-safe MLLM (Multimodal Large Language Model) vendor classes.
|
|
3
3
|
*
|
|
4
4
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
5
|
-
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)`
|
|
6
|
-
*
|
|
5
|
+
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` makes the start
|
|
6
|
+
* request send `advanced_features.enable_mllm: true`. `mllm.enable` is never
|
|
7
|
+
* sent, because its presence stops RTM `message.metrics` from being delivered.
|
|
7
8
|
*/
|
|
8
9
|
import type { MllmConfig, MllmTurnDetectionConfig } from "../types.mjs";
|
|
9
10
|
import { BaseCNMLLM, BaseMLLM, type BaseMllmOptions } from "./base.mjs";
|
|
@@ -12,7 +13,49 @@ export declare const GeminiLiveModels: {
|
|
|
12
13
|
readonly Live38: "models/gemini-3.8-live";
|
|
13
14
|
/** Public ID for the reasoning voice model. */
|
|
14
15
|
readonly Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking";
|
|
16
|
+
/** Gemini Live EAP voice model. Accepts `thinkingLevel`. */
|
|
17
|
+
readonly Live4: "gemini-4-live";
|
|
18
|
+
/** Gemini Live EAP translation model. Set `translateTo` to use it. */
|
|
19
|
+
readonly Live4Translate: "gemini-4-live-translate";
|
|
15
20
|
};
|
|
21
|
+
/** How the SDK treats one Gemini Live model ID. */
|
|
22
|
+
export interface GeminiLiveModelSpec {
|
|
23
|
+
/**
|
|
24
|
+
* Served only by the preview endpoint. `AgentSession` routes these sessions
|
|
25
|
+
* to the preview host with `agora-feature: gemini`. The start body is the
|
|
26
|
+
* same as the GA body.
|
|
27
|
+
*/
|
|
28
|
+
readonly preview: boolean;
|
|
29
|
+
/** Accepts `thinkingLevel`, sent as `params.thinking_level`. */
|
|
30
|
+
readonly extendedThinking?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** A row in {@link GEMINI_LIVE_MODEL_TABLE}: a model spec, or an alias of another row. */
|
|
33
|
+
export type GeminiLiveModelRow = GeminiLiveModelSpec | {
|
|
34
|
+
readonly aliasOf: string;
|
|
35
|
+
readonly deprecated?: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Every Gemini Live model that uses the Gemini 3.8 builder path, keyed by the
|
|
39
|
+
* model ID sent in `mllm.params.model`. This one table selects the builder
|
|
40
|
+
* path, the production greeting normalization, and preview routing.
|
|
41
|
+
*
|
|
42
|
+
* A renamed model can keep its old ID as `{ aliasOf: "<new name>", deprecated: true }`.
|
|
43
|
+
* An alias takes the target's spec, and the SDK sends the model ID the caller
|
|
44
|
+
* wrote unchanged.
|
|
45
|
+
*
|
|
46
|
+
* Models missing from this table use the legacy Gemini path and the production
|
|
47
|
+
* route.
|
|
48
|
+
*/
|
|
49
|
+
export declare const GEMINI_LIVE_MODEL_TABLE: Readonly<Record<string, GeminiLiveModelRow>>;
|
|
50
|
+
/**
|
|
51
|
+
* Looks up a model in a Gemini Live model table, following alias rows.
|
|
52
|
+
* Returns `undefined` for models missing from the table.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveGeminiLiveModel(model: string, table?: Readonly<Record<string, GeminiLiveModelRow>>): GeminiLiveModelSpec | undefined;
|
|
55
|
+
/** Gemini Live EAP models, served only by the preview endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
56
|
+
export declare const GEMINI_EAP_MLLM_MODELS: ReadonlySet<string>;
|
|
57
|
+
/** Gemini Live models served by the production endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
58
|
+
export declare const PRODUCTION_GEMINI_MLLM_MODELS: ReadonlySet<string>;
|
|
16
59
|
/** The model Gemini Live sends by default. */
|
|
17
60
|
export declare const GEMINI_MLLM_DEFAULT_MODEL: string;
|
|
18
61
|
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
@@ -25,7 +68,7 @@ export type GeminiLiveModel = (typeof GeminiLiveModels)[keyof typeof GeminiLiveM
|
|
|
25
68
|
export declare const GeminiThinkingLevels: readonly ["low", "medium", "high"];
|
|
26
69
|
export type GeminiThinkingLevel = (typeof GeminiThinkingLevels)[number];
|
|
27
70
|
/** Known Gemini output voices; future voice names remain accepted. */
|
|
28
|
-
export type GeminiLiveVoice = "Puck" | "Charon" | "Kore" | "Fenrir" | "Aoede" | "Leda" | "Orus" | "Zephyr" | (string & {});
|
|
71
|
+
export type GeminiLiveVoice = "Puck" | "Charon" | "Kore" | "Fenrir" | "Aoede" | "Leda" | "Orus" | "Zephyr" | "Fola" | (string & {});
|
|
29
72
|
/** @deprecated Use {@link GeminiLiveVoice}. */
|
|
30
73
|
export type GeminiPreviewVoice = GeminiLiveVoice;
|
|
31
74
|
export declare const OPENAI_GPT_LIVE_VENDOR: "openai_gpt_live";
|
|
@@ -200,10 +243,19 @@ export interface GeminiLiveOptions extends BaseMllmOptions {
|
|
|
200
243
|
apiKey: string;
|
|
201
244
|
/** Model name (e.g., 'gemini-live-2.5-flash') */
|
|
202
245
|
model?: GeminiLiveModel;
|
|
203
|
-
/** Sent only for models/gemini-3.8-live-extended-thinking. */
|
|
246
|
+
/** Sent only for models/gemini-3.8-live-extended-thinking and gemini-4-live. */
|
|
204
247
|
thinkingLevel?: GeminiThinkingLevel;
|
|
205
248
|
/** Languages for Gemini 3.8, sent as params.language_codes. */
|
|
206
249
|
languageCodes?: readonly string[];
|
|
250
|
+
/**
|
|
251
|
+
* Switches the session to speech translation, sent as params.translate_to
|
|
252
|
+
* whenever set. The Gemini Live EAP `gemini-4-live-translate` model uses it. Codes are a vendor allow-list that the SDK does not
|
|
253
|
+
* validate: `es` and `pt-BR` work, `es-ES` does not. A rejected code closes
|
|
254
|
+
* the session mid-stream with a 1007.
|
|
255
|
+
*/
|
|
256
|
+
translateTo?: string;
|
|
257
|
+
/** Sent as params.echo_target_language whenever set. Used with `translateTo`. */
|
|
258
|
+
echoTargetLanguage?: boolean;
|
|
207
259
|
/** Endpoint override; Gemini 3.8 defaults to the Developer API host. */
|
|
208
260
|
url?: string;
|
|
209
261
|
/** System instructions for the model */
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Type-safe MLLM (Multimodal Large Language Model) vendor classes.
|
|
3
3
|
*
|
|
4
4
|
* MLLM vendors handle real-time audio end-to-end, bypassing the standard
|
|
5
|
-
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)`
|
|
6
|
-
*
|
|
5
|
+
* ASR → LLM → TTS pipeline. Calling `agent.withMllm(vendor)` makes the start
|
|
6
|
+
* request send `advanced_features.enable_mllm: true`. `mllm.enable` is never
|
|
7
|
+
* sent, because its presence stops RTM `message.metrics` from being delivered.
|
|
7
8
|
*/
|
|
8
9
|
import { BaseCNMLLM, BaseMLLM } from "./base.mjs";
|
|
9
10
|
function requireString(value, field, vendor) {
|
|
@@ -24,7 +25,57 @@ export const GeminiLiveModels = {
|
|
|
24
25
|
Live38: "models/gemini-3.8-live",
|
|
25
26
|
/** Public ID for the reasoning voice model. */
|
|
26
27
|
Live38ExtendedThinking: "models/gemini-3.8-live-extended-thinking",
|
|
28
|
+
/** Gemini Live EAP voice model. Accepts `thinkingLevel`. */
|
|
29
|
+
Live4: "gemini-4-live",
|
|
30
|
+
/** Gemini Live EAP translation model. Set `translateTo` to use it. */
|
|
31
|
+
Live4Translate: "gemini-4-live-translate",
|
|
27
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Every Gemini Live model that uses the Gemini 3.8 builder path, keyed by the
|
|
35
|
+
* model ID sent in `mllm.params.model`. This one table selects the builder
|
|
36
|
+
* path, the production greeting normalization, and preview routing.
|
|
37
|
+
*
|
|
38
|
+
* A renamed model can keep its old ID as `{ aliasOf: "<new name>", deprecated: true }`.
|
|
39
|
+
* An alias takes the target's spec, and the SDK sends the model ID the caller
|
|
40
|
+
* wrote unchanged.
|
|
41
|
+
*
|
|
42
|
+
* Models missing from this table use the legacy Gemini path and the production
|
|
43
|
+
* route.
|
|
44
|
+
*/
|
|
45
|
+
export const GEMINI_LIVE_MODEL_TABLE = {
|
|
46
|
+
[GeminiLiveModels.Live38]: { preview: false },
|
|
47
|
+
[GeminiLiveModels.Live38ExtendedThinking]: { preview: false, extendedThinking: true },
|
|
48
|
+
[GeminiLiveModels.Live4]: { preview: true, extendedThinking: true },
|
|
49
|
+
[GeminiLiveModels.Live4Translate]: { preview: true },
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Looks up a model in a Gemini Live model table, following alias rows.
|
|
53
|
+
* Returns `undefined` for models missing from the table.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveGeminiLiveModel(model, table = GEMINI_LIVE_MODEL_TABLE) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
let id = model;
|
|
59
|
+
let row = (_a = Object.getOwnPropertyDescriptor(table, id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
60
|
+
while (row !== undefined && !seen.has(id)) {
|
|
61
|
+
if (!("aliasOf" in row))
|
|
62
|
+
return row;
|
|
63
|
+
seen.add(id);
|
|
64
|
+
id = row.aliasOf;
|
|
65
|
+
row = (_b = Object.getOwnPropertyDescriptor(table, id)) === null || _b === void 0 ? void 0 : _b.value;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
function geminiLiveModelsWhere(predicate) {
|
|
70
|
+
return new Set(Object.keys(GEMINI_LIVE_MODEL_TABLE).filter((model) => {
|
|
71
|
+
const spec = resolveGeminiLiveModel(model);
|
|
72
|
+
return spec !== undefined && predicate(spec);
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
/** Gemini Live EAP models, served only by the preview endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
76
|
+
export const GEMINI_EAP_MLLM_MODELS = geminiLiveModelsWhere((spec) => spec.preview);
|
|
77
|
+
/** Gemini Live models served by the production endpoint. Derived from {@link GEMINI_LIVE_MODEL_TABLE}. */
|
|
78
|
+
export const PRODUCTION_GEMINI_MLLM_MODELS = geminiLiveModelsWhere((spec) => !spec.preview);
|
|
28
79
|
/** The model Gemini Live sends by default. */
|
|
29
80
|
export const GEMINI_MLLM_DEFAULT_MODEL = GeminiLiveModels.Live38;
|
|
30
81
|
/** Default Gemini Developer API endpoint for Gemini 3.8 models. */
|
|
@@ -196,12 +247,15 @@ export class GeminiLive extends BaseMLLM {
|
|
|
196
247
|
toConfig() {
|
|
197
248
|
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
198
249
|
const selectedModel = (model === null || model === void 0 ? void 0 : model.trim()) || GEMINI_MLLM_DEFAULT_MODEL;
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
const
|
|
250
|
+
const spec = resolveGeminiLiveModel(selectedModel);
|
|
251
|
+
const isGemini38 = spec !== undefined;
|
|
252
|
+
const isExtendedThinking = (spec === null || spec === void 0 ? void 0 : spec.extendedThinking) === true;
|
|
253
|
+
const 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(Object.assign({}, additionalParams), { model: selectedModel }), (instructions && { instructions })), ((voice || isGemini38) && { voice: voice || "Puck" })), (isExtendedThinking &&
|
|
202
254
|
this.options.thinkingLevel !== undefined && {
|
|
203
255
|
thinking_level: this.options.thinkingLevel,
|
|
204
|
-
})), (isGemini38 && this.options.languageCodes && { language_codes: [...this.options.languageCodes] })), (
|
|
256
|
+
})), (isGemini38 && this.options.languageCodes && { language_codes: [...this.options.languageCodes] })), (this.options.translateTo && { translate_to: this.options.translateTo })), (this.options.echoTargetLanguage !== undefined && {
|
|
257
|
+
echo_target_language: this.options.echoTargetLanguage,
|
|
258
|
+
})), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions }));
|
|
205
259
|
if (isGemini38) {
|
|
206
260
|
delete params.api_key;
|
|
207
261
|
if (!isExtendedThinking)
|
|
@@ -4,6 +4,30 @@
|
|
|
4
4
|
import { type DeepgramPresetModel } from "../presets.mjs";
|
|
5
5
|
import type { SttConfig, TurnDetectionLanguage } from "../types.mjs";
|
|
6
6
|
import { BaseSTT, type SampleRate } from "./base.mjs";
|
|
7
|
+
/** Constructor options for global ElevenLabs ASR. */
|
|
8
|
+
export interface ElevenLabsSTTOptions {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
11
|
+
additionalParams?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/** ElevenLabs ASR for global deployments. */
|
|
14
|
+
export declare class ElevenLabsSTT extends BaseSTT {
|
|
15
|
+
private readonly options;
|
|
16
|
+
constructor(options: ElevenLabsSTTOptions);
|
|
17
|
+
toConfig(): SttConfig;
|
|
18
|
+
}
|
|
19
|
+
/** Constructor options for global Fish Audio ASR. */
|
|
20
|
+
export interface FishAudioSTTOptions {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
/** Additional provider parameters. Explicit options take precedence. */
|
|
23
|
+
additionalParams?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/** Fish Audio ASR for global deployments. */
|
|
26
|
+
export declare class FishAudioSTT extends BaseSTT {
|
|
27
|
+
private readonly options;
|
|
28
|
+
constructor(options: FishAudioSTTOptions);
|
|
29
|
+
toConfig(): SttConfig;
|
|
30
|
+
}
|
|
7
31
|
/** Gemini transcription models. */
|
|
8
32
|
export declare const GeminiSTTModels: {
|
|
9
33
|
readonly Transcribe35Live: "gemini-3.5-transcribe-live";
|
|
@@ -8,6 +8,34 @@ function _requireString(value, field, vendor) {
|
|
|
8
8
|
throw new Error(`${vendor} requires ${field}`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/** ElevenLabs ASR for global deployments. */
|
|
12
|
+
export class ElevenLabsSTT extends BaseSTT {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
super();
|
|
15
|
+
this.options = options;
|
|
16
|
+
_requireString(options.apiKey, "apiKey", "ElevenLabsSTT");
|
|
17
|
+
}
|
|
18
|
+
toConfig() {
|
|
19
|
+
return {
|
|
20
|
+
vendor: "elevenlabs",
|
|
21
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Fish Audio ASR for global deployments. */
|
|
26
|
+
export class FishAudioSTT extends BaseSTT {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super();
|
|
29
|
+
this.options = options;
|
|
30
|
+
_requireString(options.apiKey, "apiKey", "FishAudioSTT");
|
|
31
|
+
}
|
|
32
|
+
toConfig() {
|
|
33
|
+
return {
|
|
34
|
+
vendor: "fishaudio",
|
|
35
|
+
params: Object.assign(Object.assign({}, this.options.additionalParams), { api_key: this.options.apiKey }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
11
39
|
function isDeepgramManagedModel(model) {
|
|
12
40
|
return model !== undefined && DeepgramPresetModels.includes(model.trim().toLowerCase());
|
|
13
41
|
}
|
|
@@ -399,44 +399,6 @@ export declare class TypecastTTS extends BaseTTS {
|
|
|
399
399
|
constructor(options: TypecastTTSOptions);
|
|
400
400
|
toConfig(): TtsConfig;
|
|
401
401
|
}
|
|
402
|
-
/**
|
|
403
|
-
* Constructor options for Hume AI TTS.
|
|
404
|
-
*/
|
|
405
|
-
export interface HumeAITTSOptions {
|
|
406
|
-
/** Hume AI API key */
|
|
407
|
-
key: string;
|
|
408
|
-
/** Configuration ID */
|
|
409
|
-
configId?: string;
|
|
410
|
-
/** Hume AI voice ID */
|
|
411
|
-
voiceId: string;
|
|
412
|
-
/** Base URL for the Hume AI API */
|
|
413
|
-
baseUrl?: string;
|
|
414
|
-
/** Voice provider type */
|
|
415
|
-
provider: "HUME_AI" | "CUSTOM_VOICE";
|
|
416
|
-
/** Playback speed of the generated speech */
|
|
417
|
-
speed?: number;
|
|
418
|
-
/** Duration of silence in seconds to add at the end of each utterance */
|
|
419
|
-
trailingSilence?: number;
|
|
420
|
-
/** Skip patterns for bracketed content */
|
|
421
|
-
skipPatterns?: number[];
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Hume AI TTS vendor.
|
|
425
|
-
*
|
|
426
|
-
* @example
|
|
427
|
-
* ```typescript
|
|
428
|
-
* const tts = new HumeAITTS({
|
|
429
|
-
* key: process.env.HUME_API_KEY,
|
|
430
|
-
* voiceId: 'voice-id',
|
|
431
|
-
* provider: 'CUSTOM_VOICE',
|
|
432
|
-
* });
|
|
433
|
-
* ```
|
|
434
|
-
*/
|
|
435
|
-
export declare class HumeAITTS extends BaseTTS {
|
|
436
|
-
private readonly options;
|
|
437
|
-
constructor(options: HumeAITTSOptions);
|
|
438
|
-
toConfig(): TtsConfig;
|
|
439
|
-
}
|
|
440
402
|
/**
|
|
441
403
|
* Constructor options for Rime TTS.
|
|
442
404
|
*
|
|
@@ -277,28 +277,6 @@ export class TypecastTTS extends BaseTTS {
|
|
|
277
277
|
return Object.assign({ vendor: "typecast", params: Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, voice_id: voiceId, model }) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Hume AI TTS vendor.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* ```typescript
|
|
285
|
-
* const tts = new HumeAITTS({
|
|
286
|
-
* key: process.env.HUME_API_KEY,
|
|
287
|
-
* voiceId: 'voice-id',
|
|
288
|
-
* provider: 'CUSTOM_VOICE',
|
|
289
|
-
* });
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
export class HumeAITTS extends BaseTTS {
|
|
293
|
-
constructor(options) {
|
|
294
|
-
super();
|
|
295
|
-
this.options = options;
|
|
296
|
-
}
|
|
297
|
-
toConfig() {
|
|
298
|
-
const { key, configId, voiceId, baseUrl, provider, speed, trailingSilence, skipPatterns } = this.options;
|
|
299
|
-
return Object.assign({ vendor: "humeai", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ key, voice_id: voiceId }, (baseUrl && { base_url: baseUrl })), { provider }), (speed !== undefined && { speed })), (trailingSilence !== undefined && { trailing_silence: trailingSilence })), (configId && { config_id: configId })) }, (skipPatterns && { skip_patterns: skipPatterns }));
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
280
|
/**
|
|
303
281
|
* Rime TTS vendor.
|
|
304
282
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Agora from "../index.mjs";
|
|
2
|
-
export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Rtzr | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai | Agora.Asr.Stepfun;
|
|
2
|
+
export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Gemini | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Rtzr | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect | Agora.Asr.Smallestai | Agora.Asr.Stepfun | Agora.Asr.Elevenlabs | Agora.Asr.Fishaudio | Agora.Asr.Qwen;
|
|
3
3
|
export declare namespace Asr {
|
|
4
4
|
interface Ares extends Agora.AresAsr {
|
|
5
5
|
vendor: "ares";
|
|
@@ -58,4 +58,13 @@ export declare namespace Asr {
|
|
|
58
58
|
interface Stepfun extends Agora.StepfunAsr {
|
|
59
59
|
vendor: "stepfun";
|
|
60
60
|
}
|
|
61
|
+
interface Elevenlabs extends Agora.ElevenLabsAsr {
|
|
62
|
+
vendor: "elevenlabs";
|
|
63
|
+
}
|
|
64
|
+
interface Fishaudio extends Agora.FishAudioAsr {
|
|
65
|
+
vendor: "fishaudio";
|
|
66
|
+
}
|
|
67
|
+
interface Qwen extends Agora.QwenAsr {
|
|
68
|
+
vendor: "qwen";
|
|
69
|
+
}
|
|
61
70
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Agora from "../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* ElevenLabs ASR configuration.
|
|
4
|
+
*/
|
|
5
|
+
export interface ElevenLabsAsr {
|
|
6
|
+
language?: Agora.AsrLanguage;
|
|
7
|
+
params: Agora.ElevenLabsAsrParams;
|
|
8
|
+
/** Accepts any additional properties */
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Agora from "../index.mjs";
|
|
2
|
-
export type Tts = Agora.Tts.Tencent | Agora.Tts.Bytedance | Agora.Tts.Microsoft | Agora.Tts.Elevenlabs | Agora.Tts.Minimax | Agora.Tts.MinimaxDuplex | Agora.Tts.Murf | Agora.Tts.Cartesia | Agora.Tts.Openai | Agora.Tts.
|
|
2
|
+
export type Tts = Agora.Tts.Tencent | Agora.Tts.Bytedance | Agora.Tts.Microsoft | Agora.Tts.Elevenlabs | Agora.Tts.Minimax | Agora.Tts.MinimaxDuplex | Agora.Tts.Murf | Agora.Tts.Cartesia | Agora.Tts.Openai | Agora.Tts.Rime | Agora.Tts.Fishaudio | Agora.Tts.Google | Agora.Tts.Gemini | Agora.Tts.Amazon | Agora.Tts.Sarvam | Agora.Tts.GenericHttp | Agora.Tts.Xai | Agora.Tts.Deepgram | Agora.Tts.Cosyvoice | Agora.Tts.BytedanceDuplex | Agora.Tts.Stepfun | Agora.Tts.Gradium | Agora.Tts.Mistral | Agora.Tts.Typecast | Agora.Tts.Smallestai | Agora.Tts.Soniox;
|
|
3
3
|
export declare namespace Tts {
|
|
4
4
|
interface Tencent extends Agora.TencentTts {
|
|
5
5
|
vendor: "tencent";
|
|
@@ -28,9 +28,6 @@ export declare namespace Tts {
|
|
|
28
28
|
interface Openai extends Agora.OpenAiTts {
|
|
29
29
|
vendor: "openai";
|
|
30
30
|
}
|
|
31
|
-
interface Humeai extends Agora.HumeAiTts {
|
|
32
|
-
vendor: "humeai";
|
|
33
|
-
}
|
|
34
31
|
interface Rime extends Agora.RimeTts {
|
|
35
32
|
vendor: "rime";
|
|
36
33
|
}
|
|
@@ -24,10 +24,14 @@ export * from "./DeepgramAsr.mjs";
|
|
|
24
24
|
export * from "./DeepgramAsrParams.mjs";
|
|
25
25
|
export * from "./DeepgramTts.mjs";
|
|
26
26
|
export * from "./DeepgramTtsParams.mjs";
|
|
27
|
+
export * from "./ElevenLabsAsr.mjs";
|
|
28
|
+
export * from "./ElevenLabsAsrParams.mjs";
|
|
27
29
|
export * from "./ElevenLabsTts.mjs";
|
|
28
30
|
export * from "./ElevenLabsTtsParams.mjs";
|
|
29
31
|
export * from "./FengmingAsr.mjs";
|
|
30
32
|
export * from "./FengmingAsrParams.mjs";
|
|
33
|
+
export * from "./FishAudioAsr.mjs";
|
|
34
|
+
export * from "./FishAudioAsrParams.mjs";
|
|
31
35
|
export * from "./FishAudioTts.mjs";
|
|
32
36
|
export * from "./FishAudioTtsParams.mjs";
|
|
33
37
|
export * from "./GeminiAsr.mjs";
|
|
@@ -44,8 +48,6 @@ export * from "./GoogleTtsParams.mjs";
|
|
|
44
48
|
export * from "./GoogleTtsVoiceSelectionParams.mjs";
|
|
45
49
|
export * from "./GradiumTts.mjs";
|
|
46
50
|
export * from "./GradiumTtsParams.mjs";
|
|
47
|
-
export * from "./HumeAiTts.mjs";
|
|
48
|
-
export * from "./HumeAiTtsParams.mjs";
|
|
49
51
|
export * from "./Llm.mjs";
|
|
50
52
|
export * from "./LlmParams.mjs";
|
|
51
53
|
export * from "./LlmTool.mjs";
|
|
@@ -75,6 +77,8 @@ export * from "./OpenAiAsrParams.mjs";
|
|
|
75
77
|
export * from "./OpenAiInputAudioTranscription.mjs";
|
|
76
78
|
export * from "./OpenAiTts.mjs";
|
|
77
79
|
export * from "./OpenAiTtsParams.mjs";
|
|
80
|
+
export * from "./QwenAsr.mjs";
|
|
81
|
+
export * from "./QwenAsrParams.mjs";
|
|
78
82
|
export * from "./RimeTts.mjs";
|
|
79
83
|
export * from "./RimeTtsParams.mjs";
|
|
80
84
|
export * from "./RtzrAsr.mjs";
|