@elevenlabs/elevenlabs-js 2.12.0 → 2.12.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.
Files changed (150) hide show
  1. package/Client.d.ts +0 -160
  2. package/Client.js +2 -687
  3. package/api/index.d.ts +0 -1
  4. package/api/index.js +0 -1
  5. package/api/resources/conversationalAi/client/Client.d.ts +3 -0
  6. package/api/resources/conversationalAi/client/Client.js +25 -20
  7. package/api/resources/conversationalAi/resources/agents/client/Client.d.ts +18 -0
  8. package/api/resources/conversationalAi/resources/agents/client/Client.js +80 -0
  9. package/api/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.d.ts +1 -1
  10. package/api/resources/conversationalAi/resources/agents/client/requests/index.d.ts +1 -0
  11. package/api/resources/conversationalAi/resources/index.d.ts +3 -0
  12. package/api/resources/conversationalAi/resources/index.js +4 -1
  13. package/api/types/ClientEvent.d.ts +2 -1
  14. package/api/types/ClientEvent.js +1 -0
  15. package/api/types/FeaturesUsageCommonModel.d.ts +1 -0
  16. package/api/types/TestsFeatureUsageCommonModel.d.ts +8 -0
  17. package/api/types/UnitTestRunResponseModel.d.ts +1 -0
  18. package/api/types/index.d.ts +1 -2
  19. package/api/types/index.js +1 -2
  20. package/dist/Client.d.ts +0 -160
  21. package/dist/Client.js +2 -687
  22. package/dist/api/index.d.ts +0 -1
  23. package/dist/api/index.js +0 -1
  24. package/dist/api/resources/conversationalAi/client/Client.d.ts +3 -0
  25. package/dist/api/resources/conversationalAi/client/Client.js +25 -20
  26. package/dist/api/resources/conversationalAi/resources/agents/client/Client.d.ts +18 -0
  27. package/dist/api/resources/conversationalAi/resources/agents/client/Client.js +80 -0
  28. package/dist/api/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.d.ts +1 -1
  29. package/dist/api/resources/conversationalAi/resources/agents/client/requests/index.d.ts +1 -0
  30. package/dist/api/resources/conversationalAi/resources/index.d.ts +3 -0
  31. package/dist/api/resources/conversationalAi/resources/index.js +4 -1
  32. package/dist/api/types/ClientEvent.d.ts +2 -1
  33. package/dist/api/types/ClientEvent.js +1 -0
  34. package/dist/api/types/FeaturesUsageCommonModel.d.ts +1 -0
  35. package/dist/api/types/TestsFeatureUsageCommonModel.d.ts +8 -0
  36. package/dist/api/types/UnitTestRunResponseModel.d.ts +1 -0
  37. package/dist/api/types/index.d.ts +1 -2
  38. package/dist/api/types/index.js +1 -2
  39. package/dist/serialization/index.d.ts +0 -1
  40. package/dist/serialization/index.js +0 -1
  41. package/dist/serialization/resources/conversationalAi/resources/agents/client/requests/RunAgentTestsRequestModel.d.ts +15 -0
  42. package/dist/serialization/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.js +3 -3
  43. package/dist/serialization/resources/conversationalAi/resources/agents/client/requests/index.d.ts +1 -0
  44. package/dist/serialization/resources/conversationalAi/resources/agents/client/requests/index.js +3 -1
  45. package/dist/serialization/resources/conversationalAi/resources/index.d.ts +3 -0
  46. package/dist/serialization/resources/conversationalAi/resources/index.js +4 -1
  47. package/dist/serialization/types/ClientEvent.d.ts +1 -1
  48. package/dist/serialization/types/ClientEvent.js +1 -0
  49. package/dist/serialization/types/FeaturesUsageCommonModel.d.ts +2 -0
  50. package/dist/serialization/types/FeaturesUsageCommonModel.js +2 -0
  51. package/dist/serialization/types/TestsFeatureUsageCommonModel.d.ts +14 -0
  52. package/{serialization/types/CreateUnitTestRequestDynamicVariablesValue.js → dist/serialization/types/TestsFeatureUsageCommonModel.js} +6 -7
  53. package/dist/serialization/types/UnitTestRunResponseModel.d.ts +1 -0
  54. package/dist/serialization/types/UnitTestRunResponseModel.js +1 -0
  55. package/dist/serialization/types/index.d.ts +1 -2
  56. package/dist/serialization/types/index.js +1 -2
  57. package/dist/version.d.ts +1 -1
  58. package/dist/version.js +1 -1
  59. package/package.json +1 -1
  60. package/reference.md +648 -0
  61. package/serialization/index.d.ts +0 -1
  62. package/serialization/index.js +0 -1
  63. package/serialization/resources/conversationalAi/resources/agents/client/requests/RunAgentTestsRequestModel.d.ts +15 -0
  64. package/serialization/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.js +3 -3
  65. package/serialization/resources/conversationalAi/resources/agents/client/requests/index.d.ts +1 -0
  66. package/serialization/resources/conversationalAi/resources/agents/client/requests/index.js +3 -1
  67. package/serialization/resources/conversationalAi/resources/index.d.ts +3 -0
  68. package/serialization/resources/conversationalAi/resources/index.js +4 -1
  69. package/serialization/types/ClientEvent.d.ts +1 -1
  70. package/serialization/types/ClientEvent.js +1 -0
  71. package/serialization/types/FeaturesUsageCommonModel.d.ts +2 -0
  72. package/serialization/types/FeaturesUsageCommonModel.js +2 -0
  73. package/serialization/types/TestsFeatureUsageCommonModel.d.ts +14 -0
  74. package/{dist/serialization/types/CreateUnitTestRequestDynamicVariablesValue.js → serialization/types/TestsFeatureUsageCommonModel.js} +6 -7
  75. package/serialization/types/UnitTestRunResponseModel.d.ts +1 -0
  76. package/serialization/types/UnitTestRunResponseModel.js +1 -0
  77. package/serialization/types/index.d.ts +1 -2
  78. package/serialization/types/index.js +1 -2
  79. package/version.d.ts +1 -1
  80. package/version.js +1 -1
  81. package/api/client/index.d.ts +0 -1
  82. package/api/client/index.js +0 -17
  83. package/api/client/requests/CreateUnitTestRequest.d.ts +0 -37
  84. package/api/client/requests/ListChatResponseTestsRouteRequest.d.ts +0 -21
  85. package/api/client/requests/ListTestsByIdsRequestModel.d.ts +0 -13
  86. package/api/client/requests/ListTestsByIdsRequestModel.js +0 -5
  87. package/api/client/requests/ResubmitTestsRequestModel.d.ts +0 -19
  88. package/api/client/requests/ResubmitTestsRequestModel.js +0 -5
  89. package/api/client/requests/UpdateUnitTestRequest.d.ts +0 -37
  90. package/api/client/requests/UpdateUnitTestRequest.js +0 -5
  91. package/api/client/requests/index.d.ts +0 -6
  92. package/api/client/requests/index.js +0 -2
  93. package/api/types/CreateUnitTestRequestDynamicVariablesValue.d.ts +0 -4
  94. package/api/types/CreateUnitTestRequestDynamicVariablesValue.js +0 -5
  95. package/api/types/UpdateUnitTestRequestDynamicVariablesValue.d.ts +0 -4
  96. package/api/types/UpdateUnitTestRequestDynamicVariablesValue.js +0 -5
  97. package/dist/api/client/index.d.ts +0 -1
  98. package/dist/api/client/index.js +0 -17
  99. package/dist/api/client/requests/CreateUnitTestRequest.d.ts +0 -37
  100. package/dist/api/client/requests/CreateUnitTestRequest.js +0 -5
  101. package/dist/api/client/requests/ListChatResponseTestsRouteRequest.d.ts +0 -21
  102. package/dist/api/client/requests/ListChatResponseTestsRouteRequest.js +0 -5
  103. package/dist/api/client/requests/ListTestsByIdsRequestModel.d.ts +0 -13
  104. package/dist/api/client/requests/ListTestsByIdsRequestModel.js +0 -5
  105. package/dist/api/client/requests/ResubmitTestsRequestModel.d.ts +0 -19
  106. package/dist/api/client/requests/ResubmitTestsRequestModel.js +0 -5
  107. package/dist/api/client/requests/UpdateUnitTestRequest.d.ts +0 -37
  108. package/dist/api/client/requests/UpdateUnitTestRequest.js +0 -5
  109. package/dist/api/client/requests/index.d.ts +0 -6
  110. package/dist/api/client/requests/index.js +0 -2
  111. package/dist/api/types/CreateUnitTestRequestDynamicVariablesValue.d.ts +0 -4
  112. package/dist/api/types/CreateUnitTestRequestDynamicVariablesValue.js +0 -5
  113. package/dist/api/types/UpdateUnitTestRequestDynamicVariablesValue.d.ts +0 -4
  114. package/dist/api/types/UpdateUnitTestRequestDynamicVariablesValue.js +0 -5
  115. package/dist/serialization/client/index.d.ts +0 -1
  116. package/dist/serialization/client/index.js +0 -17
  117. package/dist/serialization/client/requests/CreateUnitTestRequest.d.ts +0 -23
  118. package/dist/serialization/client/requests/CreateUnitTestRequest.js +0 -56
  119. package/dist/serialization/client/requests/ListTestsByIdsRequestModel.d.ts +0 -12
  120. package/dist/serialization/client/requests/ListTestsByIdsRequestModel.js +0 -43
  121. package/dist/serialization/client/requests/ResubmitTestsRequestModel.d.ts +0 -15
  122. package/dist/serialization/client/requests/ResubmitTestsRequestModel.js +0 -46
  123. package/dist/serialization/client/requests/RunAgentTestsRequestModel.d.ts +0 -15
  124. package/dist/serialization/client/requests/UpdateUnitTestRequest.d.ts +0 -23
  125. package/dist/serialization/client/requests/UpdateUnitTestRequest.js +0 -56
  126. package/dist/serialization/client/requests/index.d.ts +0 -5
  127. package/dist/serialization/client/requests/index.js +0 -13
  128. package/dist/serialization/types/CreateUnitTestRequestDynamicVariablesValue.d.ts +0 -10
  129. package/dist/serialization/types/UpdateUnitTestRequestDynamicVariablesValue.d.ts +0 -10
  130. package/dist/serialization/types/UpdateUnitTestRequestDynamicVariablesValue.js +0 -46
  131. package/serialization/client/index.d.ts +0 -1
  132. package/serialization/client/index.js +0 -17
  133. package/serialization/client/requests/CreateUnitTestRequest.d.ts +0 -23
  134. package/serialization/client/requests/CreateUnitTestRequest.js +0 -56
  135. package/serialization/client/requests/ListTestsByIdsRequestModel.d.ts +0 -12
  136. package/serialization/client/requests/ListTestsByIdsRequestModel.js +0 -43
  137. package/serialization/client/requests/ResubmitTestsRequestModel.d.ts +0 -15
  138. package/serialization/client/requests/ResubmitTestsRequestModel.js +0 -46
  139. package/serialization/client/requests/RunAgentTestsRequestModel.d.ts +0 -15
  140. package/serialization/client/requests/UpdateUnitTestRequest.d.ts +0 -23
  141. package/serialization/client/requests/UpdateUnitTestRequest.js +0 -56
  142. package/serialization/client/requests/index.d.ts +0 -5
  143. package/serialization/client/requests/index.js +0 -13
  144. package/serialization/types/CreateUnitTestRequestDynamicVariablesValue.d.ts +0 -10
  145. package/serialization/types/UpdateUnitTestRequestDynamicVariablesValue.d.ts +0 -10
  146. package/serialization/types/UpdateUnitTestRequestDynamicVariablesValue.js +0 -46
  147. /package/api/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.js +0 -0
  148. /package/api/{client/requests/CreateUnitTestRequest.js → types/TestsFeatureUsageCommonModel.js} +0 -0
  149. /package/dist/api/{client → resources/conversationalAi/resources/agents/client}/requests/RunAgentTestsRequestModel.js +0 -0
  150. /package/{api/client/requests/ListChatResponseTestsRouteRequest.js → dist/api/types/TestsFeatureUsageCommonModel.js} +0 -0
package/Client.js CHANGED
@@ -49,8 +49,6 @@ exports.ElevenLabsClient = void 0;
49
49
  const environments = __importStar(require("./environments"));
50
50
  const core = __importStar(require("./core"));
51
51
  const headers_1 = require("./core/headers");
52
- const ElevenLabs = __importStar(require("./api/index"));
53
- const serializers = __importStar(require("./serialization/index"));
54
52
  const errors = __importStar(require("./errors/index"));
55
53
  const Client_1 = require("./api/resources/history/client/Client");
56
54
  const Client_2 = require("./api/resources/textToSoundEffects/client/Client");
@@ -81,8 +79,8 @@ class ElevenLabsClient {
81
79
  "xi-api-key": _options === null || _options === void 0 ? void 0 : _options.apiKey,
82
80
  "X-Fern-Language": "JavaScript",
83
81
  "X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
84
- "X-Fern-SDK-Version": "v2.12.0",
85
- "User-Agent": "@elevenlabs/elevenlabs-js/v2.12.0",
82
+ "X-Fern-SDK-Version": "v2.12.1",
83
+ "User-Agent": "@elevenlabs/elevenlabs-js/v2.12.1",
86
84
  "X-Fern-Runtime": core.RUNTIME.type,
87
85
  "X-Fern-Runtime-Version": core.RUNTIME.version,
88
86
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -179,689 +177,6 @@ class ElevenLabsClient {
179
177
  var _a;
180
178
  return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new Client_23.Workspace(this._options)));
181
179
  }
182
- /**
183
- * Creates a new agent response test.
184
- *
185
- * @param {ElevenLabs.CreateUnitTestRequest} request
186
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
187
- *
188
- * @throws {@link ElevenLabs.UnprocessableEntityError}
189
- *
190
- * @example
191
- * await client.createAgentResponseTestRoute({
192
- * chatHistory: [{
193
- * role: "user",
194
- * timeInCallSecs: 1
195
- * }],
196
- * successCondition: "success_condition",
197
- * successExamples: [{
198
- * response: "response",
199
- * type: "success"
200
- * }],
201
- * failureExamples: [{
202
- * response: "response",
203
- * type: "failure"
204
- * }],
205
- * name: "name"
206
- * })
207
- */
208
- createAgentResponseTestRoute(request, requestOptions) {
209
- return core.HttpResponsePromise.fromPromise(this.__createAgentResponseTestRoute(request, requestOptions));
210
- }
211
- __createAgentResponseTestRoute(request, requestOptions) {
212
- return __awaiter(this, void 0, void 0, function* () {
213
- var _a, _b, _c;
214
- const _response = yield core.fetcher({
215
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, "v1/convai/agent-testing/create"),
216
- method: "POST",
217
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
218
- contentType: "application/json",
219
- requestType: "json",
220
- body: serializers.CreateUnitTestRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
221
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
222
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
223
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
224
- });
225
- if (_response.ok) {
226
- return {
227
- data: serializers.CreateUnitTestResponseModel.parseOrThrow(_response.body, {
228
- unrecognizedObjectKeys: "passthrough",
229
- allowUnrecognizedUnionMembers: true,
230
- allowUnrecognizedEnumValues: true,
231
- breadcrumbsPrefix: ["response"],
232
- }),
233
- rawResponse: _response.rawResponse,
234
- };
235
- }
236
- if (_response.error.reason === "status-code") {
237
- switch (_response.error.statusCode) {
238
- case 422:
239
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
240
- unrecognizedObjectKeys: "passthrough",
241
- allowUnrecognizedUnionMembers: true,
242
- allowUnrecognizedEnumValues: true,
243
- breadcrumbsPrefix: ["response"],
244
- }), _response.rawResponse);
245
- default:
246
- throw new errors.ElevenLabsError({
247
- statusCode: _response.error.statusCode,
248
- body: _response.error.body,
249
- rawResponse: _response.rawResponse,
250
- });
251
- }
252
- }
253
- switch (_response.error.reason) {
254
- case "non-json":
255
- throw new errors.ElevenLabsError({
256
- statusCode: _response.error.statusCode,
257
- body: _response.error.rawBody,
258
- rawResponse: _response.rawResponse,
259
- });
260
- case "timeout":
261
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling POST /v1/convai/agent-testing/create.");
262
- case "unknown":
263
- throw new errors.ElevenLabsError({
264
- message: _response.error.errorMessage,
265
- rawResponse: _response.rawResponse,
266
- });
267
- }
268
- });
269
- }
270
- /**
271
- * Gets an agent response test by ID.
272
- *
273
- * @param {string} testId - The id of a chat response test. This is returned on test creation.
274
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
275
- *
276
- * @throws {@link ElevenLabs.UnprocessableEntityError}
277
- *
278
- * @example
279
- * await client.getAgentResponseTestRoute("TeaqRRdTcIfIu2i7BYfT")
280
- */
281
- getAgentResponseTestRoute(testId, requestOptions) {
282
- return core.HttpResponsePromise.fromPromise(this.__getAgentResponseTestRoute(testId, requestOptions));
283
- }
284
- __getAgentResponseTestRoute(testId, requestOptions) {
285
- return __awaiter(this, void 0, void 0, function* () {
286
- var _a, _b, _c;
287
- const _response = yield core.fetcher({
288
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/agent-testing/${encodeURIComponent(testId)}`),
289
- method: "GET",
290
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
291
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
292
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
293
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
294
- });
295
- if (_response.ok) {
296
- return {
297
- data: serializers.GetUnitTestResponseModel.parseOrThrow(_response.body, {
298
- unrecognizedObjectKeys: "passthrough",
299
- allowUnrecognizedUnionMembers: true,
300
- allowUnrecognizedEnumValues: true,
301
- breadcrumbsPrefix: ["response"],
302
- }),
303
- rawResponse: _response.rawResponse,
304
- };
305
- }
306
- if (_response.error.reason === "status-code") {
307
- switch (_response.error.statusCode) {
308
- case 422:
309
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
310
- unrecognizedObjectKeys: "passthrough",
311
- allowUnrecognizedUnionMembers: true,
312
- allowUnrecognizedEnumValues: true,
313
- breadcrumbsPrefix: ["response"],
314
- }), _response.rawResponse);
315
- default:
316
- throw new errors.ElevenLabsError({
317
- statusCode: _response.error.statusCode,
318
- body: _response.error.body,
319
- rawResponse: _response.rawResponse,
320
- });
321
- }
322
- }
323
- switch (_response.error.reason) {
324
- case "non-json":
325
- throw new errors.ElevenLabsError({
326
- statusCode: _response.error.statusCode,
327
- body: _response.error.rawBody,
328
- rawResponse: _response.rawResponse,
329
- });
330
- case "timeout":
331
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling GET /v1/convai/agent-testing/{test_id}.");
332
- case "unknown":
333
- throw new errors.ElevenLabsError({
334
- message: _response.error.errorMessage,
335
- rawResponse: _response.rawResponse,
336
- });
337
- }
338
- });
339
- }
340
- /**
341
- * Updates an agent response test by ID.
342
- *
343
- * @param {string} testId - The id of a chat response test. This is returned on test creation.
344
- * @param {ElevenLabs.UpdateUnitTestRequest} request
345
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
346
- *
347
- * @throws {@link ElevenLabs.UnprocessableEntityError}
348
- *
349
- * @example
350
- * await client.updateAgentResponseTestRoute("TeaqRRdTcIfIu2i7BYfT", {
351
- * chatHistory: [{
352
- * role: "user",
353
- * timeInCallSecs: 1
354
- * }],
355
- * successCondition: "success_condition",
356
- * successExamples: [{
357
- * response: "response",
358
- * type: "success"
359
- * }],
360
- * failureExamples: [{
361
- * response: "response",
362
- * type: "failure"
363
- * }],
364
- * name: "name"
365
- * })
366
- */
367
- updateAgentResponseTestRoute(testId, request, requestOptions) {
368
- return core.HttpResponsePromise.fromPromise(this.__updateAgentResponseTestRoute(testId, request, requestOptions));
369
- }
370
- __updateAgentResponseTestRoute(testId, request, requestOptions) {
371
- return __awaiter(this, void 0, void 0, function* () {
372
- var _a, _b, _c;
373
- const _response = yield core.fetcher({
374
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/agent-testing/${encodeURIComponent(testId)}`),
375
- method: "PUT",
376
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
377
- contentType: "application/json",
378
- requestType: "json",
379
- body: serializers.UpdateUnitTestRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
380
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
381
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
382
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
383
- });
384
- if (_response.ok) {
385
- return {
386
- data: serializers.GetUnitTestResponseModel.parseOrThrow(_response.body, {
387
- unrecognizedObjectKeys: "passthrough",
388
- allowUnrecognizedUnionMembers: true,
389
- allowUnrecognizedEnumValues: true,
390
- breadcrumbsPrefix: ["response"],
391
- }),
392
- rawResponse: _response.rawResponse,
393
- };
394
- }
395
- if (_response.error.reason === "status-code") {
396
- switch (_response.error.statusCode) {
397
- case 422:
398
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
399
- unrecognizedObjectKeys: "passthrough",
400
- allowUnrecognizedUnionMembers: true,
401
- allowUnrecognizedEnumValues: true,
402
- breadcrumbsPrefix: ["response"],
403
- }), _response.rawResponse);
404
- default:
405
- throw new errors.ElevenLabsError({
406
- statusCode: _response.error.statusCode,
407
- body: _response.error.body,
408
- rawResponse: _response.rawResponse,
409
- });
410
- }
411
- }
412
- switch (_response.error.reason) {
413
- case "non-json":
414
- throw new errors.ElevenLabsError({
415
- statusCode: _response.error.statusCode,
416
- body: _response.error.rawBody,
417
- rawResponse: _response.rawResponse,
418
- });
419
- case "timeout":
420
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling PUT /v1/convai/agent-testing/{test_id}.");
421
- case "unknown":
422
- throw new errors.ElevenLabsError({
423
- message: _response.error.errorMessage,
424
- rawResponse: _response.rawResponse,
425
- });
426
- }
427
- });
428
- }
429
- /**
430
- * Deletes an agent response test by ID.
431
- *
432
- * @param {string} testId - The id of a chat response test. This is returned on test creation.
433
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
434
- *
435
- * @throws {@link ElevenLabs.UnprocessableEntityError}
436
- *
437
- * @example
438
- * await client.deleteChatResponseTestRoute("TeaqRRdTcIfIu2i7BYfT")
439
- */
440
- deleteChatResponseTestRoute(testId, requestOptions) {
441
- return core.HttpResponsePromise.fromPromise(this.__deleteChatResponseTestRoute(testId, requestOptions));
442
- }
443
- __deleteChatResponseTestRoute(testId, requestOptions) {
444
- return __awaiter(this, void 0, void 0, function* () {
445
- var _a, _b, _c;
446
- const _response = yield core.fetcher({
447
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/agent-testing/${encodeURIComponent(testId)}`),
448
- method: "DELETE",
449
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
450
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
451
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
452
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
453
- });
454
- if (_response.ok) {
455
- return { data: _response.body, rawResponse: _response.rawResponse };
456
- }
457
- if (_response.error.reason === "status-code") {
458
- switch (_response.error.statusCode) {
459
- case 422:
460
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
461
- unrecognizedObjectKeys: "passthrough",
462
- allowUnrecognizedUnionMembers: true,
463
- allowUnrecognizedEnumValues: true,
464
- breadcrumbsPrefix: ["response"],
465
- }), _response.rawResponse);
466
- default:
467
- throw new errors.ElevenLabsError({
468
- statusCode: _response.error.statusCode,
469
- body: _response.error.body,
470
- rawResponse: _response.rawResponse,
471
- });
472
- }
473
- }
474
- switch (_response.error.reason) {
475
- case "non-json":
476
- throw new errors.ElevenLabsError({
477
- statusCode: _response.error.statusCode,
478
- body: _response.error.rawBody,
479
- rawResponse: _response.rawResponse,
480
- });
481
- case "timeout":
482
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling DELETE /v1/convai/agent-testing/{test_id}.");
483
- case "unknown":
484
- throw new errors.ElevenLabsError({
485
- message: _response.error.errorMessage,
486
- rawResponse: _response.rawResponse,
487
- });
488
- }
489
- });
490
- }
491
- /**
492
- * Gets multiple agent response tests by their IDs. Returns a dictionary mapping test IDs to test summaries.
493
- *
494
- * @param {ElevenLabs.ListTestsByIdsRequestModel} request
495
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
496
- *
497
- * @throws {@link ElevenLabs.UnprocessableEntityError}
498
- *
499
- * @example
500
- * await client.getAgentResponseTestsSummariesRoute({
501
- * testIds: ["test_id_1", "test_id_2"]
502
- * })
503
- */
504
- getAgentResponseTestsSummariesRoute(request, requestOptions) {
505
- return core.HttpResponsePromise.fromPromise(this.__getAgentResponseTestsSummariesRoute(request, requestOptions));
506
- }
507
- __getAgentResponseTestsSummariesRoute(request, requestOptions) {
508
- return __awaiter(this, void 0, void 0, function* () {
509
- var _a, _b, _c;
510
- const _response = yield core.fetcher({
511
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, "v1/convai/agent-testing/summaries"),
512
- method: "POST",
513
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
514
- contentType: "application/json",
515
- requestType: "json",
516
- body: serializers.ListTestsByIdsRequestModel.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
517
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
518
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
519
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
520
- });
521
- if (_response.ok) {
522
- return {
523
- data: serializers.GetTestsSummariesByIdsResponseModel.parseOrThrow(_response.body, {
524
- unrecognizedObjectKeys: "passthrough",
525
- allowUnrecognizedUnionMembers: true,
526
- allowUnrecognizedEnumValues: true,
527
- breadcrumbsPrefix: ["response"],
528
- }),
529
- rawResponse: _response.rawResponse,
530
- };
531
- }
532
- if (_response.error.reason === "status-code") {
533
- switch (_response.error.statusCode) {
534
- case 422:
535
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
536
- unrecognizedObjectKeys: "passthrough",
537
- allowUnrecognizedUnionMembers: true,
538
- allowUnrecognizedEnumValues: true,
539
- breadcrumbsPrefix: ["response"],
540
- }), _response.rawResponse);
541
- default:
542
- throw new errors.ElevenLabsError({
543
- statusCode: _response.error.statusCode,
544
- body: _response.error.body,
545
- rawResponse: _response.rawResponse,
546
- });
547
- }
548
- }
549
- switch (_response.error.reason) {
550
- case "non-json":
551
- throw new errors.ElevenLabsError({
552
- statusCode: _response.error.statusCode,
553
- body: _response.error.rawBody,
554
- rawResponse: _response.rawResponse,
555
- });
556
- case "timeout":
557
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling POST /v1/convai/agent-testing/summaries.");
558
- case "unknown":
559
- throw new errors.ElevenLabsError({
560
- message: _response.error.errorMessage,
561
- rawResponse: _response.rawResponse,
562
- });
563
- }
564
- });
565
- }
566
- /**
567
- * Lists all agent response tests with pagination support and optional search filtering.
568
- *
569
- * @param {ElevenLabs.ListChatResponseTestsRouteRequest} request
570
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
571
- *
572
- * @throws {@link ElevenLabs.UnprocessableEntityError}
573
- *
574
- * @example
575
- * await client.listChatResponseTestsRoute()
576
- */
577
- listChatResponseTestsRoute(request = {}, requestOptions) {
578
- return core.HttpResponsePromise.fromPromise(this.__listChatResponseTestsRoute(request, requestOptions));
579
- }
580
- __listChatResponseTestsRoute() {
581
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
582
- var _a, _b, _c;
583
- const { cursor, pageSize, search } = request;
584
- const _queryParams = {};
585
- if (cursor != null) {
586
- _queryParams["cursor"] = cursor;
587
- }
588
- if (pageSize != null) {
589
- _queryParams["page_size"] = pageSize.toString();
590
- }
591
- if (search != null) {
592
- _queryParams["search"] = search;
593
- }
594
- const _response = yield core.fetcher({
595
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, "v1/convai/agent-testing"),
596
- method: "GET",
597
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
598
- queryParameters: _queryParams,
599
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
600
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
601
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
602
- });
603
- if (_response.ok) {
604
- return {
605
- data: serializers.GetTestsPageResponseModel.parseOrThrow(_response.body, {
606
- unrecognizedObjectKeys: "passthrough",
607
- allowUnrecognizedUnionMembers: true,
608
- allowUnrecognizedEnumValues: true,
609
- breadcrumbsPrefix: ["response"],
610
- }),
611
- rawResponse: _response.rawResponse,
612
- };
613
- }
614
- if (_response.error.reason === "status-code") {
615
- switch (_response.error.statusCode) {
616
- case 422:
617
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
618
- unrecognizedObjectKeys: "passthrough",
619
- allowUnrecognizedUnionMembers: true,
620
- allowUnrecognizedEnumValues: true,
621
- breadcrumbsPrefix: ["response"],
622
- }), _response.rawResponse);
623
- default:
624
- throw new errors.ElevenLabsError({
625
- statusCode: _response.error.statusCode,
626
- body: _response.error.body,
627
- rawResponse: _response.rawResponse,
628
- });
629
- }
630
- }
631
- switch (_response.error.reason) {
632
- case "non-json":
633
- throw new errors.ElevenLabsError({
634
- statusCode: _response.error.statusCode,
635
- body: _response.error.rawBody,
636
- rawResponse: _response.rawResponse,
637
- });
638
- case "timeout":
639
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling GET /v1/convai/agent-testing.");
640
- case "unknown":
641
- throw new errors.ElevenLabsError({
642
- message: _response.error.errorMessage,
643
- rawResponse: _response.rawResponse,
644
- });
645
- }
646
- });
647
- }
648
- /**
649
- * Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration.
650
- *
651
- * @param {string} agentId - The id of an agent. This is returned on agent creation.
652
- * @param {ElevenLabs.RunAgentTestsRequestModel} request
653
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
654
- *
655
- * @throws {@link ElevenLabs.UnprocessableEntityError}
656
- *
657
- * @example
658
- * await client.runAgentTestSuiteRoute("21m00Tcm4TlvDq8ikWAM", {
659
- * tests: [{
660
- * testId: "test_id"
661
- * }]
662
- * })
663
- */
664
- runAgentTestSuiteRoute(agentId, request, requestOptions) {
665
- return core.HttpResponsePromise.fromPromise(this.__runAgentTestSuiteRoute(agentId, request, requestOptions));
666
- }
667
- __runAgentTestSuiteRoute(agentId, request, requestOptions) {
668
- return __awaiter(this, void 0, void 0, function* () {
669
- var _a, _b, _c;
670
- const _response = yield core.fetcher({
671
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/agents/${encodeURIComponent(agentId)}/run-tests`),
672
- method: "POST",
673
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
674
- contentType: "application/json",
675
- requestType: "json",
676
- body: serializers.RunAgentTestsRequestModel.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
677
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
678
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
679
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
680
- });
681
- if (_response.ok) {
682
- return {
683
- data: serializers.GetTestSuiteInvocationResponseModel.parseOrThrow(_response.body, {
684
- unrecognizedObjectKeys: "passthrough",
685
- allowUnrecognizedUnionMembers: true,
686
- allowUnrecognizedEnumValues: true,
687
- breadcrumbsPrefix: ["response"],
688
- }),
689
- rawResponse: _response.rawResponse,
690
- };
691
- }
692
- if (_response.error.reason === "status-code") {
693
- switch (_response.error.statusCode) {
694
- case 422:
695
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
696
- unrecognizedObjectKeys: "passthrough",
697
- allowUnrecognizedUnionMembers: true,
698
- allowUnrecognizedEnumValues: true,
699
- breadcrumbsPrefix: ["response"],
700
- }), _response.rawResponse);
701
- default:
702
- throw new errors.ElevenLabsError({
703
- statusCode: _response.error.statusCode,
704
- body: _response.error.body,
705
- rawResponse: _response.rawResponse,
706
- });
707
- }
708
- }
709
- switch (_response.error.reason) {
710
- case "non-json":
711
- throw new errors.ElevenLabsError({
712
- statusCode: _response.error.statusCode,
713
- body: _response.error.rawBody,
714
- rawResponse: _response.rawResponse,
715
- });
716
- case "timeout":
717
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling POST /v1/convai/agents/{agent_id}/run-tests.");
718
- case "unknown":
719
- throw new errors.ElevenLabsError({
720
- message: _response.error.errorMessage,
721
- rawResponse: _response.rawResponse,
722
- });
723
- }
724
- });
725
- }
726
- /**
727
- * Gets a test invocation by ID.
728
- *
729
- * @param {string} testInvocationId - The id of a test invocation. This is returned when tests are run.
730
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
731
- *
732
- * @throws {@link ElevenLabs.UnprocessableEntityError}
733
- *
734
- * @example
735
- * await client.getTestInvocationRoute("test_invocation_id")
736
- */
737
- getTestInvocationRoute(testInvocationId, requestOptions) {
738
- return core.HttpResponsePromise.fromPromise(this.__getTestInvocationRoute(testInvocationId, requestOptions));
739
- }
740
- __getTestInvocationRoute(testInvocationId, requestOptions) {
741
- return __awaiter(this, void 0, void 0, function* () {
742
- var _a, _b, _c;
743
- const _response = yield core.fetcher({
744
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/test-invocations/${encodeURIComponent(testInvocationId)}`),
745
- method: "GET",
746
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
747
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
748
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
749
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
750
- });
751
- if (_response.ok) {
752
- return {
753
- data: serializers.GetTestSuiteInvocationResponseModel.parseOrThrow(_response.body, {
754
- unrecognizedObjectKeys: "passthrough",
755
- allowUnrecognizedUnionMembers: true,
756
- allowUnrecognizedEnumValues: true,
757
- breadcrumbsPrefix: ["response"],
758
- }),
759
- rawResponse: _response.rawResponse,
760
- };
761
- }
762
- if (_response.error.reason === "status-code") {
763
- switch (_response.error.statusCode) {
764
- case 422:
765
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
766
- unrecognizedObjectKeys: "passthrough",
767
- allowUnrecognizedUnionMembers: true,
768
- allowUnrecognizedEnumValues: true,
769
- breadcrumbsPrefix: ["response"],
770
- }), _response.rawResponse);
771
- default:
772
- throw new errors.ElevenLabsError({
773
- statusCode: _response.error.statusCode,
774
- body: _response.error.body,
775
- rawResponse: _response.rawResponse,
776
- });
777
- }
778
- }
779
- switch (_response.error.reason) {
780
- case "non-json":
781
- throw new errors.ElevenLabsError({
782
- statusCode: _response.error.statusCode,
783
- body: _response.error.rawBody,
784
- rawResponse: _response.rawResponse,
785
- });
786
- case "timeout":
787
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling GET /v1/convai/test-invocations/{test_invocation_id}.");
788
- case "unknown":
789
- throw new errors.ElevenLabsError({
790
- message: _response.error.errorMessage,
791
- rawResponse: _response.rawResponse,
792
- });
793
- }
794
- });
795
- }
796
- /**
797
- * Resubmits specific test runs from a test invocation.
798
- *
799
- * @param {string} testInvocationId - The id of a test invocation. This is returned when tests are run.
800
- * @param {ElevenLabs.ResubmitTestsRequestModel} request
801
- * @param {ElevenLabsClient.RequestOptions} requestOptions - Request-specific configuration.
802
- *
803
- * @throws {@link ElevenLabs.UnprocessableEntityError}
804
- *
805
- * @example
806
- * await client.resubmitTestsRoute("test_invocation_id", {
807
- * testRunIds: ["test_run_ids"],
808
- * agentId: "agent_id"
809
- * })
810
- */
811
- resubmitTestsRoute(testInvocationId, request, requestOptions) {
812
- return core.HttpResponsePromise.fromPromise(this.__resubmitTestsRoute(testInvocationId, request, requestOptions));
813
- }
814
- __resubmitTestsRoute(testInvocationId, request, requestOptions) {
815
- return __awaiter(this, void 0, void 0, function* () {
816
- var _a, _b, _c;
817
- const _response = yield core.fetcher({
818
- url: core.url.join((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ElevenLabsEnvironment.Production, `v1/convai/test-invocations/${encodeURIComponent(testInvocationId)}/resubmit`),
819
- method: "POST",
820
- headers: (0, headers_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "xi-api-key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
821
- contentType: "application/json",
822
- requestType: "json",
823
- body: serializers.ResubmitTestsRequestModel.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
824
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 240000,
825
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
826
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
827
- });
828
- if (_response.ok) {
829
- return { data: _response.body, rawResponse: _response.rawResponse };
830
- }
831
- if (_response.error.reason === "status-code") {
832
- switch (_response.error.statusCode) {
833
- case 422:
834
- throw new ElevenLabs.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
835
- unrecognizedObjectKeys: "passthrough",
836
- allowUnrecognizedUnionMembers: true,
837
- allowUnrecognizedEnumValues: true,
838
- breadcrumbsPrefix: ["response"],
839
- }), _response.rawResponse);
840
- default:
841
- throw new errors.ElevenLabsError({
842
- statusCode: _response.error.statusCode,
843
- body: _response.error.body,
844
- rawResponse: _response.rawResponse,
845
- });
846
- }
847
- }
848
- switch (_response.error.reason) {
849
- case "non-json":
850
- throw new errors.ElevenLabsError({
851
- statusCode: _response.error.statusCode,
852
- body: _response.error.rawBody,
853
- rawResponse: _response.rawResponse,
854
- });
855
- case "timeout":
856
- throw new errors.ElevenLabsTimeoutError("Timeout exceeded when calling POST /v1/convai/test-invocations/{test_invocation_id}/resubmit.");
857
- case "unknown":
858
- throw new errors.ElevenLabsError({
859
- message: _response.error.errorMessage,
860
- rawResponse: _response.rawResponse,
861
- });
862
- }
863
- });
864
- }
865
180
  /**
866
181
  * Add a generated voice to the voice library.
867
182
  *