@deepgram/sdk 5.0.0-alpha.2 → 5.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/dist/browser/index.global.js +207 -60
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/CustomClient.d.ts +9 -1
- package/dist/cjs/CustomClient.js +131 -21
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +3 -43
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts +26 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.js +3 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.ts +28 -13
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js +19 -17
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.ts +28 -13
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.js +19 -17
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.ts +115 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.js +57 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.ts +18 -3
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.js +2 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/index.js +2 -0
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Results.d.ts +3 -3
- package/dist/cjs/api/types/SpeakV1SampleRate.d.ts +1 -1
- package/dist/cjs/api/types/SpeakV1SampleRate.js +1 -1
- 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/CustomClient.d.mts +9 -1
- package/dist/esm/CustomClient.mjs +131 -21
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +3 -43
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.mts +26 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.mjs +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.mts +28 -13
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.mjs +19 -17
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.mts +28 -13
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.mjs +19 -17
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.mts +115 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.mjs +54 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.mts +18 -3
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.mjs +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +2 -0
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Results.d.mts +3 -3
- package/dist/esm/api/types/SpeakV1SampleRate.d.mts +1 -1
- package/dist/esm/api/types/SpeakV1SampleRate.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -4
package/dist/cjs/CustomClient.js
CHANGED
|
@@ -73,13 +73,79 @@ catch (_a) {
|
|
|
73
73
|
// ws not available (e.g., in browser)
|
|
74
74
|
NodeWebSocket = undefined;
|
|
75
75
|
}
|
|
76
|
+
// Helper function to generate UUID that works in both Node.js and browser
|
|
77
|
+
function generateUUID() {
|
|
78
|
+
// In Node.js, use the crypto module
|
|
79
|
+
if (index_js_1.RUNTIME.type === "node") {
|
|
80
|
+
try {
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
82
|
+
const crypto = require("crypto");
|
|
83
|
+
return crypto.randomUUID();
|
|
84
|
+
}
|
|
85
|
+
catch (_a) {
|
|
86
|
+
// Fallback if crypto module is not available
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// In browser or as fallback, use global crypto if available
|
|
90
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
91
|
+
return crypto.randomUUID();
|
|
92
|
+
}
|
|
93
|
+
// Fallback UUID generation (RFC4122 version 4)
|
|
94
|
+
// This is a simple fallback that should work everywhere
|
|
95
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
96
|
+
const r = (Math.random() * 16) | 0;
|
|
97
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
98
|
+
return v.toString(16);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Wrapper auth provider that checks for accessToken first (Bearer scheme)
|
|
103
|
+
* before falling back to the original auth provider (Token scheme for API keys).
|
|
104
|
+
*/
|
|
105
|
+
class AccessTokenAuthProviderWrapper {
|
|
106
|
+
constructor(originalProvider, accessToken) {
|
|
107
|
+
this.originalProvider = originalProvider;
|
|
108
|
+
this.accessToken = accessToken;
|
|
109
|
+
}
|
|
110
|
+
getAuthRequest(arg) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
// Check for access token first (highest priority)
|
|
114
|
+
// Access tokens use Bearer scheme, API keys use Token scheme
|
|
115
|
+
const accessToken = (_a = (yield core.Supplier.get(this.accessToken))) !== null && _a !== void 0 ? _a : (_b = process.env) === null || _b === void 0 ? void 0 : _b.DEEPGRAM_ACCESS_TOKEN;
|
|
116
|
+
if (accessToken != null) {
|
|
117
|
+
return {
|
|
118
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Fall back to original provider (which handles API keys)
|
|
122
|
+
return this.originalProvider.getAuthRequest(arg);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
76
126
|
/**
|
|
77
127
|
* Custom wrapper around DeepgramClient that ensures the custom websocket implementation
|
|
78
128
|
* from ws.ts is always used, even if the auto-generated code changes.
|
|
79
129
|
*/
|
|
80
130
|
class CustomDeepgramClient extends Client_1.DeepgramClient {
|
|
81
131
|
constructor(options = {}) {
|
|
82
|
-
|
|
132
|
+
// Generate a UUID for the session ID
|
|
133
|
+
const sessionId = generateUUID();
|
|
134
|
+
// Add the session ID to headers so it's included in all REST requests
|
|
135
|
+
const optionsWithSessionId = Object.assign(Object.assign({}, options), { headers: Object.assign(Object.assign({}, options.headers), { "x-deepgram-session-id": sessionId }) });
|
|
136
|
+
super(optionsWithSessionId);
|
|
137
|
+
this._sessionId = sessionId;
|
|
138
|
+
// Wrap the auth provider to handle accessToken if provided
|
|
139
|
+
// This ensures accessToken takes priority over apiKey/env var
|
|
140
|
+
if (options.accessToken != null) {
|
|
141
|
+
this._options.authProvider = new AccessTokenAuthProviderWrapper(this._options.authProvider, options.accessToken);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the session ID that was generated for this client instance.
|
|
146
|
+
*/
|
|
147
|
+
get sessionId() {
|
|
148
|
+
return this._sessionId;
|
|
83
149
|
}
|
|
84
150
|
/**
|
|
85
151
|
* Override the agent getter to return a wrapped client that ensures
|
|
@@ -143,6 +209,25 @@ class WrappedSpeakClient extends Client_js_3.SpeakClient {
|
|
|
143
209
|
return new WrappedSpeakV1Client(this._options);
|
|
144
210
|
}
|
|
145
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Helper function to resolve Suppliers in headers to their actual values.
|
|
214
|
+
*/
|
|
215
|
+
function resolveHeaders(headers) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const resolved = {};
|
|
218
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
219
|
+
if (value == null) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
// Resolve Supplier if it's a Supplier, otherwise use the value directly
|
|
223
|
+
const resolvedValue = yield core.Supplier.get(value);
|
|
224
|
+
if (resolvedValue != null) {
|
|
225
|
+
resolved[key] = resolvedValue;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return resolved;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
146
231
|
/**
|
|
147
232
|
* Helper function to get WebSocket class and handle headers/protocols based on runtime.
|
|
148
233
|
* In Node.js, use the 'ws' library which supports headers.
|
|
@@ -152,6 +237,8 @@ function getWebSocketOptions(headers) {
|
|
|
152
237
|
const options = {};
|
|
153
238
|
// Check if we're in a browser environment (browser or web-worker)
|
|
154
239
|
const isBrowser = index_js_1.RUNTIME.type === "browser" || index_js_1.RUNTIME.type === "web-worker";
|
|
240
|
+
// Extract session ID header
|
|
241
|
+
const sessionIdHeader = headers["x-deepgram-session-id"] || headers["X-Deepgram-Session-Id"];
|
|
155
242
|
// In Node.js, ensure we use the 'ws' library which supports headers
|
|
156
243
|
if (index_js_1.RUNTIME.type === "node" && NodeWebSocket) {
|
|
157
244
|
options.WebSocket = NodeWebSocket;
|
|
@@ -162,10 +249,14 @@ function getWebSocketOptions(headers) {
|
|
|
162
249
|
// Extract Authorization header and use Sec-WebSocket-Protocol instead
|
|
163
250
|
const authHeader = headers.Authorization || headers.authorization;
|
|
164
251
|
const browserHeaders = Object.assign({}, headers);
|
|
165
|
-
// Remove Authorization from headers since
|
|
252
|
+
// Remove Authorization and session ID from headers since they won't work in browser
|
|
166
253
|
delete browserHeaders.Authorization;
|
|
167
254
|
delete browserHeaders.authorization;
|
|
255
|
+
delete browserHeaders["x-deepgram-session-id"];
|
|
256
|
+
delete browserHeaders["X-Deepgram-Session-Id"];
|
|
168
257
|
options.headers = browserHeaders;
|
|
258
|
+
// Build protocols array for browser WebSocket
|
|
259
|
+
const protocols = [];
|
|
169
260
|
// If we have an Authorization header, extract the token and format as protocols
|
|
170
261
|
// Deepgram expects:
|
|
171
262
|
// - For API keys: Sec-WebSocket-Protocol: token,API_KEY_GOES_HERE
|
|
@@ -175,18 +266,25 @@ function getWebSocketOptions(headers) {
|
|
|
175
266
|
if (authHeader.startsWith("Token ")) {
|
|
176
267
|
// API key: "Token API_KEY" -> ["token", "API_KEY"]
|
|
177
268
|
const apiKey = authHeader.substring(6); // Remove "Token " prefix
|
|
178
|
-
|
|
269
|
+
protocols.push("token", apiKey);
|
|
179
270
|
}
|
|
180
271
|
else if (authHeader.startsWith("Bearer ")) {
|
|
181
272
|
// Access token: "Bearer TOKEN" -> ["bearer", "TOKEN"]
|
|
182
273
|
const token = authHeader.substring(7); // Remove "Bearer " prefix
|
|
183
|
-
|
|
274
|
+
protocols.push("bearer", token);
|
|
184
275
|
}
|
|
185
276
|
else {
|
|
186
277
|
// Fallback: use the entire header value if it doesn't match expected format
|
|
187
|
-
|
|
278
|
+
protocols.push(authHeader);
|
|
188
279
|
}
|
|
189
280
|
}
|
|
281
|
+
// Add session ID as a protocol for browser WebSocket
|
|
282
|
+
if (sessionIdHeader && typeof sessionIdHeader === "string") {
|
|
283
|
+
protocols.push("x-deepgram-session-id", sessionIdHeader);
|
|
284
|
+
}
|
|
285
|
+
if (protocols.length > 0) {
|
|
286
|
+
options.protocols = protocols;
|
|
287
|
+
}
|
|
190
288
|
}
|
|
191
289
|
else {
|
|
192
290
|
// Fallback for other environments
|
|
@@ -200,17 +298,20 @@ function getWebSocketOptions(headers) {
|
|
|
200
298
|
class WrappedAgentV1Client extends Client_js_4.V1Client {
|
|
201
299
|
connect() {
|
|
202
300
|
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
203
|
-
var _a, _b, _c, _d, _e;
|
|
301
|
+
var _a, _b, _c, _d, _e, _f;
|
|
204
302
|
const { headers, debug, reconnectAttempts } = args;
|
|
205
303
|
// Get Authorization from authProvider (matching the working version)
|
|
206
304
|
const authRequest = yield ((_a = this._options.authProvider) === null || _a === void 0 ? void 0 : _a.getAuthRequest());
|
|
207
|
-
|
|
305
|
+
// Merge headers from options (which includes session ID), auth headers, and request headers
|
|
306
|
+
const mergedHeaders = (0, headers_js_1.mergeHeaders)((_b = this._options.headers) !== null && _b !== void 0 ? _b : {}, (_c = authRequest === null || authRequest === void 0 ? void 0 : authRequest.headers) !== null && _c !== void 0 ? _c : {}, headers);
|
|
307
|
+
// Resolve any Suppliers in headers to actual values
|
|
308
|
+
const _headers = yield resolveHeaders(mergedHeaders);
|
|
208
309
|
// Get WebSocket options with proper header handling
|
|
209
310
|
const wsOptions = getWebSocketOptions(_headers);
|
|
210
311
|
// Explicitly use the custom ReconnectingWebSocket from ws.ts
|
|
211
312
|
const socket = new ws_js_1.ReconnectingWebSocket({
|
|
212
|
-
url: core.url.join((
|
|
213
|
-
protocols: (
|
|
313
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.DeepgramEnvironment.Production).agent, "/v1/agent/converse"),
|
|
314
|
+
protocols: (_f = wsOptions.protocols) !== null && _f !== void 0 ? _f : [],
|
|
214
315
|
queryParameters: {},
|
|
215
316
|
headers: wsOptions.headers,
|
|
216
317
|
options: {
|
|
@@ -290,7 +391,7 @@ class WrappedAgentV1Socket extends Socket_js_1.V1Socket {
|
|
|
290
391
|
class WrappedListenV1Client extends Client_js_5.V1Client {
|
|
291
392
|
connect(args) {
|
|
292
393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
var _a, _b, _c;
|
|
394
|
+
var _a, _b, _c, _d;
|
|
294
395
|
// Extract all the args (same as the original implementation)
|
|
295
396
|
const { callback, callback_method: callbackMethod, channels, diarize, dictation, encoding, endpointing, extra, interim_results: interimResults, keyterm, keywords, language, mip_opt_out: mipOptOut, model, multichannel, numerals, profanity_filter: profanityFilter, punctuate, redact, replace, sample_rate: sampleRate, search, smart_format: smartFormat, tag, utterance_end_ms: utteranceEndMs, vad_events: vadEvents, version, headers, debug, reconnectAttempts, } = args;
|
|
296
397
|
// Build query params (same as original)
|
|
@@ -350,13 +451,16 @@ class WrappedListenV1Client extends Client_js_5.V1Client {
|
|
|
350
451
|
_queryParams.version = version;
|
|
351
452
|
// Get Authorization from authProvider (matching the working version)
|
|
352
453
|
const authRequest = yield this._options.authProvider.getAuthRequest();
|
|
353
|
-
|
|
454
|
+
// Merge headers from options (which includes session ID), auth headers, and request headers
|
|
455
|
+
const mergedHeaders = (0, headers_js_1.mergeHeaders)((_a = this._options.headers) !== null && _a !== void 0 ? _a : {}, authRequest.headers, headers);
|
|
456
|
+
// Resolve any Suppliers in headers to actual values
|
|
457
|
+
const _headers = yield resolveHeaders(mergedHeaders);
|
|
354
458
|
// Get WebSocket options with proper header handling
|
|
355
459
|
const wsOptions = getWebSocketOptions(_headers);
|
|
356
460
|
// Explicitly use the custom ReconnectingWebSocket from ws.ts
|
|
357
461
|
const socket = new ws_js_1.ReconnectingWebSocket({
|
|
358
|
-
url: core.url.join((
|
|
359
|
-
protocols: (
|
|
462
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.DeepgramEnvironment.Production).production, "/v1/listen"),
|
|
463
|
+
protocols: (_d = wsOptions.protocols) !== null && _d !== void 0 ? _d : [],
|
|
360
464
|
queryParameters: _queryParams,
|
|
361
465
|
headers: wsOptions.headers,
|
|
362
466
|
options: {
|
|
@@ -429,7 +533,7 @@ class WrappedListenV1Socket extends Socket_js_2.V1Socket {
|
|
|
429
533
|
class WrappedListenV2Client extends Client_js_6.V2Client {
|
|
430
534
|
connect(args) {
|
|
431
535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
-
var _a, _b, _c, _d, _e;
|
|
536
|
+
var _a, _b, _c, _d, _e, _f;
|
|
433
537
|
const { model, encoding, sample_rate: sampleRate, eager_eot_threshold: eagerEotThreshold, eot_threshold: eotThreshold, eot_timeout_ms: eotTimeoutMs, keyterm, mip_opt_out: mipOptOut, tag, headers, debug, reconnectAttempts, } = args;
|
|
434
538
|
const _queryParams = {};
|
|
435
539
|
_queryParams.model = model;
|
|
@@ -451,13 +555,16 @@ class WrappedListenV2Client extends Client_js_6.V2Client {
|
|
|
451
555
|
_queryParams.tag = tag;
|
|
452
556
|
// Get Authorization from authProvider (matching the working version)
|
|
453
557
|
const authRequest = yield ((_a = this._options.authProvider) === null || _a === void 0 ? void 0 : _a.getAuthRequest());
|
|
454
|
-
|
|
558
|
+
// Merge headers from options (which includes session ID), auth headers, and request headers
|
|
559
|
+
const mergedHeaders = (0, headers_js_1.mergeHeaders)((_b = this._options.headers) !== null && _b !== void 0 ? _b : {}, (_c = authRequest === null || authRequest === void 0 ? void 0 : authRequest.headers) !== null && _c !== void 0 ? _c : {}, headers);
|
|
560
|
+
// Resolve any Suppliers in headers to actual values
|
|
561
|
+
const _headers = yield resolveHeaders(mergedHeaders);
|
|
455
562
|
// Get WebSocket options with proper header handling
|
|
456
563
|
const wsOptions = getWebSocketOptions(_headers);
|
|
457
564
|
// Explicitly use the custom ReconnectingWebSocket from ws.ts
|
|
458
565
|
const socket = new ws_js_1.ReconnectingWebSocket({
|
|
459
|
-
url: core.url.join((
|
|
460
|
-
protocols: (
|
|
566
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.DeepgramEnvironment.Production).production, "/v2/listen"),
|
|
567
|
+
protocols: (_f = wsOptions.protocols) !== null && _f !== void 0 ? _f : [],
|
|
461
568
|
queryParameters: _queryParams,
|
|
462
569
|
headers: wsOptions.headers,
|
|
463
570
|
options: {
|
|
@@ -530,7 +637,7 @@ class WrappedListenV2Socket extends Socket_js_3.V2Socket {
|
|
|
530
637
|
class WrappedSpeakV1Client extends Client_js_7.V1Client {
|
|
531
638
|
connect(args) {
|
|
532
639
|
return __awaiter(this, void 0, void 0, function* () {
|
|
533
|
-
var _a, _b, _c;
|
|
640
|
+
var _a, _b, _c, _d;
|
|
534
641
|
const { encoding, mip_opt_out: mipOptOut, model, sample_rate: sampleRate, headers, debug, reconnectAttempts, } = args;
|
|
535
642
|
const _queryParams = {};
|
|
536
643
|
if (encoding != null)
|
|
@@ -543,13 +650,16 @@ class WrappedSpeakV1Client extends Client_js_7.V1Client {
|
|
|
543
650
|
_queryParams.sample_rate = sampleRate;
|
|
544
651
|
// Get Authorization from authProvider (matching the working version)
|
|
545
652
|
const authRequest = yield this._options.authProvider.getAuthRequest();
|
|
546
|
-
|
|
653
|
+
// Merge headers from options (which includes session ID), auth headers, and request headers
|
|
654
|
+
const mergedHeaders = (0, headers_js_1.mergeHeaders)((_a = this._options.headers) !== null && _a !== void 0 ? _a : {}, authRequest.headers, headers);
|
|
655
|
+
// Resolve any Suppliers in headers to actual values
|
|
656
|
+
const _headers = yield resolveHeaders(mergedHeaders);
|
|
547
657
|
// Get WebSocket options with proper header handling
|
|
548
658
|
const wsOptions = getWebSocketOptions(_headers);
|
|
549
659
|
// Explicitly use the custom ReconnectingWebSocket from ws.ts
|
|
550
660
|
const socket = new ws_js_1.ReconnectingWebSocket({
|
|
551
|
-
url: core.url.join((
|
|
552
|
-
protocols: (
|
|
661
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.DeepgramEnvironment.Production).production, "/v1/speak"),
|
|
662
|
+
protocols: (_d = wsOptions.protocols) !== null && _d !== void 0 ? _d : [],
|
|
553
663
|
queryParameters: _queryParams,
|
|
554
664
|
headers: wsOptions.headers,
|
|
555
665
|
options: {
|
|
@@ -73,7 +73,7 @@ export declare namespace AgentV1Settings {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
interface Agent {
|
|
76
|
-
/**
|
|
76
|
+
/** Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. */
|
|
77
77
|
language?: string;
|
|
78
78
|
/** Conversation context including the history of messages and function calls */
|
|
79
79
|
context?: Agent.Context;
|
|
@@ -120,22 +120,10 @@ export declare namespace AgentV1Settings {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
interface Listen {
|
|
123
|
-
provider?:
|
|
124
|
-
}
|
|
125
|
-
namespace Listen {
|
|
126
|
-
interface Provider {
|
|
127
|
-
/** Provider type for speech-to-text */
|
|
128
|
-
type: "deepgram";
|
|
129
|
-
/** Model to use for speech to text */
|
|
130
|
-
model?: string;
|
|
131
|
-
/** Prompt key-term recognition (nova-3 'en' only) */
|
|
132
|
-
keyterms?: string[];
|
|
133
|
-
/** Applies smart formatting to improve transcript readability (Deepgram providers only) */
|
|
134
|
-
smart_format?: boolean;
|
|
135
|
-
}
|
|
123
|
+
provider?: Deepgram.agent.AgentV1SettingsAgentListenProvider;
|
|
136
124
|
}
|
|
137
125
|
interface Think {
|
|
138
|
-
provider:
|
|
126
|
+
provider: Deepgram.agent.AgentV1SettingsAgentThinkProvider;
|
|
139
127
|
/** Optional for non-Deepgram LLM providers. When present, must include url field and headers object */
|
|
140
128
|
endpoint?: Think.Endpoint;
|
|
141
129
|
functions?: Think.Functions.Item[];
|
|
@@ -144,34 +132,6 @@ export declare namespace AgentV1Settings {
|
|
|
144
132
|
context_length?: Think.ContextLength;
|
|
145
133
|
}
|
|
146
134
|
namespace Think {
|
|
147
|
-
type Provider = {
|
|
148
|
-
type?: "open_ai" | undefined;
|
|
149
|
-
model?: ("gpt-5" | "gpt-5-mini" | "gpt-5-nano" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini") | undefined;
|
|
150
|
-
temperature?: number | undefined;
|
|
151
|
-
} | {
|
|
152
|
-
type?: "aws_bedrock" | undefined;
|
|
153
|
-
model?: ("anthropic/claude-3-5-sonnet-20240620-v1:0" | "anthropic/claude-3-5-haiku-20240307-v1:0") | undefined;
|
|
154
|
-
temperature?: number | undefined;
|
|
155
|
-
credentials?: {
|
|
156
|
-
type?: ("sts" | "iam") | undefined;
|
|
157
|
-
region?: string | undefined;
|
|
158
|
-
access_key_id?: string | undefined;
|
|
159
|
-
secret_access_key?: string | undefined;
|
|
160
|
-
session_token?: string | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
-
} | {
|
|
163
|
-
type?: "anthropic" | undefined;
|
|
164
|
-
model?: ("claude-3-5-haiku-latest" | "claude-sonnet-4-20250514") | undefined;
|
|
165
|
-
temperature?: number | undefined;
|
|
166
|
-
} | {
|
|
167
|
-
type?: "google" | undefined;
|
|
168
|
-
model?: ("gemini-2.0-flash" | "gemini-2.0-flash-lite" | "gemini-2.5-flash") | undefined;
|
|
169
|
-
temperature?: number | undefined;
|
|
170
|
-
} | {
|
|
171
|
-
type?: "groq" | undefined;
|
|
172
|
-
model?: "openai/gpt-oss-20b" | undefined;
|
|
173
|
-
temperature?: number | undefined;
|
|
174
|
-
};
|
|
175
135
|
/**
|
|
176
136
|
* Optional for non-Deepgram LLM providers. When present, must include url field and headers object
|
|
177
137
|
*/
|
package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as Deepgram from "../../../../../index.js";
|
|
2
|
+
export type AgentV1SettingsAgentListenProvider = Deepgram.agent.AgentV1SettingsAgentListenProvider.V1 | Deepgram.agent.AgentV1SettingsAgentListenProvider.V2;
|
|
3
|
+
export declare namespace AgentV1SettingsAgentListenProvider {
|
|
4
|
+
interface V1 {
|
|
5
|
+
version: "v1";
|
|
6
|
+
/** Provider type for speech-to-text */
|
|
7
|
+
type: "deepgram";
|
|
8
|
+
/** Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) */
|
|
9
|
+
model?: string;
|
|
10
|
+
/** Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. `en`), or `multi` for code-switching transcription */
|
|
11
|
+
language?: string;
|
|
12
|
+
/** Prompt keyterm recognition to improve Keyword Recall Rate */
|
|
13
|
+
keyterms?: string[];
|
|
14
|
+
/** Applies smart formatting to improve transcript readability */
|
|
15
|
+
smart_format?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface V2 {
|
|
18
|
+
version: "v2";
|
|
19
|
+
/** Provider type for speech-to-text */
|
|
20
|
+
type: "deepgram";
|
|
21
|
+
/** Model to use for speech to text using the V2 API (e.g. flux-general-en) */
|
|
22
|
+
model: string;
|
|
23
|
+
/** Prompt keyterm recognition to improve Keyword Recall Rate */
|
|
24
|
+
keyterms?: string[];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -3,10 +3,12 @@ export type AgentV1SettingsAgentSpeakEndpointProvider = Deepgram.agent.AgentV1Se
|
|
|
3
3
|
export declare namespace AgentV1SettingsAgentSpeakEndpointProvider {
|
|
4
4
|
interface Deepgram {
|
|
5
5
|
type: "deepgram";
|
|
6
|
+
/** The REST API version for the Deepgram text-to-speech API */
|
|
7
|
+
version?: "v1";
|
|
6
8
|
/** Deepgram TTS model */
|
|
7
|
-
model:
|
|
9
|
+
model: Deepgram.Model;
|
|
8
10
|
}
|
|
9
|
-
namespace
|
|
11
|
+
namespace Deepgram {
|
|
10
12
|
/** Deepgram TTS model */
|
|
11
13
|
const Model: {
|
|
12
14
|
readonly AuraAsteriaEn: "aura-asteria-en";
|
|
@@ -77,12 +79,16 @@ export declare namespace AgentV1SettingsAgentSpeakEndpointProvider {
|
|
|
77
79
|
}
|
|
78
80
|
interface ElevenLabs {
|
|
79
81
|
type: "eleven_labs";
|
|
82
|
+
/** The REST API version for the Deepgram text-to-speech API */
|
|
83
|
+
version?: "v1";
|
|
80
84
|
/** Eleven Labs model ID */
|
|
81
|
-
model_id:
|
|
82
|
-
/**
|
|
85
|
+
model_id: ElevenLabs.ModelId;
|
|
86
|
+
/** Optional language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API */
|
|
87
|
+
language?: string;
|
|
88
|
+
/** Use the `language` field instead. */
|
|
83
89
|
language_code?: string;
|
|
84
90
|
}
|
|
85
|
-
namespace
|
|
91
|
+
namespace ElevenLabs {
|
|
86
92
|
/** Eleven Labs model ID */
|
|
87
93
|
const ModelId: {
|
|
88
94
|
readonly ElevenTurboV25: "eleven_turbo_v2_5";
|
|
@@ -93,13 +99,18 @@ export declare namespace AgentV1SettingsAgentSpeakEndpointProvider {
|
|
|
93
99
|
}
|
|
94
100
|
interface Cartesia {
|
|
95
101
|
type: "cartesia";
|
|
102
|
+
/** The API version header for the Cartesia text-to-speech API */
|
|
103
|
+
version?: Cartesia.Version;
|
|
96
104
|
/** Cartesia model ID */
|
|
97
|
-
model_id:
|
|
98
|
-
voice:
|
|
105
|
+
model_id: Cartesia.ModelId;
|
|
106
|
+
voice: Cartesia.Voice;
|
|
99
107
|
/** Cartesia language code */
|
|
100
108
|
language?: string;
|
|
101
109
|
}
|
|
102
|
-
namespace
|
|
110
|
+
namespace Cartesia {
|
|
111
|
+
/** The API version header for the Cartesia text-to-speech API */
|
|
112
|
+
const Version: {};
|
|
113
|
+
type Version = (typeof Version)[keyof typeof Version];
|
|
103
114
|
/** Cartesia model ID */
|
|
104
115
|
const ModelId: {
|
|
105
116
|
readonly Sonic2: "sonic-2";
|
|
@@ -115,12 +126,14 @@ export declare namespace AgentV1SettingsAgentSpeakEndpointProvider {
|
|
|
115
126
|
}
|
|
116
127
|
interface OpenAi {
|
|
117
128
|
type: "open_ai";
|
|
129
|
+
/** The REST API version for the OpenAI text-to-speech API */
|
|
130
|
+
version?: "v1";
|
|
118
131
|
/** OpenAI TTS model */
|
|
119
|
-
model:
|
|
132
|
+
model: OpenAi.Model;
|
|
120
133
|
/** OpenAI voice */
|
|
121
|
-
voice:
|
|
134
|
+
voice: OpenAi.Voice;
|
|
122
135
|
}
|
|
123
|
-
namespace
|
|
136
|
+
namespace OpenAi {
|
|
124
137
|
/** OpenAI TTS model */
|
|
125
138
|
const Model: {
|
|
126
139
|
readonly Tts1: "tts-1";
|
|
@@ -142,8 +155,10 @@ export declare namespace AgentV1SettingsAgentSpeakEndpointProvider {
|
|
|
142
155
|
type: "aws_polly";
|
|
143
156
|
/** AWS Polly voice name */
|
|
144
157
|
voice: AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.Voice;
|
|
145
|
-
/** Language
|
|
146
|
-
|
|
158
|
+
/** Language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API */
|
|
159
|
+
language: string;
|
|
160
|
+
/** Use the `language` field instead. */
|
|
161
|
+
language_code?: string;
|
|
147
162
|
engine: AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.Engine;
|
|
148
163
|
credentials: AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.Credentials;
|
|
149
164
|
}
|
package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.AgentV1SettingsAgentSpeakEndpointProvider = void 0;
|
|
5
5
|
var AgentV1SettingsAgentSpeakEndpointProvider;
|
|
6
6
|
(function (AgentV1SettingsAgentSpeakEndpointProvider) {
|
|
7
|
-
let
|
|
8
|
-
(function (
|
|
7
|
+
let Deepgram;
|
|
8
|
+
(function (Deepgram) {
|
|
9
9
|
/** Deepgram TTS model */
|
|
10
|
-
|
|
10
|
+
Deepgram.Model = {
|
|
11
11
|
AuraAsteriaEn: "aura-asteria-en",
|
|
12
12
|
AuraLunaEn: "aura-luna-en",
|
|
13
13
|
AuraStellaEn: "aura-stella-en",
|
|
@@ -72,33 +72,35 @@ var AgentV1SettingsAgentSpeakEndpointProvider;
|
|
|
72
72
|
Aura2EstrellaEs: "aura-2-estrella-es",
|
|
73
73
|
Aura2JavierEs: "aura-2-javier-es",
|
|
74
74
|
};
|
|
75
|
-
})(
|
|
76
|
-
let
|
|
77
|
-
(function (
|
|
75
|
+
})(Deepgram = AgentV1SettingsAgentSpeakEndpointProvider.Deepgram || (AgentV1SettingsAgentSpeakEndpointProvider.Deepgram = {}));
|
|
76
|
+
let ElevenLabs;
|
|
77
|
+
(function (ElevenLabs) {
|
|
78
78
|
/** Eleven Labs model ID */
|
|
79
|
-
|
|
79
|
+
ElevenLabs.ModelId = {
|
|
80
80
|
ElevenTurboV25: "eleven_turbo_v2_5",
|
|
81
81
|
ElevenMonolingualV1: "eleven_monolingual_v1",
|
|
82
82
|
ElevenMultilingualV2: "eleven_multilingual_v2",
|
|
83
83
|
};
|
|
84
|
-
})(
|
|
85
|
-
let
|
|
86
|
-
(function (
|
|
84
|
+
})(ElevenLabs = AgentV1SettingsAgentSpeakEndpointProvider.ElevenLabs || (AgentV1SettingsAgentSpeakEndpointProvider.ElevenLabs = {}));
|
|
85
|
+
let Cartesia;
|
|
86
|
+
(function (Cartesia) {
|
|
87
|
+
/** The API version header for the Cartesia text-to-speech API */
|
|
88
|
+
Cartesia.Version = {};
|
|
87
89
|
/** Cartesia model ID */
|
|
88
|
-
|
|
90
|
+
Cartesia.ModelId = {
|
|
89
91
|
Sonic2: "sonic-2",
|
|
90
92
|
SonicMultilingual: "sonic-multilingual",
|
|
91
93
|
};
|
|
92
|
-
})(
|
|
93
|
-
let
|
|
94
|
-
(function (
|
|
94
|
+
})(Cartesia = AgentV1SettingsAgentSpeakEndpointProvider.Cartesia || (AgentV1SettingsAgentSpeakEndpointProvider.Cartesia = {}));
|
|
95
|
+
let OpenAi;
|
|
96
|
+
(function (OpenAi) {
|
|
95
97
|
/** OpenAI TTS model */
|
|
96
|
-
|
|
98
|
+
OpenAi.Model = {
|
|
97
99
|
Tts1: "tts-1",
|
|
98
100
|
Tts1Hd: "tts-1-hd",
|
|
99
101
|
};
|
|
100
102
|
/** OpenAI voice */
|
|
101
|
-
|
|
103
|
+
OpenAi.Voice = {
|
|
102
104
|
Alloy: "alloy",
|
|
103
105
|
Echo: "echo",
|
|
104
106
|
Fable: "fable",
|
|
@@ -106,7 +108,7 @@ var AgentV1SettingsAgentSpeakEndpointProvider;
|
|
|
106
108
|
Nova: "nova",
|
|
107
109
|
Shimmer: "shimmer",
|
|
108
110
|
};
|
|
109
|
-
})(
|
|
111
|
+
})(OpenAi = AgentV1SettingsAgentSpeakEndpointProvider.OpenAi || (AgentV1SettingsAgentSpeakEndpointProvider.OpenAi = {}));
|
|
110
112
|
let AgentV1SettingsAgentSpeakEndpointProviderAwsPolly;
|
|
111
113
|
(function (AgentV1SettingsAgentSpeakEndpointProviderAwsPolly) {
|
|
112
114
|
/** AWS Polly voice name */
|
|
@@ -3,10 +3,12 @@ export type AgentV1SettingsAgentSpeakOneItemProvider = Deepgram.agent.AgentV1Set
|
|
|
3
3
|
export declare namespace AgentV1SettingsAgentSpeakOneItemProvider {
|
|
4
4
|
interface Deepgram {
|
|
5
5
|
type: "deepgram";
|
|
6
|
+
/** The REST API version for the Deepgram text-to-speech API */
|
|
7
|
+
version?: "v1";
|
|
6
8
|
/** Deepgram TTS model */
|
|
7
|
-
model:
|
|
9
|
+
model: Deepgram.Model;
|
|
8
10
|
}
|
|
9
|
-
namespace
|
|
11
|
+
namespace Deepgram {
|
|
10
12
|
/** Deepgram TTS model */
|
|
11
13
|
const Model: {
|
|
12
14
|
readonly AuraAsteriaEn: "aura-asteria-en";
|
|
@@ -77,12 +79,16 @@ export declare namespace AgentV1SettingsAgentSpeakOneItemProvider {
|
|
|
77
79
|
}
|
|
78
80
|
interface ElevenLabs {
|
|
79
81
|
type: "eleven_labs";
|
|
82
|
+
/** The REST API version for the Deepgram text-to-speech API */
|
|
83
|
+
version?: "v1";
|
|
80
84
|
/** Eleven Labs model ID */
|
|
81
|
-
model_id:
|
|
82
|
-
/**
|
|
85
|
+
model_id: ElevenLabs.ModelId;
|
|
86
|
+
/** Optional language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API */
|
|
87
|
+
language?: string;
|
|
88
|
+
/** Use the `language` field instead. */
|
|
83
89
|
language_code?: string;
|
|
84
90
|
}
|
|
85
|
-
namespace
|
|
91
|
+
namespace ElevenLabs {
|
|
86
92
|
/** Eleven Labs model ID */
|
|
87
93
|
const ModelId: {
|
|
88
94
|
readonly ElevenTurboV25: "eleven_turbo_v2_5";
|
|
@@ -93,13 +99,18 @@ export declare namespace AgentV1SettingsAgentSpeakOneItemProvider {
|
|
|
93
99
|
}
|
|
94
100
|
interface Cartesia {
|
|
95
101
|
type: "cartesia";
|
|
102
|
+
/** The API version header for the Cartesia text-to-speech API */
|
|
103
|
+
version?: Cartesia.Version;
|
|
96
104
|
/** Cartesia model ID */
|
|
97
|
-
model_id:
|
|
98
|
-
voice:
|
|
105
|
+
model_id: Cartesia.ModelId;
|
|
106
|
+
voice: Cartesia.Voice;
|
|
99
107
|
/** Cartesia language code */
|
|
100
108
|
language?: string;
|
|
101
109
|
}
|
|
102
|
-
namespace
|
|
110
|
+
namespace Cartesia {
|
|
111
|
+
/** The API version header for the Cartesia text-to-speech API */
|
|
112
|
+
const Version: {};
|
|
113
|
+
type Version = (typeof Version)[keyof typeof Version];
|
|
103
114
|
/** Cartesia model ID */
|
|
104
115
|
const ModelId: {
|
|
105
116
|
readonly Sonic2: "sonic-2";
|
|
@@ -115,12 +126,14 @@ export declare namespace AgentV1SettingsAgentSpeakOneItemProvider {
|
|
|
115
126
|
}
|
|
116
127
|
interface OpenAi {
|
|
117
128
|
type: "open_ai";
|
|
129
|
+
/** The REST API version for the OpenAI text-to-speech API */
|
|
130
|
+
version?: "v1";
|
|
118
131
|
/** OpenAI TTS model */
|
|
119
|
-
model:
|
|
132
|
+
model: OpenAi.Model;
|
|
120
133
|
/** OpenAI voice */
|
|
121
|
-
voice:
|
|
134
|
+
voice: OpenAi.Voice;
|
|
122
135
|
}
|
|
123
|
-
namespace
|
|
136
|
+
namespace OpenAi {
|
|
124
137
|
/** OpenAI TTS model */
|
|
125
138
|
const Model: {
|
|
126
139
|
readonly Tts1: "tts-1";
|
|
@@ -142,8 +155,10 @@ export declare namespace AgentV1SettingsAgentSpeakOneItemProvider {
|
|
|
142
155
|
type: "aws_polly";
|
|
143
156
|
/** AWS Polly voice name */
|
|
144
157
|
voice: AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.Voice;
|
|
145
|
-
/** Language code
|
|
146
|
-
|
|
158
|
+
/** Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API */
|
|
159
|
+
language: string;
|
|
160
|
+
/** Use the `language` field instead. */
|
|
161
|
+
language_code?: string;
|
|
147
162
|
engine: AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.Engine;
|
|
148
163
|
credentials: AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.Credentials;
|
|
149
164
|
}
|