agora-agents 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/dist/cjs/AgoraPoolClient.js +7 -2
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.js +16 -8
- package/dist/cjs/agentkit/Agent.d.ts +56 -11
- package/dist/cjs/agentkit/Agent.js +114 -15
- package/dist/cjs/agentkit/AgentSession.d.ts +4 -3
- package/dist/cjs/agentkit/AgentSession.js +39 -10
- package/dist/cjs/agentkit/__tests__/type-safety.test.js +23 -3
- package/dist/cjs/agentkit/constants.d.ts +5 -4
- package/dist/cjs/agentkit/constants.js +5 -4
- package/dist/cjs/agentkit/index.d.ts +1 -1
- package/dist/cjs/agentkit/presets.d.ts +30 -0
- package/dist/cjs/agentkit/presets.js +9 -2
- package/dist/cjs/agentkit/types.d.ts +50 -35
- package/dist/cjs/agentkit/vendors/avatar.d.ts +3 -1
- package/dist/cjs/agentkit/vendors/avatar.js +3 -1
- package/dist/cjs/agentkit/vendors/llm.d.ts +18 -8
- package/dist/cjs/agentkit/vendors/llm.js +83 -15
- package/dist/cjs/agentkit/vendors/mllm.d.ts +16 -0
- package/dist/cjs/agentkit/vendors/mllm.js +11 -7
- package/dist/cjs/agentkit/vendors/stt.d.ts +29 -11
- package/dist/cjs/agentkit/vendors/stt.js +74 -53
- package/dist/cjs/agentkit/vendors/tts.d.ts +70 -22
- package/dist/cjs/agentkit/vendors/tts.js +67 -34
- package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/agents/client/Client.js +3 -2
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +8 -331
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +0 -107
- package/dist/cjs/api/types/AmazonAsr.d.ts +10 -0
- package/dist/cjs/api/types/AmazonAsr.js +3 -0
- package/dist/cjs/api/types/AmazonAsrParams.d.ts +19 -0
- package/dist/cjs/api/types/AmazonAsrParams.js +3 -0
- package/dist/cjs/api/types/AmazonTtsParams.d.ts +19 -5
- package/dist/cjs/api/types/AmazonTtsParams.js +11 -0
- package/dist/cjs/api/types/AresAsr.d.ts +10 -0
- package/dist/cjs/api/types/AresAsr.js +3 -0
- package/dist/cjs/api/types/AresAsrParams.d.ts +4 -0
- package/dist/cjs/api/types/AresAsrParams.js +3 -0
- package/dist/cjs/api/types/Asr.d.ts +31 -0
- package/dist/cjs/api/types/Asr.js +3 -0
- package/dist/cjs/api/types/AsrLanguage.d.ts +36 -0
- package/dist/cjs/api/types/AsrLanguage.js +39 -0
- package/dist/cjs/api/types/AssemblyAiAsr.d.ts +10 -0
- package/dist/cjs/api/types/AssemblyAiAsr.js +3 -0
- package/dist/cjs/api/types/AssemblyAiAsrParams.d.ts +13 -0
- package/dist/cjs/api/types/AssemblyAiAsrParams.js +3 -0
- package/dist/cjs/api/types/CartesiaTtsOutputFormat.d.ts +11 -0
- package/dist/cjs/api/types/CartesiaTtsOutputFormat.js +3 -0
- package/dist/cjs/api/types/CartesiaTtsParams.d.ts +9 -4
- package/dist/cjs/api/types/CartesiaTtsVoice.d.ts +2 -0
- package/dist/cjs/api/types/DeepgramAsr.d.ts +12 -0
- package/dist/cjs/api/types/DeepgramAsr.js +3 -0
- package/dist/cjs/api/types/DeepgramAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/DeepgramAsrParams.js +3 -0
- package/dist/cjs/api/types/DeepgramTtsParams.d.ts +2 -2
- package/dist/cjs/api/types/ElevenLabsTtsParams.d.ts +13 -1
- package/dist/cjs/api/types/FishAudioTtsParams.d.ts +5 -1
- package/dist/cjs/api/types/GoogleAsr.d.ts +10 -0
- package/dist/cjs/api/types/GoogleAsr.js +3 -0
- package/dist/cjs/api/types/GoogleAsrParams.d.ts +17 -0
- package/dist/cjs/api/types/GoogleAsrParams.js +3 -0
- package/dist/cjs/api/types/GoogleTtsAudioConfig.d.ts +11 -0
- package/dist/cjs/api/types/GoogleTtsAudioConfig.js +3 -0
- package/dist/cjs/api/types/GoogleTtsParams.d.ts +7 -8
- package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.d.ts +9 -0
- package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.js +3 -0
- package/dist/cjs/api/types/HumeAiTtsParams.d.ts +21 -1
- package/dist/cjs/api/types/HumeAiTtsParams.js +9 -0
- package/dist/cjs/api/types/Llm.d.ts +58 -0
- package/dist/cjs/api/types/Llm.js +15 -0
- package/dist/cjs/api/types/LlmParams.d.ts +11 -0
- package/dist/cjs/api/types/LlmParams.js +3 -0
- package/dist/cjs/api/types/MicrosoftAsr.d.ts +10 -0
- package/dist/cjs/api/types/MicrosoftAsr.js +3 -0
- package/dist/cjs/api/types/MicrosoftAsrParams.d.ts +15 -0
- package/dist/cjs/api/types/MicrosoftAsrParams.js +3 -0
- package/dist/cjs/api/types/MicrosoftTtsParams.d.ts +6 -0
- package/dist/cjs/api/types/MinimaxTtsParams.d.ts +4 -0
- package/dist/cjs/api/types/Mllm.d.ts +44 -0
- package/dist/cjs/api/types/Mllm.js +14 -0
- package/dist/cjs/api/types/MllmHttpOptions.d.ts +9 -0
- package/dist/cjs/api/types/MllmHttpOptions.js +3 -0
- package/dist/cjs/api/types/MllmInputAudioTranscription.d.ts +13 -0
- package/dist/cjs/api/types/MllmInputAudioTranscription.js +3 -0
- package/dist/cjs/api/types/MllmParams.d.ts +28 -0
- package/dist/cjs/api/types/MllmParams.js +3 -0
- package/dist/cjs/api/types/MllmTurnDetection.d.ts +65 -0
- package/dist/cjs/api/types/MllmTurnDetection.js +33 -0
- package/dist/cjs/api/types/MurfTtsParams.d.ts +17 -5
- package/dist/cjs/api/types/OpenAiAsr.d.ts +10 -0
- package/dist/cjs/api/types/OpenAiAsr.js +3 -0
- package/dist/cjs/api/types/OpenAiAsrParams.d.ts +11 -0
- package/dist/cjs/api/types/OpenAiAsrParams.js +3 -0
- package/dist/cjs/api/types/OpenAiInputAudioTranscription.d.ts +13 -0
- package/dist/cjs/api/types/OpenAiInputAudioTranscription.js +3 -0
- package/dist/cjs/api/types/OpenAiTtsParams.d.ts +9 -1
- package/dist/cjs/api/types/RimeTtsParams.d.ts +7 -3
- package/dist/cjs/api/types/SarvamAsr.d.ts +10 -0
- package/dist/cjs/api/types/SarvamAsr.js +3 -0
- package/dist/cjs/api/types/SarvamAsrParams.d.ts +11 -0
- package/dist/cjs/api/types/SarvamAsrParams.js +3 -0
- package/dist/cjs/api/types/SarvamTtsParams.d.ts +29 -2
- package/dist/cjs/api/types/SarvamTtsParams.js +18 -0
- package/dist/cjs/api/types/SpeechmaticsAsr.d.ts +10 -0
- package/dist/cjs/api/types/SpeechmaticsAsr.js +3 -0
- package/dist/cjs/api/types/SpeechmaticsAsrParams.d.ts +13 -0
- package/dist/cjs/api/types/SpeechmaticsAsrParams.js +3 -0
- package/dist/cjs/api/types/index.d.ts +31 -0
- package/dist/cjs/api/types/index.js +31 -0
- package/dist/cjs/core/base64.js +5 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.mjs +7 -2
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.mjs +16 -8
- package/dist/esm/agentkit/Agent.d.mts +56 -11
- package/dist/esm/agentkit/Agent.mjs +114 -15
- package/dist/esm/agentkit/AgentSession.d.mts +4 -3
- package/dist/esm/agentkit/AgentSession.mjs +40 -11
- package/dist/esm/agentkit/__tests__/type-safety.test.mjs +23 -3
- package/dist/esm/agentkit/constants.d.mts +5 -4
- package/dist/esm/agentkit/constants.mjs +5 -4
- package/dist/esm/agentkit/index.d.mts +1 -1
- package/dist/esm/agentkit/presets.d.mts +30 -0
- package/dist/esm/agentkit/presets.mjs +9 -6
- package/dist/esm/agentkit/types.d.mts +50 -35
- package/dist/esm/agentkit/vendors/avatar.d.mts +3 -1
- package/dist/esm/agentkit/vendors/avatar.mjs +3 -1
- package/dist/esm/agentkit/vendors/llm.d.mts +18 -8
- package/dist/esm/agentkit/vendors/llm.mjs +83 -15
- package/dist/esm/agentkit/vendors/mllm.d.mts +16 -0
- package/dist/esm/agentkit/vendors/mllm.mjs +11 -7
- package/dist/esm/agentkit/vendors/stt.d.mts +29 -11
- package/dist/esm/agentkit/vendors/stt.mjs +74 -53
- package/dist/esm/agentkit/vendors/tts.d.mts +70 -22
- package/dist/esm/agentkit/vendors/tts.mjs +67 -34
- package/dist/esm/api/resources/agents/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/agents/client/Client.mjs +3 -2
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +8 -331
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +0 -107
- package/dist/esm/api/types/AmazonAsr.d.mts +10 -0
- package/dist/esm/api/types/AmazonAsr.mjs +2 -0
- package/dist/esm/api/types/AmazonAsrParams.d.mts +19 -0
- package/dist/esm/api/types/AmazonAsrParams.mjs +2 -0
- package/dist/esm/api/types/AmazonTtsParams.d.mts +19 -5
- package/dist/esm/api/types/AmazonTtsParams.mjs +10 -1
- package/dist/esm/api/types/AresAsr.d.mts +10 -0
- package/dist/esm/api/types/AresAsr.mjs +2 -0
- package/dist/esm/api/types/AresAsrParams.d.mts +4 -0
- package/dist/esm/api/types/AresAsrParams.mjs +2 -0
- package/dist/esm/api/types/Asr.d.mts +31 -0
- package/dist/esm/api/types/Asr.mjs +2 -0
- package/dist/esm/api/types/AsrLanguage.d.mts +36 -0
- package/dist/esm/api/types/AsrLanguage.mjs +36 -0
- package/dist/esm/api/types/AssemblyAiAsr.d.mts +10 -0
- package/dist/esm/api/types/AssemblyAiAsr.mjs +2 -0
- package/dist/esm/api/types/AssemblyAiAsrParams.d.mts +13 -0
- package/dist/esm/api/types/AssemblyAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/CartesiaTtsOutputFormat.d.mts +11 -0
- package/dist/esm/api/types/CartesiaTtsOutputFormat.mjs +2 -0
- package/dist/esm/api/types/CartesiaTtsParams.d.mts +9 -4
- package/dist/esm/api/types/CartesiaTtsVoice.d.mts +2 -0
- package/dist/esm/api/types/DeepgramAsr.d.mts +12 -0
- package/dist/esm/api/types/DeepgramAsr.mjs +2 -0
- package/dist/esm/api/types/DeepgramAsrParams.d.mts +17 -0
- package/dist/esm/api/types/DeepgramAsrParams.mjs +2 -0
- package/dist/esm/api/types/DeepgramTtsParams.d.mts +2 -2
- package/dist/esm/api/types/ElevenLabsTtsParams.d.mts +13 -1
- package/dist/esm/api/types/FishAudioTtsParams.d.mts +5 -1
- package/dist/esm/api/types/GoogleAsr.d.mts +10 -0
- package/dist/esm/api/types/GoogleAsr.mjs +2 -0
- package/dist/esm/api/types/GoogleAsrParams.d.mts +17 -0
- package/dist/esm/api/types/GoogleAsrParams.mjs +2 -0
- package/dist/esm/api/types/GoogleTtsAudioConfig.d.mts +11 -0
- package/dist/esm/api/types/GoogleTtsAudioConfig.mjs +2 -0
- package/dist/esm/api/types/GoogleTtsParams.d.mts +7 -8
- package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.d.mts +9 -0
- package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.mjs +2 -0
- package/dist/esm/api/types/HumeAiTtsParams.d.mts +21 -1
- package/dist/esm/api/types/HumeAiTtsParams.mjs +8 -1
- package/dist/esm/api/types/Llm.d.mts +58 -0
- package/dist/esm/api/types/Llm.mjs +12 -0
- package/dist/esm/api/types/LlmParams.d.mts +11 -0
- package/dist/esm/api/types/LlmParams.mjs +2 -0
- package/dist/esm/api/types/MicrosoftAsr.d.mts +10 -0
- package/dist/esm/api/types/MicrosoftAsr.mjs +2 -0
- package/dist/esm/api/types/MicrosoftAsrParams.d.mts +15 -0
- package/dist/esm/api/types/MicrosoftAsrParams.mjs +2 -0
- package/dist/esm/api/types/MicrosoftTtsParams.d.mts +6 -0
- package/dist/esm/api/types/MinimaxTtsParams.d.mts +4 -0
- package/dist/esm/api/types/Mllm.d.mts +44 -0
- package/dist/esm/api/types/Mllm.mjs +11 -0
- package/dist/esm/api/types/MllmHttpOptions.d.mts +9 -0
- package/dist/esm/api/types/MllmHttpOptions.mjs +2 -0
- package/dist/esm/api/types/MllmInputAudioTranscription.d.mts +13 -0
- package/dist/esm/api/types/MllmInputAudioTranscription.mjs +2 -0
- package/dist/esm/api/types/MllmParams.d.mts +28 -0
- package/dist/esm/api/types/MllmParams.mjs +2 -0
- package/dist/esm/api/types/MllmTurnDetection.d.mts +65 -0
- package/dist/esm/api/types/MllmTurnDetection.mjs +30 -0
- package/dist/esm/api/types/MurfTtsParams.d.mts +17 -5
- package/dist/esm/api/types/OpenAiAsr.d.mts +10 -0
- package/dist/esm/api/types/OpenAiAsr.mjs +2 -0
- package/dist/esm/api/types/OpenAiAsrParams.d.mts +11 -0
- package/dist/esm/api/types/OpenAiAsrParams.mjs +2 -0
- package/dist/esm/api/types/OpenAiInputAudioTranscription.d.mts +13 -0
- package/dist/esm/api/types/OpenAiInputAudioTranscription.mjs +2 -0
- package/dist/esm/api/types/OpenAiTtsParams.d.mts +9 -1
- package/dist/esm/api/types/RimeTtsParams.d.mts +7 -3
- package/dist/esm/api/types/SarvamAsr.d.mts +10 -0
- package/dist/esm/api/types/SarvamAsr.mjs +2 -0
- package/dist/esm/api/types/SarvamAsrParams.d.mts +11 -0
- package/dist/esm/api/types/SarvamAsrParams.mjs +2 -0
- package/dist/esm/api/types/SarvamTtsParams.d.mts +29 -2
- package/dist/esm/api/types/SarvamTtsParams.mjs +17 -1
- package/dist/esm/api/types/SpeechmaticsAsr.d.mts +10 -0
- package/dist/esm/api/types/SpeechmaticsAsr.mjs +2 -0
- package/dist/esm/api/types/SpeechmaticsAsrParams.d.mts +13 -0
- package/dist/esm/api/types/SpeechmaticsAsrParams.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +31 -0
- package/dist/esm/api/types/index.mjs +31 -0
- package/dist/esm/core/base64.mjs +5 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe LLM (Large Language Model) vendor classes.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type OpenAIPresetModel } from "../presets.js";
|
|
5
5
|
import type { LlmConfig } from "../types.js";
|
|
6
6
|
import { BaseLLM, type BaseLlmOptions } from "./base.js";
|
|
7
7
|
/**
|
|
@@ -12,7 +12,7 @@ type OpenAICommonOptions = BaseLlmOptions & {
|
|
|
12
12
|
apiKey?: string;
|
|
13
13
|
/** Model name (e.g., 'gpt-4o-mini', 'gpt-4', 'gpt-3.5-turbo') */
|
|
14
14
|
model: string;
|
|
15
|
-
/** API endpoint URL
|
|
15
|
+
/** API endpoint URL */
|
|
16
16
|
url?: string;
|
|
17
17
|
/** Maximum number of conversation history messages to cache */
|
|
18
18
|
maxHistory?: number;
|
|
@@ -37,6 +37,7 @@ type OpenAICommonOptions = BaseLlmOptions & {
|
|
|
37
37
|
};
|
|
38
38
|
export type OpenAIOptions = (OpenAICommonOptions & {
|
|
39
39
|
apiKey: string;
|
|
40
|
+
url: string;
|
|
40
41
|
}) | (Omit<OpenAICommonOptions, "model" | "url" | "vendor"> & {
|
|
41
42
|
apiKey?: undefined;
|
|
42
43
|
model: OpenAIPresetModel;
|
|
@@ -51,6 +52,7 @@ export type OpenAIOptions = (OpenAICommonOptions & {
|
|
|
51
52
|
* const llm = new OpenAI({
|
|
52
53
|
* apiKey: process.env.OPENAI_API_KEY,
|
|
53
54
|
* model: 'gpt-4o',
|
|
55
|
+
* url: 'https://api.openai.com/v1/chat/completions',
|
|
54
56
|
* });
|
|
55
57
|
* ```
|
|
56
58
|
*/
|
|
@@ -120,12 +122,12 @@ export interface AnthropicOptions extends BaseLlmOptions {
|
|
|
120
122
|
apiKey: string;
|
|
121
123
|
/** Model name (e.g., 'claude-3-5-sonnet-20241022', 'claude-3-opus-20240229') */
|
|
122
124
|
model: string;
|
|
123
|
-
/** API endpoint URL
|
|
124
|
-
url
|
|
125
|
+
/** API endpoint URL */
|
|
126
|
+
url: string;
|
|
125
127
|
/** Maximum number of conversation history messages to cache */
|
|
126
128
|
maxHistory?: number;
|
|
127
129
|
/** Maximum tokens to generate */
|
|
128
|
-
maxTokens
|
|
130
|
+
maxTokens: number;
|
|
129
131
|
/** Sampling temperature (0.0–1.0) */
|
|
130
132
|
temperature?: number;
|
|
131
133
|
/** Nucleus sampling (0.0–1.0) */
|
|
@@ -151,6 +153,9 @@ export interface AnthropicOptions extends BaseLlmOptions {
|
|
|
151
153
|
* const llm = new Anthropic({
|
|
152
154
|
* apiKey: process.env.ANTHROPIC_API_KEY,
|
|
153
155
|
* model: 'claude-3-5-sonnet-20241022',
|
|
156
|
+
* url: 'https://api.anthropic.com/v1/messages',
|
|
157
|
+
* headers: { 'anthropic-version': '2023-06-01' },
|
|
158
|
+
* maxTokens: 1024,
|
|
154
159
|
* });
|
|
155
160
|
* ```
|
|
156
161
|
*/
|
|
@@ -211,7 +216,7 @@ export declare class Gemini extends BaseLLM {
|
|
|
211
216
|
type OpenAIStyleOptions = BaseLlmOptions & {
|
|
212
217
|
apiKey: string;
|
|
213
218
|
model: string;
|
|
214
|
-
url
|
|
219
|
+
url: string;
|
|
215
220
|
maxHistory?: number;
|
|
216
221
|
temperature?: number;
|
|
217
222
|
topP?: number;
|
|
@@ -259,9 +264,13 @@ export declare class VertexAILLM extends BaseLLM {
|
|
|
259
264
|
toConfig(): LlmConfig;
|
|
260
265
|
}
|
|
261
266
|
export interface AmazonBedrockOptions extends BaseLlmOptions {
|
|
262
|
-
|
|
267
|
+
/** AWS access key ID. */
|
|
268
|
+
accessKey: string;
|
|
269
|
+
/** AWS secret access key. */
|
|
270
|
+
secretKey: string;
|
|
271
|
+
/** AWS region. */
|
|
272
|
+
region: string;
|
|
263
273
|
model: string;
|
|
264
|
-
url: string;
|
|
265
274
|
maxHistory?: number;
|
|
266
275
|
maxTokens?: number;
|
|
267
276
|
temperature?: number;
|
|
@@ -282,6 +291,7 @@ export declare class AmazonBedrock extends BaseLLM {
|
|
|
282
291
|
export interface DifyOptions extends BaseLlmOptions {
|
|
283
292
|
apiKey: string;
|
|
284
293
|
url: string;
|
|
294
|
+
model: string;
|
|
285
295
|
user?: string;
|
|
286
296
|
conversationId?: string;
|
|
287
297
|
maxHistory?: number;
|
|
@@ -4,7 +4,26 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Dify = exports.AmazonBedrock = exports.VertexAILLM = exports.CustomLLM = exports.Groq = exports.Gemini = exports.Anthropic = exports.AzureOpenAI = exports.OpenAI = void 0;
|
|
7
|
+
const presets_js_1 = require("../presets.js");
|
|
7
8
|
const base_js_1 = require("./base.js");
|
|
9
|
+
function requireString(value, field, vendor) {
|
|
10
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
11
|
+
throw new Error(`${vendor} requires ${field}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function requireNumber(value, field, vendor) {
|
|
15
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
16
|
+
throw new Error(`${vendor} requires ${field}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function requireRecord(value, field, vendor) {
|
|
20
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) {
|
|
21
|
+
throw new Error(`${vendor} requires ${field}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function isOpenAIManagedModel(model) {
|
|
25
|
+
return presets_js_1.OpenAIPresetModels.includes(model.trim().toLowerCase());
|
|
26
|
+
}
|
|
8
27
|
/**
|
|
9
28
|
* OpenAI LLM vendor (and OpenAI-compatible APIs).
|
|
10
29
|
*
|
|
@@ -13,12 +32,28 @@ const base_js_1 = require("./base.js");
|
|
|
13
32
|
* const llm = new OpenAI({
|
|
14
33
|
* apiKey: process.env.OPENAI_API_KEY,
|
|
15
34
|
* model: 'gpt-4o',
|
|
35
|
+
* url: 'https://api.openai.com/v1/chat/completions',
|
|
16
36
|
* });
|
|
17
37
|
* ```
|
|
18
38
|
*/
|
|
19
39
|
class OpenAI extends base_js_1.BaseLLM {
|
|
20
40
|
constructor(options) {
|
|
21
41
|
super(options);
|
|
42
|
+
requireString(options.model, "model", "OpenAI");
|
|
43
|
+
if (options.apiKey) {
|
|
44
|
+
requireString(options.url, "url", "OpenAI");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if (!isOpenAIManagedModel(options.model)) {
|
|
48
|
+
throw new Error("OpenAI requires apiKey unless using a supported Agora-managed model");
|
|
49
|
+
}
|
|
50
|
+
if (options.url) {
|
|
51
|
+
throw new Error("OpenAI Agora-managed mode does not allow url");
|
|
52
|
+
}
|
|
53
|
+
if (options.vendor) {
|
|
54
|
+
throw new Error("OpenAI Agora-managed mode does not allow vendor");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
22
57
|
this.options = options;
|
|
23
58
|
}
|
|
24
59
|
toConfig() {
|
|
@@ -45,6 +80,10 @@ exports.OpenAI = OpenAI;
|
|
|
45
80
|
class AzureOpenAI extends base_js_1.BaseLLM {
|
|
46
81
|
constructor(options) {
|
|
47
82
|
super(options);
|
|
83
|
+
requireString(options.apiKey, "apiKey", "AzureOpenAI");
|
|
84
|
+
requireString(options.model, "model", "AzureOpenAI");
|
|
85
|
+
requireString(options.resourceName, "resourceName", "AzureOpenAI");
|
|
86
|
+
requireString(options.deploymentName, "deploymentName", "AzureOpenAI");
|
|
48
87
|
this.options = options;
|
|
49
88
|
}
|
|
50
89
|
toConfig() {
|
|
@@ -80,18 +119,26 @@ exports.AzureOpenAI = AzureOpenAI;
|
|
|
80
119
|
* const llm = new Anthropic({
|
|
81
120
|
* apiKey: process.env.ANTHROPIC_API_KEY,
|
|
82
121
|
* model: 'claude-3-5-sonnet-20241022',
|
|
122
|
+
* url: 'https://api.anthropic.com/v1/messages',
|
|
123
|
+
* headers: { 'anthropic-version': '2023-06-01' },
|
|
124
|
+
* maxTokens: 1024,
|
|
83
125
|
* });
|
|
84
126
|
* ```
|
|
85
127
|
*/
|
|
86
128
|
class Anthropic extends base_js_1.BaseLLM {
|
|
87
129
|
constructor(options) {
|
|
88
130
|
super(options);
|
|
131
|
+
requireString(options.apiKey, "apiKey", "Anthropic");
|
|
132
|
+
requireString(options.model, "model", "Anthropic");
|
|
133
|
+
requireString(options.url, "url", "Anthropic");
|
|
134
|
+
requireRecord(options.headers, "headers", "Anthropic");
|
|
135
|
+
requireNumber(options.maxTokens, "maxTokens", "Anthropic");
|
|
89
136
|
this.options = options;
|
|
90
137
|
}
|
|
91
138
|
toConfig() {
|
|
92
139
|
const { apiKey, model, url, maxHistory, maxTokens, temperature, topP, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
|
|
93
140
|
return {
|
|
94
|
-
url
|
|
141
|
+
url,
|
|
95
142
|
api_key: apiKey,
|
|
96
143
|
// model is the default; params entries extend it; named fields win.
|
|
97
144
|
params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (maxTokens !== undefined && { max_tokens: maxTokens })), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })),
|
|
@@ -125,6 +172,8 @@ exports.Anthropic = Anthropic;
|
|
|
125
172
|
class Gemini extends base_js_1.BaseLLM {
|
|
126
173
|
constructor(options) {
|
|
127
174
|
super(options);
|
|
175
|
+
requireString(options.apiKey, "apiKey", "Gemini");
|
|
176
|
+
requireString(options.model, "model", "Gemini");
|
|
128
177
|
this.options = options;
|
|
129
178
|
}
|
|
130
179
|
toConfig() {
|
|
@@ -150,10 +199,10 @@ class Gemini extends base_js_1.BaseLLM {
|
|
|
150
199
|
}
|
|
151
200
|
}
|
|
152
201
|
exports.Gemini = Gemini;
|
|
153
|
-
function openAIStyleConfig(options,
|
|
154
|
-
var _a, _b
|
|
202
|
+
function openAIStyleConfig(options, vendor) {
|
|
203
|
+
var _a, _b;
|
|
155
204
|
return {
|
|
156
|
-
url:
|
|
205
|
+
url: options.url,
|
|
157
206
|
api_key: options.apiKey,
|
|
158
207
|
params: Object.assign(Object.assign(Object.assign(Object.assign({ model: options.model }, options.params), (options.temperature !== undefined && { temperature: options.temperature })), (options.topP !== undefined && { top_p: options.topP })), (options.maxTokens !== undefined && { max_tokens: options.maxTokens })),
|
|
159
208
|
headers: options.headers,
|
|
@@ -161,10 +210,10 @@ function openAIStyleConfig(options, defaultUrl, vendor) {
|
|
|
161
210
|
system_messages: options.systemMessages,
|
|
162
211
|
greeting_message: options.greetingMessage,
|
|
163
212
|
failure_message: options.failureMessage,
|
|
164
|
-
input_modalities: (
|
|
213
|
+
input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
165
214
|
output_modalities: options.outputModalities,
|
|
166
215
|
style: "openai",
|
|
167
|
-
vendor: (
|
|
216
|
+
vendor: (_b = options.vendor) !== null && _b !== void 0 ? _b : vendor,
|
|
168
217
|
greeting_configs: options.greetingConfigs,
|
|
169
218
|
template_variables: options.templateVariables,
|
|
170
219
|
mcp_servers: options.mcpServers,
|
|
@@ -174,9 +223,12 @@ class Groq extends base_js_1.BaseLLM {
|
|
|
174
223
|
constructor(options) {
|
|
175
224
|
super(options);
|
|
176
225
|
this.options = options;
|
|
226
|
+
requireString(options.apiKey, "apiKey", "Groq");
|
|
227
|
+
requireString(options.model, "model", "Groq");
|
|
228
|
+
requireString(options.url, "url", "Groq");
|
|
177
229
|
}
|
|
178
230
|
toConfig() {
|
|
179
|
-
return openAIStyleConfig(this.options
|
|
231
|
+
return openAIStyleConfig(this.options);
|
|
180
232
|
}
|
|
181
233
|
}
|
|
182
234
|
exports.Groq = Groq;
|
|
@@ -184,10 +236,12 @@ class CustomLLM extends base_js_1.BaseLLM {
|
|
|
184
236
|
constructor(options) {
|
|
185
237
|
super(options);
|
|
186
238
|
this.options = options;
|
|
239
|
+
requireString(options.apiKey, "apiKey", "CustomLLM");
|
|
240
|
+
requireString(options.model, "model", "CustomLLM");
|
|
241
|
+
requireString(options.url, "url", "CustomLLM");
|
|
187
242
|
}
|
|
188
243
|
toConfig() {
|
|
189
|
-
|
|
190
|
-
return openAIStyleConfig(this.options, (_a = this.options.url) !== null && _a !== void 0 ? _a : "", "custom");
|
|
244
|
+
return openAIStyleConfig(this.options, "custom");
|
|
191
245
|
}
|
|
192
246
|
}
|
|
193
247
|
exports.CustomLLM = CustomLLM;
|
|
@@ -195,6 +249,10 @@ class VertexAILLM extends base_js_1.BaseLLM {
|
|
|
195
249
|
constructor(options) {
|
|
196
250
|
super(options);
|
|
197
251
|
this.options = options;
|
|
252
|
+
requireString(options.apiKey, "apiKey", "VertexAILLM");
|
|
253
|
+
requireString(options.model, "model", "VertexAILLM");
|
|
254
|
+
requireString(options.projectId, "projectId", "VertexAILLM");
|
|
255
|
+
requireString(options.location, "location", "VertexAILLM");
|
|
198
256
|
}
|
|
199
257
|
toConfig() {
|
|
200
258
|
var _a, _b;
|
|
@@ -202,7 +260,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
|
|
|
202
260
|
return {
|
|
203
261
|
url: (_a = o.url) !== null && _a !== void 0 ? _a : "https://aiplatform.googleapis.com/v1/projects",
|
|
204
262
|
api_key: o.apiKey,
|
|
205
|
-
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: o.model, project_id: o.projectId, location: o.location }, o.params), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && {
|
|
263
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: o.model, project_id: o.projectId, location: o.location }, o.params), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { top_p: o.topP })), (o.topK !== undefined && { top_k: o.topK })), (o.maxOutputTokens !== undefined && { max_output_tokens: o.maxOutputTokens })),
|
|
206
264
|
headers: o.headers,
|
|
207
265
|
max_history: o.maxHistory,
|
|
208
266
|
system_messages: o.systemMessages,
|
|
@@ -223,14 +281,21 @@ class AmazonBedrock extends base_js_1.BaseLLM {
|
|
|
223
281
|
constructor(options) {
|
|
224
282
|
super(options);
|
|
225
283
|
this.options = options;
|
|
284
|
+
requireString(options.accessKey, "accessKey", "AmazonBedrock");
|
|
285
|
+
requireString(options.secretKey, "secretKey", "AmazonBedrock");
|
|
286
|
+
requireString(options.region, "region", "AmazonBedrock");
|
|
287
|
+
requireString(options.model, "model", "AmazonBedrock");
|
|
226
288
|
}
|
|
227
289
|
toConfig() {
|
|
228
290
|
var _a;
|
|
229
291
|
const o = this.options;
|
|
230
292
|
return {
|
|
231
|
-
url: o.
|
|
232
|
-
|
|
233
|
-
|
|
293
|
+
url: `https://bedrock-runtime.${o.region}.amazonaws.com/model/${o.model}/converse-stream`,
|
|
294
|
+
access_key: o.accessKey,
|
|
295
|
+
secret_key: o.secretKey,
|
|
296
|
+
region: o.region,
|
|
297
|
+
model: o.model,
|
|
298
|
+
params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, o.params), (o.maxTokens !== undefined && { max_tokens: o.maxTokens })), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { top_p: o.topP })), (o.topK !== undefined && { top_k: o.topK })),
|
|
234
299
|
headers: o.headers,
|
|
235
300
|
max_history: o.maxHistory,
|
|
236
301
|
system_messages: o.systemMessages,
|
|
@@ -238,7 +303,7 @@ class AmazonBedrock extends base_js_1.BaseLLM {
|
|
|
238
303
|
failure_message: o.failureMessage,
|
|
239
304
|
input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
|
|
240
305
|
output_modalities: this.outputModalities,
|
|
241
|
-
style: "
|
|
306
|
+
style: "bedrock",
|
|
242
307
|
vendor: this.vendor,
|
|
243
308
|
greeting_configs: this.greetingConfigs,
|
|
244
309
|
template_variables: this.templateVariables,
|
|
@@ -251,6 +316,9 @@ class Dify extends base_js_1.BaseLLM {
|
|
|
251
316
|
constructor(options) {
|
|
252
317
|
super(options);
|
|
253
318
|
this.options = options;
|
|
319
|
+
requireString(options.apiKey, "apiKey", "Dify");
|
|
320
|
+
requireString(options.url, "url", "Dify");
|
|
321
|
+
requireString(options.model, "model", "Dify");
|
|
254
322
|
}
|
|
255
323
|
toConfig() {
|
|
256
324
|
var _a;
|
|
@@ -258,7 +326,7 @@ class Dify extends base_js_1.BaseLLM {
|
|
|
258
326
|
return {
|
|
259
327
|
url: o.url,
|
|
260
328
|
api_key: o.apiKey,
|
|
261
|
-
params: Object.assign(Object.assign(Object.assign({}, o.params), (o.user !== undefined && { user: o.user })), (o.conversationId !== undefined && { conversation_id: o.conversationId })),
|
|
329
|
+
params: Object.assign(Object.assign(Object.assign({ model: o.model }, o.params), (o.user !== undefined && { user: o.user })), (o.conversationId !== undefined && { conversation_id: o.conversationId })),
|
|
262
330
|
headers: o.headers,
|
|
263
331
|
max_history: o.maxHistory,
|
|
264
332
|
system_messages: o.systemMessages,
|
|
@@ -15,6 +15,12 @@ export interface OpenAIRealtimeOptions {
|
|
|
15
15
|
apiKey: string;
|
|
16
16
|
/** Model name (e.g., 'gpt-4o-realtime-preview') */
|
|
17
17
|
model?: string;
|
|
18
|
+
/** Voice identifier for audio output */
|
|
19
|
+
voice?: string;
|
|
20
|
+
/** System instructions that define agent behavior */
|
|
21
|
+
instructions?: string;
|
|
22
|
+
/** Audio transcription settings */
|
|
23
|
+
inputAudioTranscription?: Record<string, unknown>;
|
|
18
24
|
/** WebSocket URL for real-time communication */
|
|
19
25
|
url?: string;
|
|
20
26
|
/** Agent greeting message */
|
|
@@ -63,6 +69,11 @@ export interface GeminiLiveOptions {
|
|
|
63
69
|
instructions?: string;
|
|
64
70
|
/** Voice name (e.g., 'Aoede', 'Charon') */
|
|
65
71
|
voice?: string;
|
|
72
|
+
affectiveDialog?: boolean;
|
|
73
|
+
proactiveAudio?: boolean;
|
|
74
|
+
transcribeAgent?: boolean;
|
|
75
|
+
transcribeUser?: boolean;
|
|
76
|
+
httpOptions?: Record<string, unknown>;
|
|
66
77
|
/** Agent greeting message */
|
|
67
78
|
greetingMessage?: string;
|
|
68
79
|
/** Input modalities (e.g., ['audio'], ['audio', 'text']) */
|
|
@@ -116,6 +127,11 @@ export interface VertexAIOptions {
|
|
|
116
127
|
instructions?: string;
|
|
117
128
|
/** Voice name (e.g., 'Aoede', 'Charon') */
|
|
118
129
|
voice?: string;
|
|
130
|
+
affectiveDialog?: boolean;
|
|
131
|
+
proactiveAudio?: boolean;
|
|
132
|
+
transcribeAgent?: boolean;
|
|
133
|
+
transcribeUser?: boolean;
|
|
134
|
+
httpOptions?: Record<string, unknown>;
|
|
119
135
|
/** Agent greeting message */
|
|
120
136
|
greetingMessage?: string;
|
|
121
137
|
/** Input modalities (e.g., ['audio'], ['audio', 'text']) */
|
|
@@ -27,13 +27,17 @@ class OpenAIRealtime extends base_js_1.BaseMLLM {
|
|
|
27
27
|
this.options = options;
|
|
28
28
|
}
|
|
29
29
|
toConfig() {
|
|
30
|
-
const { apiKey, model, url, greetingMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
30
|
+
const { apiKey, model, voice, instructions, inputAudioTranscription, url, greetingMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
|
|
31
31
|
// Build params only when there is something to include.
|
|
32
32
|
// Previously `...(model && { params: ... })` silently dropped the
|
|
33
33
|
// entire params object when model was undefined — fixed by checking
|
|
34
34
|
// either field independently.
|
|
35
|
-
const mergedParams = Object.assign(Object.assign({}, (model !== undefined && { model })), params);
|
|
36
|
-
const hasParams = model !== undefined ||
|
|
35
|
+
const mergedParams = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (model !== undefined && { model })), params), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })), (inputAudioTranscription !== undefined && { input_audio_transcription: inputAudioTranscription }));
|
|
36
|
+
const hasParams = model !== undefined ||
|
|
37
|
+
params !== undefined ||
|
|
38
|
+
voice !== undefined ||
|
|
39
|
+
instructions !== undefined ||
|
|
40
|
+
inputAudioTranscription !== undefined;
|
|
37
41
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "openai", api_key: apiKey }, (url && { url })), (hasParams && { params: mergedParams })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -59,8 +63,8 @@ class GeminiLive extends base_js_1.BaseMLLM {
|
|
|
59
63
|
this.options = options;
|
|
60
64
|
}
|
|
61
65
|
toConfig() {
|
|
62
|
-
const { apiKey, model, url, instructions, voice, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
63
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
66
|
+
const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
67
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
exports.GeminiLive = GeminiLive;
|
|
@@ -87,8 +91,8 @@ class VertexAI extends base_js_1.BaseMLLM {
|
|
|
87
91
|
this.options = options;
|
|
88
92
|
}
|
|
89
93
|
toConfig() {
|
|
90
|
-
const { model, url, projectId, location, adcCredentialsString, instructions, voice, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
91
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai" }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model,
|
|
94
|
+
const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
|
|
95
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai" }, (url && { url })), { project_id: projectId, location, adc_credentials_string: adcCredentialsString, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
exports.VertexAI = VertexAI;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type-safe STT (Speech-to-Text) vendor classes.
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
5
|
-
import type { SttConfig } from "../types.js";
|
|
4
|
+
import { type DeepgramPresetModel } from "../presets.js";
|
|
5
|
+
import type { SttConfig, TurnDetectionLanguage } from "../types.js";
|
|
6
6
|
import { BaseSTT } from "./base.js";
|
|
7
7
|
/**
|
|
8
8
|
* Constructor options for Speechmatics STT.
|
|
@@ -14,6 +14,8 @@ export interface SpeechmaticsSTTOptions {
|
|
|
14
14
|
language: string;
|
|
15
15
|
/** Model name */
|
|
16
16
|
model?: string;
|
|
17
|
+
/** Speechmatics streaming WebSocket URL (for example, wss://eu2.rt.speechmatics.com/v2) */
|
|
18
|
+
uri?: string;
|
|
17
19
|
/** Additional vendor-specific parameters */
|
|
18
20
|
additionalParams?: Record<string, unknown>;
|
|
19
21
|
}
|
|
@@ -82,7 +84,7 @@ export interface MicrosoftSTTOptions {
|
|
|
82
84
|
/** Azure region (e.g., 'eastus', 'westus') */
|
|
83
85
|
region: string;
|
|
84
86
|
/** Language code (e.g., 'en-US', 'es-ES') */
|
|
85
|
-
language
|
|
87
|
+
language: string;
|
|
86
88
|
/** Additional vendor-specific parameters */
|
|
87
89
|
additionalParams?: Record<string, unknown>;
|
|
88
90
|
}
|
|
@@ -113,6 +115,10 @@ export interface OpenAISTTOptions {
|
|
|
113
115
|
model?: string;
|
|
114
116
|
/** Language code */
|
|
115
117
|
language?: string;
|
|
118
|
+
/** Prompt that guides OpenAI transcription */
|
|
119
|
+
prompt?: string;
|
|
120
|
+
/** Full OpenAI input_audio_transcription override */
|
|
121
|
+
inputAudioTranscription?: Record<string, unknown>;
|
|
116
122
|
/** Additional vendor-specific parameters */
|
|
117
123
|
additionalParams?: Record<string, unknown>;
|
|
118
124
|
}
|
|
@@ -135,10 +141,16 @@ export declare class OpenAISTT extends BaseSTT {
|
|
|
135
141
|
* Constructor options for Google Cloud Speech-to-Text STT.
|
|
136
142
|
*/
|
|
137
143
|
export interface GoogleSTTOptions {
|
|
138
|
-
/** Google Cloud
|
|
139
|
-
|
|
144
|
+
/** Google Cloud project ID where Speech-to-Text is enabled */
|
|
145
|
+
projectId: string;
|
|
146
|
+
/** Google Cloud region for the recognizer (for example, global) */
|
|
147
|
+
location: string;
|
|
148
|
+
/** Google service account credentials JSON string */
|
|
149
|
+
adcCredentialsString: string;
|
|
140
150
|
/** Language code (e.g., 'en-US', 'es-ES') */
|
|
141
|
-
language
|
|
151
|
+
language: string;
|
|
152
|
+
/** Recognition model to use */
|
|
153
|
+
model?: string;
|
|
142
154
|
/** Additional vendor-specific parameters */
|
|
143
155
|
additionalParams?: Record<string, unknown>;
|
|
144
156
|
}
|
|
@@ -148,7 +160,9 @@ export interface GoogleSTTOptions {
|
|
|
148
160
|
* @example
|
|
149
161
|
* ```typescript
|
|
150
162
|
* const stt = new GoogleSTT({
|
|
151
|
-
*
|
|
163
|
+
* projectId: process.env.GOOGLE_ASR_PROJECT_ID,
|
|
164
|
+
* location: 'global',
|
|
165
|
+
* adcCredentialsString: process.env.GOOGLE_APPLICATION_CREDENTIALS_STRING,
|
|
152
166
|
* language: 'en-US',
|
|
153
167
|
* });
|
|
154
168
|
* ```
|
|
@@ -169,7 +183,7 @@ export interface AmazonSTTOptions {
|
|
|
169
183
|
/** AWS region (e.g., 'us-east-1') */
|
|
170
184
|
region: string;
|
|
171
185
|
/** Language code */
|
|
172
|
-
language
|
|
186
|
+
language: string;
|
|
173
187
|
/** Additional vendor-specific parameters */
|
|
174
188
|
additionalParams?: Record<string, unknown>;
|
|
175
189
|
}
|
|
@@ -182,6 +196,7 @@ export interface AmazonSTTOptions {
|
|
|
182
196
|
* accessKey: process.env.AWS_ACCESS_KEY_ID,
|
|
183
197
|
* secretKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
184
198
|
* region: 'us-east-1',
|
|
199
|
+
* language: 'en-US',
|
|
185
200
|
* });
|
|
186
201
|
* ```
|
|
187
202
|
*/
|
|
@@ -197,7 +212,9 @@ export interface AssemblyAISTTOptions {
|
|
|
197
212
|
/** AssemblyAI API key */
|
|
198
213
|
apiKey: string;
|
|
199
214
|
/** Language code */
|
|
200
|
-
language
|
|
215
|
+
language: string;
|
|
216
|
+
/** AssemblyAI streaming WebSocket URL */
|
|
217
|
+
uri?: string;
|
|
201
218
|
/** Additional vendor-specific parameters */
|
|
202
219
|
additionalParams?: Record<string, unknown>;
|
|
203
220
|
}
|
|
@@ -208,6 +225,7 @@ export interface AssemblyAISTTOptions {
|
|
|
208
225
|
* ```typescript
|
|
209
226
|
* const stt = new AssemblyAISTT({
|
|
210
227
|
* apiKey: process.env.ASSEMBLYAI_API_KEY,
|
|
228
|
+
* language: 'en-US',
|
|
211
229
|
* });
|
|
212
230
|
* ```
|
|
213
231
|
*/
|
|
@@ -221,7 +239,7 @@ export declare class AssemblyAISTT extends BaseSTT {
|
|
|
221
239
|
*/
|
|
222
240
|
export interface AresSTTOptions {
|
|
223
241
|
/** Language code for ARES ASR */
|
|
224
|
-
language?:
|
|
242
|
+
language?: TurnDetectionLanguage;
|
|
225
243
|
/** Additional vendor-specific parameters */
|
|
226
244
|
additionalParams?: Record<string, unknown>;
|
|
227
245
|
}
|
|
@@ -231,7 +249,7 @@ export interface AresSTTOptions {
|
|
|
231
249
|
* @example
|
|
232
250
|
* ```typescript
|
|
233
251
|
* const stt = new AresSTT({
|
|
234
|
-
* language: 'en',
|
|
252
|
+
* language: 'en-US',
|
|
235
253
|
* });
|
|
236
254
|
* ```
|
|
237
255
|
*/
|