retell-sdk 4.7.0 → 4.9.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +21 -8
  3. package/_shims/node-types.d.ts +1 -1
  4. package/core.d.ts +9 -6
  5. package/core.d.ts.map +1 -1
  6. package/core.js +25 -9
  7. package/core.js.map +1 -1
  8. package/core.mjs +22 -7
  9. package/core.mjs.map +1 -1
  10. package/error.d.ts.map +1 -1
  11. package/index.d.mts +19 -34
  12. package/index.d.ts +19 -34
  13. package/index.d.ts.map +1 -1
  14. package/index.js +30 -10
  15. package/index.js.map +1 -1
  16. package/index.mjs +17 -10
  17. package/index.mjs.map +1 -1
  18. package/package.json +3 -3
  19. package/resources/agent.d.ts +87 -19
  20. package/resources/agent.d.ts.map +1 -1
  21. package/resources/agent.js +0 -2
  22. package/resources/agent.js.map +1 -1
  23. package/resources/agent.mjs +0 -2
  24. package/resources/agent.mjs.map +1 -1
  25. package/resources/call.d.ts +2 -10
  26. package/resources/call.d.ts.map +1 -1
  27. package/resources/call.js +1 -3
  28. package/resources/call.js.map +1 -1
  29. package/resources/call.mjs +1 -3
  30. package/resources/call.mjs.map +1 -1
  31. package/resources/concurrency.d.ts +1 -2
  32. package/resources/concurrency.d.ts.map +1 -1
  33. package/resources/concurrency.js +0 -2
  34. package/resources/concurrency.js.map +1 -1
  35. package/resources/concurrency.mjs +0 -2
  36. package/resources/concurrency.mjs.map +1 -1
  37. package/resources/index.d.ts +7 -6
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +3 -2
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/knowledge-base.d.ts +144 -0
  44. package/resources/knowledge-base.d.ts.map +1 -0
  45. package/resources/knowledge-base.js +60 -0
  46. package/resources/knowledge-base.js.map +1 -0
  47. package/resources/knowledge-base.mjs +33 -0
  48. package/resources/knowledge-base.mjs.map +1 -0
  49. package/resources/llm.d.ts +244 -28
  50. package/resources/llm.d.ts.map +1 -1
  51. package/resources/llm.js +0 -2
  52. package/resources/llm.js.map +1 -1
  53. package/resources/llm.mjs +0 -2
  54. package/resources/llm.mjs.map +1 -1
  55. package/resources/phone-number.d.ts +1 -6
  56. package/resources/phone-number.d.ts.map +1 -1
  57. package/resources/phone-number.js +0 -2
  58. package/resources/phone-number.js.map +1 -1
  59. package/resources/phone-number.mjs +0 -2
  60. package/resources/phone-number.mjs.map +1 -1
  61. package/resources/voice.d.ts +1 -3
  62. package/resources/voice.d.ts.map +1 -1
  63. package/resources/voice.js +0 -2
  64. package/resources/voice.js.map +1 -1
  65. package/resources/voice.mjs +0 -2
  66. package/resources/voice.mjs.map +1 -1
  67. package/shims/node.d.ts +1 -0
  68. package/shims/node.d.ts.map +1 -1
  69. package/src/_shims/node-types.d.ts +1 -1
  70. package/src/core.ts +39 -13
  71. package/src/error.ts +1 -1
  72. package/src/index.ts +98 -42
  73. package/src/resources/agent.ts +109 -21
  74. package/src/resources/call.ts +12 -11
  75. package/src/resources/concurrency.ts +2 -3
  76. package/src/resources/index.ts +35 -17
  77. package/src/resources/knowledge-base.ts +200 -0
  78. package/src/resources/llm.ts +313 -30
  79. package/src/resources/phone-number.ts +8 -7
  80. package/src/resources/voice.ts +2 -4
  81. package/src/version.ts +1 -1
  82. package/version.d.ts +1 -1
  83. package/version.js +1 -1
  84. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"voice.js","sourceRoot":"","sources":["../src/resources/voice.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAI1C,MAAa,KAAM,SAAQ,sBAAW;IACpC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAdD,sBAcC;AAyCD,WAAiB,KAAK;AAGtB,CAAC,EAHgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAGrB"}
1
+ {"version":3,"file":"voice.js","sourceRoot":"","sources":["../src/resources/voice.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,KAAM,SAAQ,sBAAW;IACpC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAdD,sBAcC"}
@@ -14,6 +14,4 @@ export class Voice extends APIResource {
14
14
  return this._client.get('/list-voices', options);
15
15
  }
16
16
  }
17
- (function (Voice) {
18
- })(Voice || (Voice = {}));
19
17
  //# sourceMappingURL=voice.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"voice.mjs","sourceRoot":"","sources":["../src/resources/voice.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAyCD,WAAiB,KAAK;AAGtB,CAAC,EAHgB,KAAK,KAAL,KAAK,QAGrB"}
1
+ {"version":3,"file":"voice.mjs","sourceRoot":"","sources":["../src/resources/voice.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF"}
package/shims/node.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
 
3
3
 
4
+
4
5
  import * as types from "../_shims/node-types.js";
5
6
  declare module '../_shims/manual-types' {
6
7
  namespace manual {
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
7
7
  export { type Agent } from 'node:http';
8
8
  export { type Readable } from 'node:stream';
9
9
  export { type ReadStream as FsReadStream } from 'node:fs';
10
- export { ReadableStream } from 'web-streams-polyfill';
10
+ export { ReadableStream } from 'node:stream/web';
11
11
 
12
12
  export const fetch: typeof nf.default;
13
13
 
package/src/core.ts CHANGED
@@ -84,8 +84,10 @@ export class APIPromise<T> extends Promise<T> {
84
84
  });
85
85
  }
86
86
 
87
- _thenUnwrap<U>(transform: (data: T) => U): APIPromise<U> {
88
- return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props)));
87
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U> {
88
+ return new APIPromise(this.responsePromise, async (props) =>
89
+ transform(await this.parseResponse(props), props),
90
+ );
89
91
  }
90
92
 
91
93
  /**
@@ -274,7 +276,10 @@ export abstract class APIClient {
274
276
  return null;
275
277
  }
276
278
 
277
- buildRequest<Req>(options: FinalRequestOptions<Req>): { req: RequestInit; url: string; timeout: number } {
279
+ buildRequest<Req>(
280
+ options: FinalRequestOptions<Req>,
281
+ { retryCount = 0 }: { retryCount?: number } = {},
282
+ ): { req: RequestInit; url: string; timeout: number } {
278
283
  const { method, path, query, headers: headers = {} } = options;
279
284
 
280
285
  const body =
@@ -306,7 +311,7 @@ export abstract class APIClient {
306
311
  headers[this.idempotencyHeader] = options.idempotencyKey;
307
312
  }
308
313
 
309
- const reqHeaders = this.buildHeaders({ options, headers, contentLength });
314
+ const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
310
315
 
311
316
  const req: RequestInit = {
312
317
  method,
@@ -325,10 +330,12 @@ export abstract class APIClient {
325
330
  options,
326
331
  headers,
327
332
  contentLength,
333
+ retryCount,
328
334
  }: {
329
335
  options: FinalRequestOptions;
330
336
  headers: Record<string, string | null | undefined>;
331
337
  contentLength: string | null | undefined;
338
+ retryCount: number;
332
339
  }): Record<string, string> {
333
340
  const reqHeaders: Record<string, string> = {};
334
341
  if (contentLength) {
@@ -344,6 +351,16 @@ export abstract class APIClient {
344
351
  delete reqHeaders['content-type'];
345
352
  }
346
353
 
354
+ // Don't set the retry count header if it was already set or removed through default headers or by the
355
+ // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
356
+ // account for the removal case.
357
+ if (
358
+ getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
359
+ getHeader(headers, 'x-stainless-retry-count') === undefined
360
+ ) {
361
+ reqHeaders['x-stainless-retry-count'] = String(retryCount);
362
+ }
363
+
347
364
  this.validateHeaders(reqHeaders, headers);
348
365
 
349
366
  return reqHeaders;
@@ -379,7 +396,7 @@ export abstract class APIClient {
379
396
  error: Object | undefined,
380
397
  message: string | undefined,
381
398
  headers: Headers | undefined,
382
- ) {
399
+ ): APIError {
383
400
  return APIError.generate(status, error, message, headers);
384
401
  }
385
402
 
@@ -395,13 +412,14 @@ export abstract class APIClient {
395
412
  retriesRemaining: number | null,
396
413
  ): Promise<APIResponseProps> {
397
414
  const options = await optionsInput;
415
+ const maxRetries = options.maxRetries ?? this.maxRetries;
398
416
  if (retriesRemaining == null) {
399
- retriesRemaining = options.maxRetries ?? this.maxRetries;
417
+ retriesRemaining = maxRetries;
400
418
  }
401
419
 
402
420
  await this.prepareOptions(options);
403
421
 
404
- const { req, url, timeout } = this.buildRequest(options);
422
+ const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
405
423
 
406
424
  await this.prepareRequest(req, { url, options });
407
425
 
@@ -650,9 +668,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
650
668
  return await this.#client.requestAPIList(this.constructor as any, nextOptions);
651
669
  }
652
670
 
653
- async *iterPages() {
671
+ async *iterPages(): AsyncGenerator<this> {
654
672
  // eslint-disable-next-line @typescript-eslint/no-this-alias
655
- let page: AbstractPage<Item> = this;
673
+ let page: this = this;
656
674
  yield page;
657
675
  while (page.hasNextPage()) {
658
676
  page = await page.getNextPage();
@@ -660,7 +678,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
660
678
  }
661
679
  }
662
680
 
663
- async *[Symbol.asyncIterator]() {
681
+ async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
664
682
  for await (const page of this.iterPages()) {
665
683
  for (const item of page.getPaginatedItems()) {
666
684
  yield item;
@@ -703,7 +721,7 @@ export class PagePromise<
703
721
  * console.log(item)
704
722
  * }
705
723
  */
706
- async *[Symbol.asyncIterator]() {
724
+ async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
707
725
  const page = await this;
708
726
  for await (const item of page) {
709
727
  yield item;
@@ -1120,7 +1138,15 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
1120
1138
  return typeof headers?.get === 'function';
1121
1139
  };
1122
1140
 
1123
- export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
1141
+ export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => {
1142
+ const foundHeader = getHeader(headers, header);
1143
+ if (foundHeader === undefined) {
1144
+ throw new Error(`Could not find ${header} header`);
1145
+ }
1146
+ return foundHeader;
1147
+ };
1148
+
1149
+ export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => {
1124
1150
  const lowerCasedHeader = header.toLowerCase();
1125
1151
  if (isHeadersProtocol(headers)) {
1126
1152
  // to deal with the case where the header looks like Stainless-Event-Id
@@ -1146,7 +1172,7 @@ export const getRequiredHeader = (headers: HeadersLike, header: string): string
1146
1172
  }
1147
1173
  }
1148
1174
 
1149
- throw new Error(`Could not find ${header} header`);
1175
+ return undefined;
1150
1176
  };
1151
1177
 
1152
1178
  /**
package/src/error.ts CHANGED
@@ -47,7 +47,7 @@ export class APIError extends RetellError {
47
47
  errorResponse: Object | undefined,
48
48
  message: string | undefined,
49
49
  headers: Headers | undefined,
50
- ) {
50
+ ): APIError {
51
51
  if (!status) {
52
52
  return new APIConnectionError({ message, cause: castToError(errorResponse) });
53
53
  }
package/src/index.ts CHANGED
@@ -1,10 +1,45 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Errors from './error';
4
- import * as Uploads from './uploads';
5
3
  import { type Agent } from './_shims/index';
6
4
  import * as Core from './core';
5
+ import * as Errors from './error';
6
+ import * as Uploads from './uploads';
7
7
  import * as API from './resources/index';
8
+ import {
9
+ Agent as AgentAPIAgent,
10
+ AgentCreateParams,
11
+ AgentListResponse,
12
+ AgentResponse,
13
+ AgentUpdateParams,
14
+ } from './resources/agent';
15
+ import {
16
+ Call,
17
+ CallCreatePhoneCallParams,
18
+ CallCreateWebCallParams,
19
+ CallListParams,
20
+ CallListResponse,
21
+ CallRegisterPhoneCallParams,
22
+ CallResponse,
23
+ PhoneCallResponse,
24
+ WebCallResponse,
25
+ } from './resources/call';
26
+ import { Concurrency, ConcurrencyRetrieveResponse } from './resources/concurrency';
27
+ import {
28
+ KnowledgeBase,
29
+ KnowledgeBaseCreateParams,
30
+ KnowledgeBaseListResponse,
31
+ KnowledgeBaseResponse,
32
+ } from './resources/knowledge-base';
33
+ import { Llm, LlmCreateParams, LlmListResponse, LlmResponse, LlmUpdateParams } from './resources/llm';
34
+ import {
35
+ PhoneNumber,
36
+ PhoneNumberCreateParams,
37
+ PhoneNumberImportParams,
38
+ PhoneNumberListResponse,
39
+ PhoneNumberResponse,
40
+ PhoneNumberUpdateParams,
41
+ } from './resources/phone-number';
42
+ import { Voice, VoiceListResponse, VoiceResponse } from './resources/voice';
8
43
  import * as Webhooks from "./lib/webhook_auth";
9
44
 
10
45
  export interface ClientOptions {
@@ -117,6 +152,7 @@ export class Retell extends Core.APIClient {
117
152
  phoneNumber: API.PhoneNumber = new API.PhoneNumber(this);
118
153
  agent: API.Agent = new API.Agent(this);
119
154
  llm: API.Llm = new API.Llm(this);
155
+ knowledgeBase: API.KnowledgeBase = new API.KnowledgeBase(this);
120
156
  voice: API.Voice = new API.Voice(this);
121
157
  concurrency: API.Concurrency = new API.Concurrency(this);
122
158
 
@@ -159,7 +195,7 @@ export class Retell extends Core.APIClient {
159
195
  static sign = Webhooks.sign;
160
196
  }
161
197
 
162
- export const {
198
+ export {
163
199
  RetellError,
164
200
  APIError,
165
201
  APIConnectionError,
@@ -173,49 +209,69 @@ export const {
173
209
  InternalServerError,
174
210
  PermissionDeniedError,
175
211
  UnprocessableEntityError,
176
- } = Errors;
212
+ } from './error';
177
213
 
178
214
  export import toFile = Uploads.toFile;
179
215
  export import fileFromPath = Uploads.fileFromPath;
180
216
 
181
- export namespace Retell {
182
- export import RequestOptions = Core.RequestOptions;
183
-
184
- export import Call = API.Call;
185
- export import CallResponse = API.CallResponse;
186
- export import PhoneCallResponse = API.PhoneCallResponse;
187
- export import WebCallResponse = API.WebCallResponse;
188
- export import CallListResponse = API.CallListResponse;
189
- export import CallListParams = API.CallListParams;
190
- export import CallCreatePhoneCallParams = API.CallCreatePhoneCallParams;
191
- export import CallCreateWebCallParams = API.CallCreateWebCallParams;
192
- export import CallRegisterPhoneCallParams = API.CallRegisterPhoneCallParams;
193
-
194
- export import PhoneNumber = API.PhoneNumber;
195
- export import PhoneNumberResponse = API.PhoneNumberResponse;
196
- export import PhoneNumberListResponse = API.PhoneNumberListResponse;
197
- export import PhoneNumberCreateParams = API.PhoneNumberCreateParams;
198
- export import PhoneNumberUpdateParams = API.PhoneNumberUpdateParams;
199
- export import PhoneNumberImportParams = API.PhoneNumberImportParams;
200
-
201
- export import Agent = API.Agent;
202
- export import AgentResponse = API.AgentResponse;
203
- export import AgentListResponse = API.AgentListResponse;
204
- export import AgentCreateParams = API.AgentCreateParams;
205
- export import AgentUpdateParams = API.AgentUpdateParams;
206
-
207
- export import Llm = API.Llm;
208
- export import LlmResponse = API.LlmResponse;
209
- export import LlmListResponse = API.LlmListResponse;
210
- export import LlmCreateParams = API.LlmCreateParams;
211
- export import LlmUpdateParams = API.LlmUpdateParams;
212
-
213
- export import Voice = API.Voice;
214
- export import VoiceResponse = API.VoiceResponse;
215
- export import VoiceListResponse = API.VoiceListResponse;
216
-
217
- export import Concurrency = API.Concurrency;
218
- export import ConcurrencyRetrieveResponse = API.ConcurrencyRetrieveResponse;
217
+ Retell.Call = Call;
218
+ Retell.PhoneNumber = PhoneNumber;
219
+ Retell.Agent = AgentAPIAgent;
220
+ Retell.Llm = Llm;
221
+ Retell.KnowledgeBase = KnowledgeBase;
222
+ Retell.Voice = Voice;
223
+ Retell.Concurrency = Concurrency;
224
+
225
+ export declare namespace Retell {
226
+ export type RequestOptions = Core.RequestOptions;
227
+
228
+ export {
229
+ Call as Call,
230
+ type CallResponse as CallResponse,
231
+ type PhoneCallResponse as PhoneCallResponse,
232
+ type WebCallResponse as WebCallResponse,
233
+ type CallListResponse as CallListResponse,
234
+ type CallListParams as CallListParams,
235
+ type CallCreatePhoneCallParams as CallCreatePhoneCallParams,
236
+ type CallCreateWebCallParams as CallCreateWebCallParams,
237
+ type CallRegisterPhoneCallParams as CallRegisterPhoneCallParams,
238
+ };
239
+
240
+ export {
241
+ PhoneNumber as PhoneNumber,
242
+ type PhoneNumberResponse as PhoneNumberResponse,
243
+ type PhoneNumberListResponse as PhoneNumberListResponse,
244
+ type PhoneNumberCreateParams as PhoneNumberCreateParams,
245
+ type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
246
+ type PhoneNumberImportParams as PhoneNumberImportParams,
247
+ };
248
+
249
+ export {
250
+ AgentAPIAgent as Agent,
251
+ type AgentResponse as AgentResponse,
252
+ type AgentListResponse as AgentListResponse,
253
+ type AgentCreateParams as AgentCreateParams,
254
+ type AgentUpdateParams as AgentUpdateParams,
255
+ };
256
+
257
+ export {
258
+ Llm as Llm,
259
+ type LlmResponse as LlmResponse,
260
+ type LlmListResponse as LlmListResponse,
261
+ type LlmCreateParams as LlmCreateParams,
262
+ type LlmUpdateParams as LlmUpdateParams,
263
+ };
264
+
265
+ export {
266
+ KnowledgeBase as KnowledgeBase,
267
+ type KnowledgeBaseResponse as KnowledgeBaseResponse,
268
+ type KnowledgeBaseListResponse as KnowledgeBaseListResponse,
269
+ type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams,
270
+ };
271
+
272
+ export { Voice as Voice, type VoiceResponse as VoiceResponse, type VoiceListResponse as VoiceListResponse };
273
+
274
+ export { Concurrency as Concurrency, type ConcurrencyRetrieveResponse as ConcurrencyRetrieveResponse };
219
275
  }
220
276
 
221
277
  export default Retell;
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
- import * as AgentAPI from './agent';
6
5
 
7
6
  export class Agent extends APIResource {
8
7
  /**
@@ -61,11 +60,9 @@ export interface AgentResponse {
61
60
  last_modification_timestamp: number;
62
61
 
63
62
  /**
64
- * The URL we will establish LLM websocket for getting response, usually your
65
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
66
- * request format (sent from us) and response format (send to us).
63
+ * The response engine to use for the agent.
67
64
  */
68
- llm_websocket_url: string;
65
+ response_engine: AgentResponse.ResponseEngineRetellLm | AgentResponse.ResponseEngineCustomLm;
69
66
 
70
67
  /**
71
68
  * Unique voice id used for the agent. Find list of available voices and their
@@ -152,6 +149,13 @@ export interface AgentResponse {
152
149
  */
153
150
  enable_backchannel?: boolean;
154
151
 
152
+ /**
153
+ * If set to true, will format transcription to number, date, email, etc. If set to
154
+ * false, will return transcripts in raw words. If not set, default value of true
155
+ * will apply.
156
+ */
157
+ enable_transcription_formatting?: boolean;
158
+
155
159
  /**
156
160
  * If set to true, will detect whether the call enters a voicemail. Note that this
157
161
  * feature is only available for phone calls.
@@ -337,6 +341,30 @@ export interface AgentResponse {
337
341
  }
338
342
 
339
343
  export namespace AgentResponse {
344
+ export interface ResponseEngineRetellLm {
345
+ /**
346
+ * id of the Retell LLM to use.
347
+ */
348
+ llm_id: string;
349
+
350
+ /**
351
+ * type of the response engine.
352
+ */
353
+ type: 'retell-llm';
354
+ }
355
+
356
+ export interface ResponseEngineCustomLm {
357
+ /**
358
+ * LLM websocket url of the custom LLM.
359
+ */
360
+ llm_websocket_url: string;
361
+
362
+ /**
363
+ * type of the response engine.
364
+ */
365
+ type: 'custom-llm';
366
+ }
367
+
340
368
  export interface StringAnalysisData {
341
369
  /**
342
370
  * Description of the variable.
@@ -437,11 +465,9 @@ export type AgentListResponse = Array<AgentResponse>;
437
465
 
438
466
  export interface AgentCreateParams {
439
467
  /**
440
- * The URL we will establish LLM websocket for getting response, usually your
441
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
442
- * request format (sent from us) and response format (send to us).
468
+ * The response engine to use for the agent.
443
469
  */
444
- llm_websocket_url: string;
470
+ response_engine: AgentCreateParams.ResponseEngineRetellLm | AgentCreateParams.ResponseEngineCustomLm;
445
471
 
446
472
  /**
447
473
  * Unique voice id used for the agent. Find list of available voices and their
@@ -528,6 +554,13 @@ export interface AgentCreateParams {
528
554
  */
529
555
  enable_backchannel?: boolean;
530
556
 
557
+ /**
558
+ * If set to true, will format transcription to number, date, email, etc. If set to
559
+ * false, will return transcripts in raw words. If not set, default value of true
560
+ * will apply.
561
+ */
562
+ enable_transcription_formatting?: boolean;
563
+
531
564
  /**
532
565
  * If set to true, will detect whether the call enters a voicemail. Note that this
533
566
  * feature is only available for phone calls.
@@ -713,6 +746,30 @@ export interface AgentCreateParams {
713
746
  }
714
747
 
715
748
  export namespace AgentCreateParams {
749
+ export interface ResponseEngineRetellLm {
750
+ /**
751
+ * id of the Retell LLM to use.
752
+ */
753
+ llm_id: string;
754
+
755
+ /**
756
+ * type of the response engine.
757
+ */
758
+ type: 'retell-llm';
759
+ }
760
+
761
+ export interface ResponseEngineCustomLm {
762
+ /**
763
+ * LLM websocket url of the custom LLM.
764
+ */
765
+ llm_websocket_url: string;
766
+
767
+ /**
768
+ * type of the response engine.
769
+ */
770
+ type: 'custom-llm';
771
+ }
772
+
716
773
  export interface StringAnalysisData {
717
774
  /**
718
775
  * Description of the variable.
@@ -889,6 +946,13 @@ export interface AgentUpdateParams {
889
946
  */
890
947
  enable_backchannel?: boolean;
891
948
 
949
+ /**
950
+ * If set to true, will format transcription to number, date, email, etc. If set to
951
+ * false, will return transcripts in raw words. If not set, default value of true
952
+ * will apply.
953
+ */
954
+ enable_transcription_formatting?: boolean;
955
+
892
956
  /**
893
957
  * If set to true, will detect whether the call enters a voicemail. Note that this
894
958
  * feature is only available for phone calls.
@@ -947,13 +1011,6 @@ export interface AgentUpdateParams {
947
1011
  | 'vi-VN'
948
1012
  | 'multi';
949
1013
 
950
- /**
951
- * The URL we will establish LLM websocket for getting response, usually your
952
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
953
- * request format (sent from us) and response format (send to us).
954
- */
955
- llm_websocket_url?: string;
956
-
957
1014
  /**
958
1015
  * Maximum allowed length for the call, will force end the call if reached. The
959
1016
  * minimum value allowed is 60,000 ms (1 min), and maximum value allowed is
@@ -1012,6 +1069,11 @@ export interface AgentUpdateParams {
1012
1069
  */
1013
1070
  reminder_trigger_ms?: number;
1014
1071
 
1072
+ /**
1073
+ * The response engine to use for the agent.
1074
+ */
1075
+ response_engine?: AgentUpdateParams.ResponseEngineRetellLm | AgentUpdateParams.ResponseEngineCustomLm;
1076
+
1015
1077
  /**
1016
1078
  * Controls how responsive is the agent. Value ranging from [0,1]. Lower value
1017
1079
  * means less responsive agent (wait more, respond slower), while higher value
@@ -1181,11 +1243,37 @@ export namespace AgentUpdateParams {
1181
1243
  */
1182
1244
  word: string;
1183
1245
  }
1246
+
1247
+ export interface ResponseEngineRetellLm {
1248
+ /**
1249
+ * id of the Retell LLM to use.
1250
+ */
1251
+ llm_id: string;
1252
+
1253
+ /**
1254
+ * type of the response engine.
1255
+ */
1256
+ type: 'retell-llm';
1257
+ }
1258
+
1259
+ export interface ResponseEngineCustomLm {
1260
+ /**
1261
+ * LLM websocket url of the custom LLM.
1262
+ */
1263
+ llm_websocket_url: string;
1264
+
1265
+ /**
1266
+ * type of the response engine.
1267
+ */
1268
+ type: 'custom-llm';
1269
+ }
1184
1270
  }
1185
1271
 
1186
- export namespace Agent {
1187
- export import AgentResponse = AgentAPI.AgentResponse;
1188
- export import AgentListResponse = AgentAPI.AgentListResponse;
1189
- export import AgentCreateParams = AgentAPI.AgentCreateParams;
1190
- export import AgentUpdateParams = AgentAPI.AgentUpdateParams;
1272
+ export declare namespace Agent {
1273
+ export {
1274
+ type AgentResponse as AgentResponse,
1275
+ type AgentListResponse as AgentListResponse,
1276
+ type AgentCreateParams as AgentCreateParams,
1277
+ type AgentUpdateParams as AgentUpdateParams,
1278
+ };
1191
1279
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
- import * as CallAPI from './call';
6
5
 
7
6
  export class Call extends APIResource {
8
7
  /**
@@ -40,7 +39,7 @@ export class Call extends APIResource {
40
39
  }
41
40
 
42
41
  /**
43
- * Register a new outbound phone call for custom telephony
42
+ * Register a new phone call for custom telephony
44
43
  */
45
44
  registerPhoneCall(
46
45
  body: CallRegisterPhoneCallParams,
@@ -1095,13 +1094,15 @@ export interface CallRegisterPhoneCallParams {
1095
1094
  to_number?: string;
1096
1095
  }
1097
1096
 
1098
- export namespace Call {
1099
- export import CallResponse = CallAPI.CallResponse;
1100
- export import PhoneCallResponse = CallAPI.PhoneCallResponse;
1101
- export import WebCallResponse = CallAPI.WebCallResponse;
1102
- export import CallListResponse = CallAPI.CallListResponse;
1103
- export import CallListParams = CallAPI.CallListParams;
1104
- export import CallCreatePhoneCallParams = CallAPI.CallCreatePhoneCallParams;
1105
- export import CallCreateWebCallParams = CallAPI.CallCreateWebCallParams;
1106
- export import CallRegisterPhoneCallParams = CallAPI.CallRegisterPhoneCallParams;
1097
+ export declare namespace Call {
1098
+ export {
1099
+ type CallResponse as CallResponse,
1100
+ type PhoneCallResponse as PhoneCallResponse,
1101
+ type WebCallResponse as WebCallResponse,
1102
+ type CallListResponse as CallListResponse,
1103
+ type CallListParams as CallListParams,
1104
+ type CallCreatePhoneCallParams as CallCreatePhoneCallParams,
1105
+ type CallCreateWebCallParams as CallCreateWebCallParams,
1106
+ type CallRegisterPhoneCallParams as CallRegisterPhoneCallParams,
1107
+ };
1107
1108
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
- import * as ConcurrencyAPI from './concurrency';
6
5
 
7
6
  export class Concurrency extends APIResource {
8
7
  /**
@@ -25,6 +24,6 @@ export interface ConcurrencyRetrieveResponse {
25
24
  current_concurrency?: number;
26
25
  }
27
26
 
28
- export namespace Concurrency {
29
- export import ConcurrencyRetrieveResponse = ConcurrencyAPI.ConcurrencyRetrieveResponse;
27
+ export declare namespace Concurrency {
28
+ export { type ConcurrencyRetrieveResponse as ConcurrencyRetrieveResponse };
30
29
  }