scorecard-ai 0.6.0 → 0.6.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 (111) hide show
  1. package/README.md +9 -9
  2. package/api/resources/prompt/client/Client.d.ts +27 -8
  3. package/api/resources/prompt/client/Client.js +126 -15
  4. package/api/resources/prompt/client/requests/PromptCreateParams.d.ts +8 -2
  5. package/api/resources/prompt/client/requests/PromptGetByNameRequest.d.ts +4 -0
  6. package/api/resources/prompt/client/requests/PromptListPromptsRequest.d.ts +21 -0
  7. package/api/resources/prompt/client/requests/PromptListPromptsRequest.js +5 -0
  8. package/api/resources/prompt/client/requests/index.d.ts +1 -0
  9. package/api/resources/run/client/Client.js +3 -3
  10. package/api/resources/runMetric/client/Client.js +1 -1
  11. package/api/resources/score/client/Client.js +2 -2
  12. package/api/resources/scoringConfig/client/Client.d.ts +17 -1
  13. package/api/resources/scoringConfig/client/Client.js +90 -3
  14. package/api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +3 -1
  15. package/api/resources/testcase/client/Client.d.ts +1 -1
  16. package/api/resources/testcase/client/Client.js +7 -7
  17. package/api/resources/testrecord/client/Client.js +2 -2
  18. package/api/resources/testset/client/Client.d.ts +4 -4
  19. package/api/resources/testset/client/Client.js +21 -12
  20. package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
  21. package/api/resources/testset/client/requests/TestsetGetRequest.d.ts +11 -0
  22. package/api/resources/testset/client/requests/TestsetGetRequest.js +5 -0
  23. package/api/resources/testset/client/requests/index.d.ts +1 -0
  24. package/api/resources/tracing/client/Client.js +3 -3
  25. package/api/types/Prompt.d.ts +2 -0
  26. package/api/types/PromptCursorPage.d.ts +17 -0
  27. package/api/types/PromptCursorPage.js +5 -0
  28. package/api/types/ScoringConfig.d.ts +2 -0
  29. package/api/types/Testset.d.ts +2 -0
  30. package/api/types/TestsetCursorPage.d.ts +17 -0
  31. package/api/types/TestsetCursorPage.js +5 -0
  32. package/api/types/index.d.ts +2 -0
  33. package/api/types/index.js +2 -0
  34. package/dist/api/resources/prompt/client/Client.d.ts +27 -8
  35. package/dist/api/resources/prompt/client/Client.js +126 -15
  36. package/dist/api/resources/prompt/client/requests/PromptCreateParams.d.ts +8 -2
  37. package/dist/api/resources/prompt/client/requests/PromptGetByNameRequest.d.ts +4 -0
  38. package/dist/api/resources/prompt/client/requests/PromptListPromptsRequest.d.ts +21 -0
  39. package/dist/api/resources/prompt/client/requests/PromptListPromptsRequest.js +5 -0
  40. package/dist/api/resources/prompt/client/requests/index.d.ts +1 -0
  41. package/dist/api/resources/run/client/Client.js +3 -3
  42. package/dist/api/resources/runMetric/client/Client.js +1 -1
  43. package/dist/api/resources/score/client/Client.js +2 -2
  44. package/dist/api/resources/scoringConfig/client/Client.d.ts +17 -1
  45. package/dist/api/resources/scoringConfig/client/Client.js +90 -3
  46. package/dist/api/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +3 -1
  47. package/dist/api/resources/testcase/client/Client.d.ts +1 -1
  48. package/dist/api/resources/testcase/client/Client.js +7 -7
  49. package/dist/api/resources/testrecord/client/Client.js +2 -2
  50. package/dist/api/resources/testset/client/Client.d.ts +4 -4
  51. package/dist/api/resources/testset/client/Client.js +21 -12
  52. package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
  53. package/dist/api/resources/testset/client/requests/TestsetGetRequest.d.ts +11 -0
  54. package/dist/api/resources/testset/client/requests/TestsetGetRequest.js +5 -0
  55. package/dist/api/resources/testset/client/requests/index.d.ts +1 -0
  56. package/dist/api/resources/tracing/client/Client.js +3 -3
  57. package/dist/api/types/Prompt.d.ts +2 -0
  58. package/dist/api/types/PromptCursorPage.d.ts +17 -0
  59. package/dist/api/types/PromptCursorPage.js +5 -0
  60. package/dist/api/types/ScoringConfig.d.ts +2 -0
  61. package/dist/api/types/Testset.d.ts +2 -0
  62. package/dist/api/types/TestsetCursorPage.d.ts +17 -0
  63. package/dist/api/types/TestsetCursorPage.js +5 -0
  64. package/dist/api/types/index.d.ts +2 -0
  65. package/dist/api/types/index.js +2 -0
  66. package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +2 -0
  67. package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.js +2 -0
  68. package/dist/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +1 -0
  69. package/dist/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js +1 -0
  70. package/dist/serialization/resources/testcase/client/batchCopy.d.ts +11 -0
  71. package/dist/serialization/resources/testcase/client/batchCopy.js +32 -0
  72. package/dist/serialization/resources/testcase/client/index.d.ts +1 -0
  73. package/dist/serialization/resources/testcase/client/index.js +14 -0
  74. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -0
  75. package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.js +1 -0
  76. package/dist/serialization/types/Prompt.d.ts +1 -0
  77. package/dist/serialization/types/Prompt.js +1 -0
  78. package/dist/serialization/types/PromptCursorPage.d.ts +18 -0
  79. package/dist/serialization/types/PromptCursorPage.js +39 -0
  80. package/dist/serialization/types/ScoringConfig.d.ts +1 -0
  81. package/dist/serialization/types/ScoringConfig.js +1 -0
  82. package/dist/serialization/types/Testset.d.ts +1 -0
  83. package/dist/serialization/types/Testset.js +1 -0
  84. package/dist/serialization/types/TestsetCursorPage.d.ts +18 -0
  85. package/dist/serialization/types/TestsetCursorPage.js +39 -0
  86. package/dist/serialization/types/index.d.ts +2 -0
  87. package/dist/serialization/types/index.js +2 -0
  88. package/package.json +1 -1
  89. package/reference.md +140 -11
  90. package/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +2 -0
  91. package/serialization/resources/prompt/client/requests/PromptCreateParams.js +2 -0
  92. package/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.d.ts +1 -0
  93. package/serialization/resources/scoringConfig/client/requests/ScoringConfigCreateParams.js +1 -0
  94. package/serialization/resources/testcase/client/batchCopy.d.ts +11 -0
  95. package/serialization/resources/testcase/client/batchCopy.js +32 -0
  96. package/serialization/resources/testcase/client/index.d.ts +1 -0
  97. package/serialization/resources/testcase/client/index.js +14 -0
  98. package/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -0
  99. package/serialization/resources/testset/client/requests/TestsetCreateParams.js +1 -0
  100. package/serialization/types/Prompt.d.ts +1 -0
  101. package/serialization/types/Prompt.js +1 -0
  102. package/serialization/types/PromptCursorPage.d.ts +18 -0
  103. package/serialization/types/PromptCursorPage.js +39 -0
  104. package/serialization/types/ScoringConfig.d.ts +1 -0
  105. package/serialization/types/ScoringConfig.js +1 -0
  106. package/serialization/types/Testset.d.ts +1 -0
  107. package/serialization/types/Testset.js +1 -0
  108. package/serialization/types/TestsetCursorPage.d.ts +18 -0
  109. package/serialization/types/TestsetCursorPage.js +39 -0
  110. package/serialization/types/index.d.ts +2 -0
  111. package/serialization/types/index.js +2 -0
package/README.md CHANGED
@@ -17,11 +17,11 @@ The SDK uses fetch and is compatible in multiple environments
17
17
  such as Node, Vercel, Cloudflare Workers.
18
18
 
19
19
  ```typescript
20
- import { ScorecardClient } from "scorecard";
20
+ import { ScorecardClient } from "scorecard-ai";
21
21
 
22
- const scorecard = new ScorecardClient(
23
- api_key="YOUR_API_KEY" // Defaults to SCORECARD_API_KEY
24
- )
22
+ const scorecard = new ScorecardClient({
23
+ apiKey: "YOUR_API_KEY"
24
+ })
25
25
 
26
26
  const testset = await scorecard.testset.create({
27
27
  testsetId=1234,
@@ -42,11 +42,11 @@ available on both the sync and async client.
42
42
 
43
43
  ```typescript
44
44
  import { callModel } from "../app.ts";
45
- import { ScorecardClient } from "scorecard";
45
+ import { ScorecardClient } from "scorecard-ai";
46
46
 
47
- const scorecard = new ScorecardClient(
48
- apiKey="YOUR_API_KEY"
49
- )
47
+ const scorecard = new ScorecardClient({
48
+ apiKey: "YOUR_API_KEY"
49
+ })
50
50
 
51
51
  client.runTests({
52
52
  inputTestsetId: 123,
@@ -76,7 +76,7 @@ All exceptions thrown by the SDK will
76
76
  sublcass [ScorecardError](./src/errors/ScorecardError.ts).
77
77
 
78
78
  ```typescript
79
- import { Scorecard, ScorecardError } from "scorecard";
79
+ import { Scorecard, ScorecardError } from "scorecard-ai";
80
80
 
81
81
  try {
82
82
  await client.testset.get({...});
@@ -23,7 +23,7 @@ export declare class Prompt {
23
23
  protected readonly _options: Prompt.Options;
24
24
  constructor(_options: Prompt.Options);
25
25
  /**
26
- * Retrieve a prod prompt by name
26
+ * Retrieve a prompt by name, defaulting to the production prompt, unless a tag to select the prompt by is specified
27
27
  *
28
28
  * @param {Scorecard.PromptGetByNameRequest} request
29
29
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
@@ -40,11 +40,11 @@ export declare class Prompt {
40
40
  */
41
41
  getByName(request: Scorecard.PromptGetByNameRequest, requestOptions?: Prompt.RequestOptions): Promise<Scorecard.Prompt>;
42
42
  /**
43
- * Two types of prompts can be created - a root prompt or a child prompt (aka Prompt Version in app).
43
+ * Two types of prompts can be created - a root prompt or a child prompt (aka Prompt Version in the app).
44
44
  *
45
- * A root prompt can be created by providing the `name` param, and it will always be tagged as prod.
45
+ * A root prompt can be created by providing the `name` param, and it will always be tagged as production.
46
46
  *
47
- * A child prompt can be created by providing the `parent_id` param. Note that the `name` param in this case will be ignored as all descendents from a root prompt would share the root's name. `is_prod` can also be provided to configure whether a child should be tagged as prod.
47
+ * A child prompt can be created by providing the `parent_id` param. Note that the `name` param in this case will be ignored as all descendants from a root prompt would share the root's name. `is_prod` can also be provided to configure whether a child should be tagged as production.
48
48
  *
49
49
  * @param {Scorecard.PromptCreateParams} request
50
50
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
@@ -64,7 +64,9 @@ export declare class Prompt {
64
64
  * "param2": 0.1,
65
65
  * "param3": 100,
66
66
  * "param4": true
67
- * }
67
+ * },
68
+ * tag: "1.0",
69
+ * projectId: 1
68
70
  * })
69
71
  *
70
72
  * @example
@@ -78,10 +80,27 @@ export declare class Prompt {
78
80
  * "param3": 100,
79
81
  * "param4": true
80
82
  * },
81
- * isProd: true
83
+ * tag: "v1.1",
84
+ * isProd: true,
85
+ * projectId: 1
82
86
  * })
83
87
  */
84
88
  create(request: Scorecard.PromptCreateParams, requestOptions?: Prompt.RequestOptions): Promise<Scorecard.Prompt>;
89
+ /**
90
+ * List all prompts with cursor-based pagination
91
+ *
92
+ * @param {Scorecard.PromptListPromptsRequest} request
93
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
94
+ *
95
+ * @throws {@link Scorecard.UnauthorizedError}
96
+ * @throws {@link Scorecard.ForbiddenError}
97
+ * @throws {@link Scorecard.NotFoundError}
98
+ * @throws {@link Scorecard.UnprocessableEntityError}
99
+ *
100
+ * @example
101
+ * await client.prompt.listPrompts()
102
+ */
103
+ listPrompts(request?: Scorecard.PromptListPromptsRequest, requestOptions?: Prompt.RequestOptions): Promise<Scorecard.PromptCursorPage>;
85
104
  /**
86
105
  * Retrieve a prompt by id
87
106
  *
@@ -98,9 +117,9 @@ export declare class Prompt {
98
117
  */
99
118
  get(id: string, requestOptions?: Prompt.RequestOptions): Promise<Scorecard.Prompt>;
100
119
  /**
101
- * Delete a scoring config.
120
+ * Delete a root prompt and all of its children.
102
121
  *
103
- * @param {string} id - The id of the scoring config to delete.
122
+ * @param {string} id - The id of the root prompt to delete.
104
123
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
105
124
  *
106
125
  * @throws {@link Scorecard.UnauthorizedError}
@@ -50,7 +50,7 @@ class Prompt {
50
50
  this._options = _options;
51
51
  }
52
52
  /**
53
- * Retrieve a prod prompt by name
53
+ * Retrieve a prompt by name, defaulting to the production prompt, unless a tag to select the prompt by is specified
54
54
  *
55
55
  * @param {Scorecard.PromptGetByNameRequest} request
56
56
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
@@ -68,13 +68,16 @@ class Prompt {
68
68
  getByName(request, requestOptions) {
69
69
  var _a, _b;
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
- const { name } = request;
71
+ const { name, tag } = request;
72
72
  const _queryParams = {};
73
73
  _queryParams["name"] = name;
74
+ if (tag != null) {
75
+ _queryParams["tag"] = tag;
76
+ }
74
77
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
75
78
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/prompt"),
76
79
  method: "GET",
77
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
80
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
78
81
  contentType: "application/json",
79
82
  queryParameters: _queryParams,
80
83
  requestType: "json",
@@ -148,11 +151,11 @@ class Prompt {
148
151
  });
149
152
  }
150
153
  /**
151
- * Two types of prompts can be created - a root prompt or a child prompt (aka Prompt Version in app).
154
+ * Two types of prompts can be created - a root prompt or a child prompt (aka Prompt Version in the app).
152
155
  *
153
- * A root prompt can be created by providing the `name` param, and it will always be tagged as prod.
156
+ * A root prompt can be created by providing the `name` param, and it will always be tagged as production.
154
157
  *
155
- * A child prompt can be created by providing the `parent_id` param. Note that the `name` param in this case will be ignored as all descendents from a root prompt would share the root's name. `is_prod` can also be provided to configure whether a child should be tagged as prod.
158
+ * A child prompt can be created by providing the `parent_id` param. Note that the `name` param in this case will be ignored as all descendants from a root prompt would share the root's name. `is_prod` can also be provided to configure whether a child should be tagged as production.
156
159
  *
157
160
  * @param {Scorecard.PromptCreateParams} request
158
161
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
@@ -172,7 +175,9 @@ class Prompt {
172
175
  * "param2": 0.1,
173
176
  * "param3": 100,
174
177
  * "param4": true
175
- * }
178
+ * },
179
+ * tag: "1.0",
180
+ * projectId: 1
176
181
  * })
177
182
  *
178
183
  * @example
@@ -186,7 +191,9 @@ class Prompt {
186
191
  * "param3": 100,
187
192
  * "param4": true
188
193
  * },
189
- * isProd: true
194
+ * tag: "v1.1",
195
+ * isProd: true,
196
+ * projectId: 1
190
197
  * })
191
198
  */
192
199
  create(request, requestOptions) {
@@ -195,7 +202,7 @@ class Prompt {
195
202
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
196
203
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/prompt"),
197
204
  method: "POST",
198
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
205
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
199
206
  contentType: "application/json",
200
207
  requestType: "json",
201
208
  body: serializers.PromptCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -268,6 +275,110 @@ class Prompt {
268
275
  }
269
276
  });
270
277
  }
278
+ /**
279
+ * List all prompts with cursor-based pagination
280
+ *
281
+ * @param {Scorecard.PromptListPromptsRequest} request
282
+ * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
283
+ *
284
+ * @throws {@link Scorecard.UnauthorizedError}
285
+ * @throws {@link Scorecard.ForbiddenError}
286
+ * @throws {@link Scorecard.NotFoundError}
287
+ * @throws {@link Scorecard.UnprocessableEntityError}
288
+ *
289
+ * @example
290
+ * await client.prompt.listPrompts()
291
+ */
292
+ listPrompts(request = {}, requestOptions) {
293
+ var _a, _b;
294
+ return __awaiter(this, void 0, void 0, function* () {
295
+ const { projectId, cursor, size } = request;
296
+ const _queryParams = {};
297
+ if (projectId != null) {
298
+ _queryParams["project_id"] = projectId;
299
+ }
300
+ if (cursor != null) {
301
+ _queryParams["cursor"] = cursor;
302
+ }
303
+ if (size != null) {
304
+ _queryParams["size"] = size.toString();
305
+ }
306
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
307
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/prompt/list"),
308
+ method: "GET",
309
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
310
+ contentType: "application/json",
311
+ queryParameters: _queryParams,
312
+ requestType: "json",
313
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
314
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
315
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
316
+ });
317
+ if (_response.ok) {
318
+ return serializers.PromptCursorPage.parseOrThrow(_response.body, {
319
+ unrecognizedObjectKeys: "passthrough",
320
+ allowUnrecognizedUnionMembers: true,
321
+ allowUnrecognizedEnumValues: true,
322
+ skipValidation: true,
323
+ breadcrumbsPrefix: ["response"],
324
+ });
325
+ }
326
+ if (_response.error.reason === "status-code") {
327
+ switch (_response.error.statusCode) {
328
+ case 401:
329
+ throw new Scorecard.UnauthorizedError(serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
330
+ unrecognizedObjectKeys: "passthrough",
331
+ allowUnrecognizedUnionMembers: true,
332
+ allowUnrecognizedEnumValues: true,
333
+ skipValidation: true,
334
+ breadcrumbsPrefix: ["response"],
335
+ }));
336
+ case 403:
337
+ throw new Scorecard.ForbiddenError(serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
338
+ unrecognizedObjectKeys: "passthrough",
339
+ allowUnrecognizedUnionMembers: true,
340
+ allowUnrecognizedEnumValues: true,
341
+ skipValidation: true,
342
+ breadcrumbsPrefix: ["response"],
343
+ }));
344
+ case 404:
345
+ throw new Scorecard.NotFoundError(serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
346
+ unrecognizedObjectKeys: "passthrough",
347
+ allowUnrecognizedUnionMembers: true,
348
+ allowUnrecognizedEnumValues: true,
349
+ skipValidation: true,
350
+ breadcrumbsPrefix: ["response"],
351
+ }));
352
+ case 422:
353
+ throw new Scorecard.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
354
+ unrecognizedObjectKeys: "passthrough",
355
+ allowUnrecognizedUnionMembers: true,
356
+ allowUnrecognizedEnumValues: true,
357
+ skipValidation: true,
358
+ breadcrumbsPrefix: ["response"],
359
+ }));
360
+ default:
361
+ throw new errors.ScorecardError({
362
+ statusCode: _response.error.statusCode,
363
+ body: _response.error.body,
364
+ });
365
+ }
366
+ }
367
+ switch (_response.error.reason) {
368
+ case "non-json":
369
+ throw new errors.ScorecardError({
370
+ statusCode: _response.error.statusCode,
371
+ body: _response.error.rawBody,
372
+ });
373
+ case "timeout":
374
+ throw new errors.ScorecardTimeoutError();
375
+ case "unknown":
376
+ throw new errors.ScorecardError({
377
+ message: _response.error.errorMessage,
378
+ });
379
+ }
380
+ });
381
+ }
271
382
  /**
272
383
  * Retrieve a prompt by id
273
384
  *
@@ -288,7 +399,7 @@ class Prompt {
288
399
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
289
400
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
290
401
  method: "GET",
291
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
402
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
292
403
  contentType: "application/json",
293
404
  requestType: "json",
294
405
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -361,9 +472,9 @@ class Prompt {
361
472
  });
362
473
  }
363
474
  /**
364
- * Delete a scoring config.
475
+ * Delete a root prompt and all of its children.
365
476
  *
366
- * @param {string} id - The id of the scoring config to delete.
477
+ * @param {string} id - The id of the root prompt to delete.
367
478
  * @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
368
479
  *
369
480
  * @throws {@link Scorecard.UnauthorizedError}
@@ -378,9 +489,9 @@ class Prompt {
378
489
  var _a, _b;
379
490
  return __awaiter(this, void 0, void 0, function* () {
380
491
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
381
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/scoring_config/${encodeURIComponent(id)}`),
492
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
382
493
  method: "DELETE",
383
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
494
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
384
495
  contentType: "application/json",
385
496
  requestType: "json",
386
497
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -471,7 +582,7 @@ class Prompt {
471
582
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
472
583
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
473
584
  method: "PATCH",
474
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
585
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
475
586
  contentType: "application/json",
476
587
  requestType: "json",
477
588
  body: serializers.PromptUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -13,7 +13,9 @@ import * as Scorecard from "../../../../index";
13
13
  * "param2": 0.1,
14
14
  * "param3": 100,
15
15
  * "param4": true
16
- * }
16
+ * },
17
+ * tag: "1.0",
18
+ * projectId: 1
17
19
  * }
18
20
  *
19
21
  * @example
@@ -27,7 +29,9 @@ import * as Scorecard from "../../../../index";
27
29
  * "param3": 100,
28
30
  * "param4": true
29
31
  * },
30
- * isProd: true
32
+ * tag: "v1.1",
33
+ * isProd: true,
34
+ * projectId: 1
31
35
  * }
32
36
  */
33
37
  export interface PromptCreateParams {
@@ -36,5 +40,7 @@ export interface PromptCreateParams {
36
40
  parentId?: string;
37
41
  description?: string;
38
42
  modelParams?: Record<string, Scorecard.PromptCreateParamsModelParamsValue | undefined>;
43
+ tag?: string;
39
44
  isProd?: boolean;
45
+ projectId?: number;
40
46
  }
@@ -12,4 +12,8 @@ export interface PromptGetByNameRequest {
12
12
  * Name of the prompt.
13
13
  */
14
14
  name: string;
15
+ /**
16
+ * Tag to select by. Defaults to selecting the production version
17
+ */
18
+ tag?: string;
15
19
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface PromptListPromptsRequest {
9
+ /**
10
+ * ID of Project to filter by.
11
+ */
12
+ projectId?: string;
13
+ /**
14
+ * Cursor for the next page
15
+ */
16
+ cursor?: string;
17
+ /**
18
+ * Page size
19
+ */
20
+ size?: number;
21
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
1
  export { type PromptGetByNameRequest } from "./PromptGetByNameRequest";
2
2
  export { type PromptCreateParams } from "./PromptCreateParams";
3
+ export { type PromptListPromptsRequest } from "./PromptListPromptsRequest";
3
4
  export { type PromptUpdateParams } from "./PromptUpdateParams";
@@ -69,7 +69,7 @@ class Run {
69
69
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
70
70
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/run"),
71
71
  method: "POST",
72
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
72
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
73
73
  contentType: "application/json",
74
74
  requestType: "json",
75
75
  body: serializers.RunCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -162,7 +162,7 @@ class Run {
162
162
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
163
163
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/run/${encodeURIComponent(runId)}`),
164
164
  method: "GET",
165
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
165
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
166
166
  contentType: "application/json",
167
167
  requestType: "json",
168
168
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -255,7 +255,7 @@ class Run {
255
255
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
256
256
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/run/${encodeURIComponent(runId)}/status`),
257
257
  method: "PATCH",
258
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
258
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
259
259
  contentType: "application/json",
260
260
  requestType: "json",
261
261
  body: serializers.UpdateStatusParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -69,7 +69,7 @@ class RunMetric {
69
69
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
70
70
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/run_metric/${encodeURIComponent(runId)}`),
71
71
  method: "GET",
72
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
72
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
73
73
  contentType: "application/json",
74
74
  requestType: "json",
75
75
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -73,7 +73,7 @@ class Score {
73
73
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
74
74
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/run/${encodeURIComponent(runId)}/testrecord/${encodeURIComponent(testrecordId)}/score`),
75
75
  method: "POST",
76
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
76
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
77
77
  contentType: "application/json",
78
78
  requestType: "json",
79
79
  body: serializers.ScoreCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -169,7 +169,7 @@ class Score {
169
169
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
170
170
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/run/${encodeURIComponent(runId)}/testrecord/${encodeURIComponent(testrecordId)}/score/${encodeURIComponent(scoreId)}`),
171
171
  method: "PATCH",
172
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
172
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
173
173
  contentType: "application/json",
174
174
  requestType: "json",
175
175
  body: serializers.ScoreUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -37,7 +37,8 @@ export declare class ScoringConfig {
37
37
  * await client.scoringConfig.create({
38
38
  * name: "Scoring Config Name",
39
39
  * description: "Description of the scoring config",
40
- * metrics: [1, 2, 3]
40
+ * metrics: [1, 2, 3],
41
+ * projectId: 1
41
42
  * })
42
43
  */
43
44
  create(request?: Scorecard.ScoringConfigCreateParams, requestOptions?: ScoringConfig.RequestOptions): Promise<Scorecard.ScoringConfig>;
@@ -56,6 +57,21 @@ export declare class ScoringConfig {
56
57
  * await client.scoringConfig.get("id")
57
58
  */
58
59
  get(id: string, requestOptions?: ScoringConfig.RequestOptions): Promise<Scorecard.ScoringConfig>;
60
+ /**
61
+ * Delete a scoring config.
62
+ *
63
+ * @param {string} id - The id of the scoring config to delete.
64
+ * @param {ScoringConfig.RequestOptions} requestOptions - Request-specific configuration.
65
+ *
66
+ * @throws {@link Scorecard.UnauthorizedError}
67
+ * @throws {@link Scorecard.ForbiddenError}
68
+ * @throws {@link Scorecard.NotFoundError}
69
+ * @throws {@link Scorecard.UnprocessableEntityError}
70
+ *
71
+ * @example
72
+ * await client.scoringConfig.delete("id")
73
+ */
74
+ delete(id: string, requestOptions?: ScoringConfig.RequestOptions): Promise<unknown>;
59
75
  protected _getCustomAuthorizationHeaders(): Promise<{
60
76
  "X-API-Key": string;
61
77
  }>;
@@ -64,7 +64,8 @@ class ScoringConfig {
64
64
  * await client.scoringConfig.create({
65
65
  * name: "Scoring Config Name",
66
66
  * description: "Description of the scoring config",
67
- * metrics: [1, 2, 3]
67
+ * metrics: [1, 2, 3],
68
+ * projectId: 1
68
69
  * })
69
70
  */
70
71
  create(request = {}, requestOptions) {
@@ -73,7 +74,7 @@ class ScoringConfig {
73
74
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
74
75
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/scoring_config"),
75
76
  method: "POST",
76
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
77
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
77
78
  contentType: "application/json",
78
79
  requestType: "json",
79
80
  body: serializers.ScoringConfigCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -166,7 +167,7 @@ class ScoringConfig {
166
167
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
167
168
  url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/scoring_config/${encodeURIComponent(id)}`),
168
169
  method: "GET",
169
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.0", "User-Agent": "scorecard-ai/0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
170
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
170
171
  contentType: "application/json",
171
172
  requestType: "json",
172
173
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -238,6 +239,92 @@ class ScoringConfig {
238
239
  }
239
240
  });
240
241
  }
242
+ /**
243
+ * Delete a scoring config.
244
+ *
245
+ * @param {string} id - The id of the scoring config to delete.
246
+ * @param {ScoringConfig.RequestOptions} requestOptions - Request-specific configuration.
247
+ *
248
+ * @throws {@link Scorecard.UnauthorizedError}
249
+ * @throws {@link Scorecard.ForbiddenError}
250
+ * @throws {@link Scorecard.NotFoundError}
251
+ * @throws {@link Scorecard.UnprocessableEntityError}
252
+ *
253
+ * @example
254
+ * await client.scoringConfig.delete("id")
255
+ */
256
+ delete(id, requestOptions) {
257
+ var _a, _b;
258
+ return __awaiter(this, void 0, void 0, function* () {
259
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
260
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/scoring_config/${encodeURIComponent(id)}`),
261
+ method: "DELETE",
262
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.6.1", "User-Agent": "scorecard-ai/0.6.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
263
+ contentType: "application/json",
264
+ requestType: "json",
265
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
266
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
267
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
268
+ });
269
+ if (_response.ok) {
270
+ return _response.body;
271
+ }
272
+ if (_response.error.reason === "status-code") {
273
+ switch (_response.error.statusCode) {
274
+ case 401:
275
+ throw new Scorecard.UnauthorizedError(serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
276
+ unrecognizedObjectKeys: "passthrough",
277
+ allowUnrecognizedUnionMembers: true,
278
+ allowUnrecognizedEnumValues: true,
279
+ skipValidation: true,
280
+ breadcrumbsPrefix: ["response"],
281
+ }));
282
+ case 403:
283
+ throw new Scorecard.ForbiddenError(serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
284
+ unrecognizedObjectKeys: "passthrough",
285
+ allowUnrecognizedUnionMembers: true,
286
+ allowUnrecognizedEnumValues: true,
287
+ skipValidation: true,
288
+ breadcrumbsPrefix: ["response"],
289
+ }));
290
+ case 404:
291
+ throw new Scorecard.NotFoundError(serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
292
+ unrecognizedObjectKeys: "passthrough",
293
+ allowUnrecognizedUnionMembers: true,
294
+ allowUnrecognizedEnumValues: true,
295
+ skipValidation: true,
296
+ breadcrumbsPrefix: ["response"],
297
+ }));
298
+ case 422:
299
+ throw new Scorecard.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
300
+ unrecognizedObjectKeys: "passthrough",
301
+ allowUnrecognizedUnionMembers: true,
302
+ allowUnrecognizedEnumValues: true,
303
+ skipValidation: true,
304
+ breadcrumbsPrefix: ["response"],
305
+ }));
306
+ default:
307
+ throw new errors.ScorecardError({
308
+ statusCode: _response.error.statusCode,
309
+ body: _response.error.body,
310
+ });
311
+ }
312
+ }
313
+ switch (_response.error.reason) {
314
+ case "non-json":
315
+ throw new errors.ScorecardError({
316
+ statusCode: _response.error.statusCode,
317
+ body: _response.error.rawBody,
318
+ });
319
+ case "timeout":
320
+ throw new errors.ScorecardTimeoutError();
321
+ case "unknown":
322
+ throw new errors.ScorecardError({
323
+ message: _response.error.errorMessage,
324
+ });
325
+ }
326
+ });
327
+ }
241
328
  _getCustomAuthorizationHeaders() {
242
329
  var _a;
243
330
  return __awaiter(this, void 0, void 0, function* () {