scorecard-ai 0.4.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +2 -0
- package/api/resources/prompt/client/Client.d.ts +2 -0
- package/api/resources/prompt/client/Client.js +25 -20
- package/api/resources/run/client/Client.d.ts +2 -0
- package/api/resources/run/client/Client.js +15 -12
- package/api/resources/runMetric/client/Client.d.ts +2 -0
- package/api/resources/runMetric/client/Client.js +5 -4
- package/api/resources/score/client/Client.d.ts +2 -0
- package/api/resources/score/client/Client.js +10 -8
- package/api/resources/testcase/client/Client.d.ts +2 -0
- package/api/resources/testcase/client/Client.js +15 -12
- package/api/resources/testrecord/client/Client.d.ts +2 -0
- package/api/resources/testrecord/client/Client.js +10 -8
- package/api/resources/testset/client/Client.d.ts +2 -0
- package/api/resources/testset/client/Client.js +25 -20
- package/api/resources/traces/client/Client.d.ts +2 -0
- package/api/resources/traces/client/Client.js +5 -4
- package/core/fetcher/Fetcher.d.ts +1 -0
- package/core/fetcher/Fetcher.js +58 -7
- package/dist/Client.d.ts +2 -0
- package/dist/api/resources/prompt/client/Client.d.ts +2 -0
- package/dist/api/resources/prompt/client/Client.js +25 -20
- package/dist/api/resources/run/client/Client.d.ts +2 -0
- package/dist/api/resources/run/client/Client.js +15 -12
- package/dist/api/resources/runMetric/client/Client.d.ts +2 -0
- package/dist/api/resources/runMetric/client/Client.js +5 -4
- package/dist/api/resources/score/client/Client.d.ts +2 -0
- package/dist/api/resources/score/client/Client.js +10 -8
- package/dist/api/resources/testcase/client/Client.d.ts +2 -0
- package/dist/api/resources/testcase/client/Client.js +15 -12
- package/dist/api/resources/testrecord/client/Client.d.ts +2 -0
- package/dist/api/resources/testrecord/client/Client.js +10 -8
- package/dist/api/resources/testset/client/Client.d.ts +2 -0
- package/dist/api/resources/testset/client/Client.js +25 -20
- package/dist/api/resources/traces/client/Client.d.ts +2 -0
- package/dist/api/resources/traces/client/Client.js +5 -4
- package/dist/core/fetcher/Fetcher.d.ts +1 -0
- package/dist/core/fetcher/Fetcher.js +58 -7
- package/dist/telemetry.d.ts +6 -0
- package/dist/telemetry.js +65 -0
- package/dist/wrapper/ScorecardClient.d.ts +1 -8
- package/dist/wrapper/ScorecardClient.js +0 -12
- package/package.json +56 -2
- package/telemetry.d.ts +6 -0
- package/telemetry.js +65 -0
- package/wrapper/ScorecardClient.d.ts +1 -8
- package/wrapper/ScorecardClient.js +0 -12
package/Client.d.ts
CHANGED
|
@@ -15,10 +15,12 @@ export declare namespace ScorecardClient {
|
|
|
15
15
|
interface Options {
|
|
16
16
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
17
17
|
apiKey: core.Supplier<string>;
|
|
18
|
+
fetcher?: core.FetchFunction;
|
|
18
19
|
}
|
|
19
20
|
interface RequestOptions {
|
|
20
21
|
timeoutInSeconds?: number;
|
|
21
22
|
maxRetries?: number;
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
export declare class ScorecardClient {
|
|
@@ -8,10 +8,12 @@ export declare namespace Prompt {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Prompt {
|
|
@@ -92,16 +92,17 @@ class Prompt {
|
|
|
92
92
|
* })
|
|
93
93
|
*/
|
|
94
94
|
create(request, requestOptions) {
|
|
95
|
-
var _a;
|
|
95
|
+
var _a, _b;
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const _response = yield core.fetcher({
|
|
98
|
-
url: (0, url_join_1.default)((
|
|
97
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
98
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/prompt"),
|
|
99
99
|
method: "POST",
|
|
100
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
100
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
101
101
|
contentType: "application/json",
|
|
102
102
|
body: yield serializers.PromptCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
103
103
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
104
104
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
105
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
105
106
|
});
|
|
106
107
|
if (_response.ok) {
|
|
107
108
|
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
@@ -183,15 +184,16 @@ class Prompt {
|
|
|
183
184
|
* await scorecard.prompt.get("id")
|
|
184
185
|
*/
|
|
185
186
|
get(id, requestOptions) {
|
|
186
|
-
var _a;
|
|
187
|
+
var _a, _b;
|
|
187
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
const _response = yield core.fetcher({
|
|
189
|
-
url: (0, url_join_1.default)((
|
|
189
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
190
|
+
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)}`),
|
|
190
191
|
method: "GET",
|
|
191
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
192
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
192
193
|
contentType: "application/json",
|
|
193
194
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
194
195
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
196
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
195
197
|
});
|
|
196
198
|
if (_response.ok) {
|
|
197
199
|
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
@@ -273,15 +275,16 @@ class Prompt {
|
|
|
273
275
|
* await scorecard.prompt.delete("id")
|
|
274
276
|
*/
|
|
275
277
|
delete(id, requestOptions) {
|
|
276
|
-
var _a;
|
|
278
|
+
var _a, _b;
|
|
277
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
const _response = yield core.fetcher({
|
|
279
|
-
url: (0, url_join_1.default)((
|
|
280
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
281
|
+
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)}`),
|
|
280
282
|
method: "DELETE",
|
|
281
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
283
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
282
284
|
contentType: "application/json",
|
|
283
285
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
284
286
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
287
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
285
288
|
});
|
|
286
289
|
if (_response.ok) {
|
|
287
290
|
return _response.body;
|
|
@@ -362,16 +365,17 @@ class Prompt {
|
|
|
362
365
|
* })
|
|
363
366
|
*/
|
|
364
367
|
update(id, request = {}, requestOptions) {
|
|
365
|
-
var _a;
|
|
368
|
+
var _a, _b;
|
|
366
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
367
|
-
const _response = yield core.fetcher({
|
|
368
|
-
url: (0, url_join_1.default)((
|
|
370
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
371
|
+
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)}`),
|
|
369
372
|
method: "PATCH",
|
|
370
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
373
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
371
374
|
contentType: "application/json",
|
|
372
375
|
body: yield serializers.PromptUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
373
376
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
374
377
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
378
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
375
379
|
});
|
|
376
380
|
if (_response.ok) {
|
|
377
381
|
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
@@ -453,15 +457,16 @@ class Prompt {
|
|
|
453
457
|
* await scorecard.prompt.getByName("name")
|
|
454
458
|
*/
|
|
455
459
|
getByName(name, requestOptions) {
|
|
456
|
-
var _a;
|
|
460
|
+
var _a, _b;
|
|
457
461
|
return __awaiter(this, void 0, void 0, function* () {
|
|
458
|
-
const _response = yield core.fetcher({
|
|
459
|
-
url: (0, url_join_1.default)((
|
|
462
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
463
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/prompt/name/${encodeURIComponent(name)}`),
|
|
460
464
|
method: "GET",
|
|
461
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
465
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
462
466
|
contentType: "application/json",
|
|
463
467
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
464
468
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
469
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
465
470
|
});
|
|
466
471
|
if (_response.ok) {
|
|
467
472
|
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Run {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Run {
|
|
@@ -64,16 +64,17 @@ class Run {
|
|
|
64
64
|
* await scorecard.run.create()
|
|
65
65
|
*/
|
|
66
66
|
create(request = {}, requestOptions) {
|
|
67
|
-
var _a;
|
|
67
|
+
var _a, _b;
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const _response = yield core.fetcher({
|
|
70
|
-
url: (0, url_join_1.default)((
|
|
69
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
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.
|
|
72
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
73
73
|
contentType: "application/json",
|
|
74
74
|
body: yield serializers.RunCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
75
75
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
76
76
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
77
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
77
78
|
});
|
|
78
79
|
if (_response.ok) {
|
|
79
80
|
return yield serializers.Run.parseOrThrow(_response.body, {
|
|
@@ -155,15 +156,16 @@ class Run {
|
|
|
155
156
|
* await scorecard.run.get(1)
|
|
156
157
|
*/
|
|
157
158
|
get(runId, requestOptions) {
|
|
158
|
-
var _a;
|
|
159
|
+
var _a, _b;
|
|
159
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
const _response = yield core.fetcher({
|
|
161
|
-
url: (0, url_join_1.default)((
|
|
161
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
162
|
+
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)}`),
|
|
162
163
|
method: "GET",
|
|
163
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
164
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
164
165
|
contentType: "application/json",
|
|
165
166
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
166
167
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
168
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
167
169
|
});
|
|
168
170
|
if (_response.ok) {
|
|
169
171
|
return yield serializers.Run.parseOrThrow(_response.body, {
|
|
@@ -246,16 +248,17 @@ class Run {
|
|
|
246
248
|
* await scorecard.run.updateStatus(1)
|
|
247
249
|
*/
|
|
248
250
|
updateStatus(runId, request = {}, requestOptions) {
|
|
249
|
-
var _a;
|
|
251
|
+
var _a, _b;
|
|
250
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
const _response = yield core.fetcher({
|
|
252
|
-
url: (0, url_join_1.default)((
|
|
253
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
254
|
+
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`),
|
|
253
255
|
method: "PATCH",
|
|
254
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
256
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
255
257
|
contentType: "application/json",
|
|
256
258
|
body: yield serializers.UpdateStatusParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
257
259
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
258
260
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
261
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
259
262
|
});
|
|
260
263
|
if (_response.ok) {
|
|
261
264
|
return yield serializers.Run.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace RunMetric {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class RunMetric {
|
|
@@ -64,15 +64,16 @@ class RunMetric {
|
|
|
64
64
|
* await scorecard.runMetric.get(1)
|
|
65
65
|
*/
|
|
66
66
|
get(runId, requestOptions) {
|
|
67
|
-
var _a;
|
|
67
|
+
var _a, _b;
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const _response = yield core.fetcher({
|
|
70
|
-
url: (0, url_join_1.default)((
|
|
69
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
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.
|
|
72
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
73
73
|
contentType: "application/json",
|
|
74
74
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
75
75
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
76
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
76
77
|
});
|
|
77
78
|
if (_response.ok) {
|
|
78
79
|
return yield serializers.runMetric.get.Response.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Score {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Score {
|
|
@@ -68,16 +68,17 @@ class Score {
|
|
|
68
68
|
* })
|
|
69
69
|
*/
|
|
70
70
|
create(runId, testrecordId, request, requestOptions) {
|
|
71
|
-
var _a;
|
|
71
|
+
var _a, _b;
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const _response = yield core.fetcher({
|
|
74
|
-
url: (0, url_join_1.default)((
|
|
73
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
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.
|
|
76
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
77
77
|
contentType: "application/json",
|
|
78
78
|
body: yield serializers.ScoreCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
79
79
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
80
80
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
81
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
81
82
|
});
|
|
82
83
|
if (_response.ok) {
|
|
83
84
|
return yield serializers.Grade.parseOrThrow(_response.body, {
|
|
@@ -162,16 +163,17 @@ class Score {
|
|
|
162
163
|
* await scorecard.score.update(1, 1, 1)
|
|
163
164
|
*/
|
|
164
165
|
update(runId, testrecordId, scoreId, request = {}, requestOptions) {
|
|
165
|
-
var _a;
|
|
166
|
+
var _a, _b;
|
|
166
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const _response = yield core.fetcher({
|
|
168
|
-
url: (0, url_join_1.default)((
|
|
168
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
169
|
+
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)}`),
|
|
169
170
|
method: "PATCH",
|
|
170
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
171
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
171
172
|
contentType: "application/json",
|
|
172
173
|
body: yield serializers.ScoreUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
173
174
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
174
175
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
176
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
175
177
|
});
|
|
176
178
|
if (_response.ok) {
|
|
177
179
|
return yield serializers.Grade.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Testcase {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Testcase {
|
|
@@ -65,16 +65,17 @@ class Testcase {
|
|
|
65
65
|
* await scorecard.testcase.create(1)
|
|
66
66
|
*/
|
|
67
67
|
create(testsetId, request = {}, requestOptions) {
|
|
68
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const _response = yield core.fetcher({
|
|
71
|
-
url: (0, url_join_1.default)((
|
|
70
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}/testcase`),
|
|
72
72
|
method: "POST",
|
|
73
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
73
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
74
74
|
contentType: "application/json",
|
|
75
75
|
body: yield serializers.TestcaseCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
76
76
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
77
77
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
78
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
78
79
|
});
|
|
79
80
|
if (_response.ok) {
|
|
80
81
|
return yield serializers.TestCase.parseOrThrow(_response.body, {
|
|
@@ -157,15 +158,16 @@ class Testcase {
|
|
|
157
158
|
* await scorecard.testcase.get(1, 1)
|
|
158
159
|
*/
|
|
159
160
|
get(testcaseId, testsetId, requestOptions) {
|
|
160
|
-
var _a;
|
|
161
|
+
var _a, _b;
|
|
161
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
const _response = yield core.fetcher({
|
|
163
|
-
url: (0, url_join_1.default)((
|
|
163
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
164
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}/testcase/${encodeURIComponent(testcaseId)}`),
|
|
164
165
|
method: "GET",
|
|
165
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
166
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
166
167
|
contentType: "application/json",
|
|
167
168
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
168
169
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
170
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
169
171
|
});
|
|
170
172
|
if (_response.ok) {
|
|
171
173
|
return yield serializers.TestCase.parseOrThrow(_response.body, {
|
|
@@ -248,15 +250,16 @@ class Testcase {
|
|
|
248
250
|
* await scorecard.testcase.delete(1, 1)
|
|
249
251
|
*/
|
|
250
252
|
delete(testcaseId, testsetId, requestOptions) {
|
|
251
|
-
var _a;
|
|
253
|
+
var _a, _b;
|
|
252
254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
-
const _response = yield core.fetcher({
|
|
254
|
-
url: (0, url_join_1.default)((
|
|
255
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
256
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}/testcase/${encodeURIComponent(testcaseId)}`),
|
|
255
257
|
method: "DELETE",
|
|
256
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
258
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
257
259
|
contentType: "application/json",
|
|
258
260
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
259
261
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
262
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
263
|
});
|
|
261
264
|
if (_response.ok) {
|
|
262
265
|
return yield serializers.TestcaseDeletionResponse.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Testrecord {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Testrecord {
|
|
@@ -65,15 +65,16 @@ class Testrecord {
|
|
|
65
65
|
* await scorecard.testrecord.get(1, 1)
|
|
66
66
|
*/
|
|
67
67
|
get(testrecordId, runId, requestOptions) {
|
|
68
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const _response = yield core.fetcher({
|
|
71
|
-
url: (0, url_join_1.default)((
|
|
70
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
|
+
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)}`),
|
|
72
72
|
method: "GET",
|
|
73
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
73
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
74
74
|
contentType: "application/json",
|
|
75
75
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
76
76
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
77
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
77
78
|
});
|
|
78
79
|
if (_response.ok) {
|
|
79
80
|
return yield serializers.Testrecord.parseOrThrow(_response.body, {
|
|
@@ -156,16 +157,17 @@ class Testrecord {
|
|
|
156
157
|
* await scorecard.testrecord.create(1)
|
|
157
158
|
*/
|
|
158
159
|
create(runId, request = {}, requestOptions) {
|
|
159
|
-
var _a;
|
|
160
|
+
var _a, _b;
|
|
160
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const _response = yield core.fetcher({
|
|
162
|
-
url: (0, url_join_1.default)((
|
|
162
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
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)}/testrecord`),
|
|
163
164
|
method: "POST",
|
|
164
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
165
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
165
166
|
contentType: "application/json",
|
|
166
167
|
body: yield serializers.TestrecordCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
167
168
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
168
169
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
170
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
169
171
|
});
|
|
170
172
|
if (_response.ok) {
|
|
171
173
|
return yield serializers.Testrecord.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Testset {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Testset {
|
|
@@ -64,15 +64,16 @@ class Testset {
|
|
|
64
64
|
* await scorecard.testset.get(1)
|
|
65
65
|
*/
|
|
66
66
|
get(testsetId, requestOptions) {
|
|
67
|
-
var _a;
|
|
67
|
+
var _a, _b;
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const _response = yield core.fetcher({
|
|
70
|
-
url: (0, url_join_1.default)((
|
|
69
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
70
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}`),
|
|
71
71
|
method: "GET",
|
|
72
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
72
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
73
73
|
contentType: "application/json",
|
|
74
74
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
75
75
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
76
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
76
77
|
});
|
|
77
78
|
if (_response.ok) {
|
|
78
79
|
return yield serializers.Testset.parseOrThrow(_response.body, {
|
|
@@ -154,15 +155,16 @@ class Testset {
|
|
|
154
155
|
* await scorecard.testset.delete(1)
|
|
155
156
|
*/
|
|
156
157
|
delete(testsetId, requestOptions) {
|
|
157
|
-
var _a;
|
|
158
|
+
var _a, _b;
|
|
158
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
const _response = yield core.fetcher({
|
|
160
|
-
url: (0, url_join_1.default)((
|
|
160
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
161
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}`),
|
|
161
162
|
method: "DELETE",
|
|
162
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
163
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
163
164
|
contentType: "application/json",
|
|
164
165
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
165
166
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
167
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
166
168
|
});
|
|
167
169
|
if (_response.ok) {
|
|
168
170
|
return yield serializers.Testset.parseOrThrow(_response.body, {
|
|
@@ -246,16 +248,17 @@ class Testset {
|
|
|
246
248
|
* })
|
|
247
249
|
*/
|
|
248
250
|
create(request, requestOptions) {
|
|
249
|
-
var _a;
|
|
251
|
+
var _a, _b;
|
|
250
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
const _response = yield core.fetcher({
|
|
252
|
-
url: (0, url_join_1.default)((
|
|
253
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
254
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, "v1/testset"),
|
|
253
255
|
method: "POST",
|
|
254
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
256
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
255
257
|
contentType: "application/json",
|
|
256
258
|
body: yield serializers.TestsetCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
257
259
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
258
260
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
261
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
259
262
|
});
|
|
260
263
|
if (_response.ok) {
|
|
261
264
|
return yield serializers.Testset.parseOrThrow(_response.body, {
|
|
@@ -337,15 +340,16 @@ class Testset {
|
|
|
337
340
|
* await scorecard.testset.readSchema(1)
|
|
338
341
|
*/
|
|
339
342
|
readSchema(testsetId, requestOptions) {
|
|
340
|
-
var _a;
|
|
343
|
+
var _a, _b;
|
|
341
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
342
|
-
const _response = yield core.fetcher({
|
|
343
|
-
url: (0, url_join_1.default)((
|
|
345
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
346
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}/schema`),
|
|
344
347
|
method: "GET",
|
|
345
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
348
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
346
349
|
contentType: "application/json",
|
|
347
350
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
348
351
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
352
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
349
353
|
});
|
|
350
354
|
if (_response.ok) {
|
|
351
355
|
return yield serializers.CustomSchema.parseOrThrow(_response.body, {
|
|
@@ -428,7 +432,7 @@ class Testset {
|
|
|
428
432
|
* await scorecard.testset.getTestcases(1)
|
|
429
433
|
*/
|
|
430
434
|
getTestcases(testsetId, request = {}, requestOptions) {
|
|
431
|
-
var _a;
|
|
435
|
+
var _a, _b;
|
|
432
436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
433
437
|
const { offset, limit } = request;
|
|
434
438
|
const _queryParams = {};
|
|
@@ -438,14 +442,15 @@ class Testset {
|
|
|
438
442
|
if (limit != null) {
|
|
439
443
|
_queryParams["limit"] = limit.toString();
|
|
440
444
|
}
|
|
441
|
-
const _response = yield core.fetcher({
|
|
442
|
-
url: (0, url_join_1.default)((
|
|
445
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
446
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ScorecardEnvironment.Default, `v1/testset/${encodeURIComponent(testsetId)}/testcase`),
|
|
443
447
|
method: "GET",
|
|
444
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.
|
|
448
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
445
449
|
contentType: "application/json",
|
|
446
450
|
queryParameters: _queryParams,
|
|
447
451
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
448
452
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
453
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
449
454
|
});
|
|
450
455
|
if (_response.ok) {
|
|
451
456
|
return yield serializers.PaginatedTestcaseResponse.parseOrThrow(_response.body, {
|
|
@@ -8,10 +8,12 @@ export declare namespace Traces {
|
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.ScorecardEnvironment | string>;
|
|
10
10
|
apiKey: core.Supplier<string>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
12
13
|
interface RequestOptions {
|
|
13
14
|
timeoutInSeconds?: number;
|
|
14
15
|
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
export declare class Traces {
|