scorecard-ai 0.5.2 → 0.5.4
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/api/resources/prompt/client/Client.js +5 -5
- package/api/resources/run/client/Client.js +3 -3
- package/api/resources/run/client/requests/RunCreateParams.d.ts +1 -0
- package/api/resources/runMetric/client/Client.js +1 -1
- package/api/resources/score/client/Client.js +2 -2
- package/api/resources/score/client/requests/ScoreCreateParams.d.ts +3 -0
- package/api/resources/score/client/requests/ScoreUpdateParams.d.ts +3 -0
- package/api/resources/testcase/client/Client.js +3 -3
- package/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +2 -0
- package/api/resources/testrecord/client/Client.js +2 -2
- package/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +7 -0
- package/api/resources/testset/client/Client.js +5 -5
- package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
- package/api/resources/traces/client/Client.js +1 -1
- package/api/types/Grade.d.ts +11 -0
- package/api/types/PaginatedTestcaseResponse.d.ts +2 -0
- package/api/types/Prompt.d.ts +2 -0
- package/api/types/Run.d.ts +14 -0
- package/api/types/TestCase.d.ts +4 -0
- package/api/types/Testrecord.d.ts +12 -0
- package/api/types/Testset.d.ts +11 -0
- package/dist/api/resources/prompt/client/Client.js +5 -5
- package/dist/api/resources/run/client/Client.js +3 -3
- package/dist/api/resources/run/client/requests/RunCreateParams.d.ts +1 -0
- package/dist/api/resources/runMetric/client/Client.js +1 -1
- package/dist/api/resources/score/client/Client.js +2 -2
- package/dist/api/resources/score/client/requests/ScoreCreateParams.d.ts +3 -0
- package/dist/api/resources/score/client/requests/ScoreUpdateParams.d.ts +3 -0
- package/dist/api/resources/testcase/client/Client.js +3 -3
- package/dist/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +2 -0
- package/dist/api/resources/testrecord/client/Client.js +2 -2
- package/dist/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +7 -0
- package/dist/api/resources/testset/client/Client.js +5 -5
- package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +2 -0
- package/dist/api/resources/traces/client/Client.js +1 -1
- package/dist/api/types/Grade.d.ts +11 -0
- package/dist/api/types/PaginatedTestcaseResponse.d.ts +2 -0
- package/dist/api/types/Prompt.d.ts +2 -0
- package/dist/api/types/Run.d.ts +14 -0
- package/dist/api/types/TestCase.d.ts +4 -0
- package/dist/api/types/Testrecord.d.ts +12 -0
- package/dist/api/types/Testset.d.ts +11 -0
- package/dist/telemetry.d.ts +0 -5
- package/dist/telemetry.js +25 -7
- package/dist/wrapper/ScorecardClient.d.ts +2 -10
- package/dist/wrapper/ScorecardClient.js +10 -9
- package/package.json +6 -1
- package/telemetry.d.ts +0 -5
- package/telemetry.js +25 -7
- package/wrapper/ScorecardClient.d.ts +2 -10
- package/wrapper/ScorecardClient.js +10 -9
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
export interface ScoreCreateParams {
|
|
11
11
|
/** The ID of the metric */
|
|
12
12
|
metricId: number;
|
|
13
|
+
/** Specify integer scores. */
|
|
13
14
|
intScore?: number;
|
|
15
|
+
/** Specify boolean scores. */
|
|
14
16
|
binaryScore?: boolean;
|
|
17
|
+
/** The reasoning for the assigned score. */
|
|
15
18
|
reasoning?: string;
|
|
16
19
|
}
|
|
@@ -70,7 +70,7 @@ class Testcase {
|
|
|
70
70
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
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.5.
|
|
73
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "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,
|
|
@@ -163,7 +163,7 @@ class Testcase {
|
|
|
163
163
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
164
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)}`),
|
|
165
165
|
method: "GET",
|
|
166
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
166
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
167
167
|
contentType: "application/json",
|
|
168
168
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
169
169
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -255,7 +255,7 @@ class Testcase {
|
|
|
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/testset/${encodeURIComponent(testsetId)}/testcase/${encodeURIComponent(testcaseId)}`),
|
|
257
257
|
method: "DELETE",
|
|
258
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
258
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
259
259
|
contentType: "application/json",
|
|
260
260
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
261
261
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -9,7 +9,9 @@ import * as Scorecard from "../../../../index";
|
|
|
9
9
|
export interface TestcaseCreateParams {
|
|
10
10
|
/** The user query to be executed. */
|
|
11
11
|
userQuery?: string;
|
|
12
|
+
/** The context to be used while generating the testcase. */
|
|
12
13
|
context?: string;
|
|
14
|
+
/** The ideal response to the user query. */
|
|
13
15
|
ideal?: string;
|
|
14
16
|
customInputs?: Record<string, Scorecard.TestcaseCreateParamsCustomInputsValue | undefined>;
|
|
15
17
|
customLabels?: Record<string, Scorecard.TestcaseCreateParamsCustomLabelsValue | undefined>;
|
|
@@ -70,7 +70,7 @@ class Testrecord {
|
|
|
70
70
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
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.5.
|
|
73
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "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,
|
|
@@ -162,7 +162,7 @@ class Testrecord {
|
|
|
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)}/testrecord`),
|
|
164
164
|
method: "POST",
|
|
165
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
165
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
166
166
|
contentType: "application/json",
|
|
167
167
|
body: yield serializers.TestrecordCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
168
168
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -9,14 +9,21 @@ import * as Scorecard from "../../../../index";
|
|
|
9
9
|
export interface TestrecordCreateParams {
|
|
10
10
|
testsetId?: number;
|
|
11
11
|
testcaseId?: number;
|
|
12
|
+
/** The user query that was executed for the testrecord. */
|
|
12
13
|
userQuery?: string;
|
|
14
|
+
/** The context that was used while generating the testrecord. */
|
|
13
15
|
context?: string;
|
|
16
|
+
/** The response generated by the model. */
|
|
14
17
|
response?: string;
|
|
18
|
+
/** The ideal response. */
|
|
15
19
|
ideal?: string;
|
|
16
20
|
customInputs?: Record<string, Scorecard.TestrecordCreateParamsCustomInputsValue | undefined>;
|
|
17
21
|
customOutputs?: Record<string, Scorecard.TestrecordCreateParamsCustomOutputsValue | undefined>;
|
|
18
22
|
customLabels?: Record<string, Scorecard.TestrecordCreateParamsCustomLabelsValue | undefined>;
|
|
23
|
+
/** The prompt used to generate the response. */
|
|
19
24
|
prompt?: string;
|
|
25
|
+
/** The model parameters used to generate the response. */
|
|
20
26
|
modelParams?: Record<string, Scorecard.TestrecordCreateParamsModelParamsValue | undefined>;
|
|
27
|
+
/** Debug information generated by Scorecard during the execution of the testrecord. */
|
|
21
28
|
modelDebugInfo?: Record<string, Scorecard.TestrecordCreateParamsModelDebugInfoValue | undefined>;
|
|
22
29
|
}
|
|
@@ -69,7 +69,7 @@ class Testset {
|
|
|
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/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.5.
|
|
72
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "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,
|
|
@@ -160,7 +160,7 @@ class Testset {
|
|
|
160
160
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
161
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)}`),
|
|
162
162
|
method: "DELETE",
|
|
163
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
163
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
164
164
|
contentType: "application/json",
|
|
165
165
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
166
166
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -253,7 +253,7 @@ class Testset {
|
|
|
253
253
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
254
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"),
|
|
255
255
|
method: "POST",
|
|
256
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
256
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
257
257
|
contentType: "application/json",
|
|
258
258
|
body: yield serializers.TestsetCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
259
259
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -345,7 +345,7 @@ class Testset {
|
|
|
345
345
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
346
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`),
|
|
347
347
|
method: "GET",
|
|
348
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
348
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
349
349
|
contentType: "application/json",
|
|
350
350
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
351
351
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -445,7 +445,7 @@ class Testset {
|
|
|
445
445
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
446
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`),
|
|
447
447
|
method: "GET",
|
|
448
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
448
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
449
449
|
contentType: "application/json",
|
|
450
450
|
queryParameters: _queryParams,
|
|
451
451
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -10,7 +10,9 @@ import * as Scorecard from "../../../../index";
|
|
|
10
10
|
*/
|
|
11
11
|
export interface TestsetCreateParams {
|
|
12
12
|
name: string;
|
|
13
|
+
/** A description for the testset. */
|
|
13
14
|
description?: string;
|
|
15
|
+
/** Whether or not the testset uses retrieval. */
|
|
14
16
|
usingRetrieval?: boolean;
|
|
15
17
|
customSchema?: Scorecard.CustomSchema;
|
|
16
18
|
}
|
|
@@ -69,7 +69,7 @@ class Traces {
|
|
|
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/traces/${encodeURIComponent(traceId)}/spans`),
|
|
71
71
|
method: "GET",
|
|
72
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.
|
|
72
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.5.4", "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,
|
|
@@ -4,19 +4,30 @@
|
|
|
4
4
|
import * as Scorecard from "../index";
|
|
5
5
|
export interface Grade {
|
|
6
6
|
userId?: string;
|
|
7
|
+
/** The ID of the grade. */
|
|
7
8
|
id?: number;
|
|
9
|
+
/** The ID of the run that created the grade. */
|
|
8
10
|
runId?: number;
|
|
11
|
+
/** The ID of the testcase associated with the grade. */
|
|
9
12
|
testcaseId?: number;
|
|
13
|
+
/** The ID of the testrecord for which the grade was created. */
|
|
10
14
|
testrecordId?: number;
|
|
15
|
+
/** The ID of the metric used to compute the grade. */
|
|
11
16
|
metricId?: number;
|
|
17
|
+
/** The binary score assigned to the grade. */
|
|
12
18
|
binaryScore?: boolean;
|
|
19
|
+
/** The integer score assigned to the grade. */
|
|
13
20
|
intScore?: number;
|
|
21
|
+
/** The reasoning for the assigned score. */
|
|
14
22
|
reasoning?: string;
|
|
15
23
|
/** Indicates if a human should assign a grade. */
|
|
16
24
|
humanEval?: boolean;
|
|
17
25
|
/** The status of the grade. */
|
|
18
26
|
status?: Scorecard.ScoreStatus;
|
|
27
|
+
/** The error message if the grade was not created successfully. */
|
|
19
28
|
errorMessage?: string;
|
|
29
|
+
/** when the grade was created. */
|
|
20
30
|
createdAt?: Date;
|
|
31
|
+
/** when the grade was last updated. */
|
|
21
32
|
updatedAt?: Date;
|
|
22
33
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import * as Scorecard from "../index";
|
|
5
5
|
export interface PaginatedTestcaseResponse {
|
|
6
6
|
count: number;
|
|
7
|
+
/** The URL to fetch the next page of testcases. */
|
|
7
8
|
next?: string;
|
|
9
|
+
/** The URL to fetch the previous page of testcases. */
|
|
8
10
|
previous?: string;
|
|
9
11
|
/** The list of Testcases retrieved in this page. */
|
|
10
12
|
results: Scorecard.TestCase[];
|
package/dist/api/types/Run.d.ts
CHANGED
|
@@ -3,18 +3,32 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface Run {
|
|
5
5
|
id?: number;
|
|
6
|
+
/** The creation date and time of the run. */
|
|
6
7
|
createdAt?: Date;
|
|
8
|
+
/** The last time the run was updated. */
|
|
7
9
|
updatedAt?: Date;
|
|
10
|
+
/** The start time of the run. */
|
|
8
11
|
executionStartTime?: Date;
|
|
12
|
+
/** The end time of the run. */
|
|
9
13
|
executionEndTime?: Date;
|
|
14
|
+
/** The testset that was executed in this run. */
|
|
10
15
|
testsetId?: number;
|
|
16
|
+
/** The current status of the run. */
|
|
11
17
|
status?: string;
|
|
18
|
+
/** The maximum number of testcases to run. */
|
|
12
19
|
limitTestcases?: number;
|
|
20
|
+
/** How the run was created. */
|
|
13
21
|
source?: string;
|
|
22
|
+
/** The model parameters used when generating the run. */
|
|
14
23
|
modelParams?: Record<string, unknown>;
|
|
24
|
+
/** Notes about the run. */
|
|
15
25
|
notes?: string;
|
|
26
|
+
/** The ID of the scoring configuration the run uses. */
|
|
16
27
|
scoringConfigId?: number;
|
|
28
|
+
/** The prompt template to be used while executing the run. */
|
|
17
29
|
promptTemplate?: string;
|
|
30
|
+
/** The start time of scoring the run's results. */
|
|
18
31
|
scoringStartTime?: Date;
|
|
32
|
+
/** The end time of scoring the run's results. */
|
|
19
33
|
scoringEndTime?: Date;
|
|
20
34
|
}
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Scorecard from "../index";
|
|
5
5
|
export interface TestCase {
|
|
6
|
+
/** The ID of the testcase. */
|
|
6
7
|
id?: number;
|
|
8
|
+
/** The creation date and time of the testcase. */
|
|
7
9
|
createdAt?: Date;
|
|
8
10
|
/** The ID of the testset the testcase belongs to. */
|
|
9
11
|
testsetId: number;
|
|
10
12
|
/** The user query for the testcase. */
|
|
11
13
|
userQuery: string;
|
|
14
|
+
/** The context for the testcase. */
|
|
12
15
|
context?: string;
|
|
16
|
+
/** The ideal response for the testcase. */
|
|
13
17
|
ideal?: string;
|
|
14
18
|
customInputs?: Record<string, Scorecard.TestCaseCustomInputsValue | undefined>;
|
|
15
19
|
customLabels?: Record<string, Scorecard.TestCaseCustomLabelsValue | undefined>;
|
|
@@ -4,19 +4,31 @@
|
|
|
4
4
|
import * as Scorecard from "../index";
|
|
5
5
|
export interface Testrecord {
|
|
6
6
|
id?: number;
|
|
7
|
+
/** The creation date and time of the testrecord. */
|
|
7
8
|
createdAt?: Date;
|
|
9
|
+
/** The ID of the run the testrecord belongs to. */
|
|
8
10
|
runId?: number;
|
|
11
|
+
/** The ID of the testset the testrecord belongs to. */
|
|
9
12
|
testsetId?: number;
|
|
13
|
+
/** The ID of the testcase the testrecord belongs to. */
|
|
10
14
|
testcaseId?: number;
|
|
15
|
+
/** The user query for the testrecord. */
|
|
11
16
|
userQuery?: string;
|
|
17
|
+
/** The context for the testrecord. */
|
|
12
18
|
context?: string;
|
|
19
|
+
/** The actual response of the model for the testrecord. */
|
|
13
20
|
modelResponse?: string;
|
|
21
|
+
/** The ideal response for the testrecord. */
|
|
14
22
|
ideal?: string;
|
|
15
23
|
customInputs?: Record<string, Scorecard.TestrecordCustomInputsValue | undefined>;
|
|
16
24
|
customLabels?: Record<string, Scorecard.TestrecordCustomLabelsValue | undefined>;
|
|
17
25
|
customOutputs?: Record<string, Scorecard.TestrecordCustomOutputsValue | undefined>;
|
|
26
|
+
/** The current status of the testrecord. */
|
|
18
27
|
status?: string;
|
|
28
|
+
/** The prompt used to generate the testrecord. */
|
|
19
29
|
prompt?: string;
|
|
30
|
+
/** The model parameters used when generating the testrecord. */
|
|
20
31
|
modelParams?: Record<string, Scorecard.TestrecordModelParamsValue | undefined>;
|
|
32
|
+
/** Debug information produced during the testrecord's generation. */
|
|
21
33
|
modelDebugInfo?: Record<string, Scorecard.TestrecordModelDebugInfoValue | undefined>;
|
|
22
34
|
}
|
|
@@ -3,16 +3,27 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Scorecard from "../index";
|
|
5
5
|
export interface Testset {
|
|
6
|
+
/** The ID of the testset. */
|
|
6
7
|
id?: number;
|
|
8
|
+
/** The creation date and time of the testset. */
|
|
7
9
|
createdAt?: Date;
|
|
10
|
+
/** A human-readable name for the testset. This will be displayed in the UI. */
|
|
8
11
|
name?: string;
|
|
12
|
+
/** A description for the testset. */
|
|
9
13
|
description?: string;
|
|
14
|
+
/** Whether or not the testset uses retrieval. */
|
|
10
15
|
usingRetrieval?: boolean;
|
|
16
|
+
/** The method used to ingest the testset. */
|
|
11
17
|
ingestionMethod?: string;
|
|
18
|
+
/** The number of testcases in the testset. */
|
|
12
19
|
numTestcases?: number;
|
|
20
|
+
/** Whether or not the testset is published. */
|
|
13
21
|
published?: boolean;
|
|
22
|
+
/** The last time the testset was updated. */
|
|
14
23
|
updatedAt?: Date;
|
|
24
|
+
/** Whether or not the testset is archived. */
|
|
15
25
|
isArchived?: boolean;
|
|
26
|
+
/** The ID of the project the testset belongs to. */
|
|
16
27
|
projectId?: number;
|
|
17
28
|
customSchema?: Scorecard.CustomSchema;
|
|
18
29
|
}
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
declare const trace: any;
|
|
2
|
-
declare const OTLPTraceExporter: any;
|
|
3
|
-
declare const Resource: any;
|
|
4
|
-
declare const BatchSpanProcessor: any, ConsoleSpanExporter: any, NodeTracerProvider: any;
|
|
5
|
-
declare const SEMRESATTRS_SERVICE_NAME: any;
|
|
6
1
|
declare function checkInstalled(...modules: string[]): boolean;
|
package/dist/telemetry.js
CHANGED
|
@@ -8,11 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const { trace } = require('@opentelemetry/api');
|
|
12
|
-
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
13
|
-
const { Resource } = require('@opentelemetry/resources');
|
|
14
|
-
const { BatchSpanProcessor, ConsoleSpanExporter, NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
15
|
-
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
|
16
11
|
function checkInstalled(...modules) {
|
|
17
12
|
for (let i = 0; i < modules.length; i++) {
|
|
18
13
|
let module = modules[i];
|
|
@@ -27,6 +22,23 @@ function checkInstalled(...modules) {
|
|
|
27
22
|
}
|
|
28
23
|
module.exports = {
|
|
29
24
|
setup(name, scorecardConfig, debug = false) {
|
|
25
|
+
const required = [
|
|
26
|
+
'@opentelemetry/api',
|
|
27
|
+
'@opentelemetry/core',
|
|
28
|
+
'@opentelemetry/exporter-trace-otlp-http',
|
|
29
|
+
'@opentelemetry/resources',
|
|
30
|
+
'@opentelemetry/sdk-trace-node',
|
|
31
|
+
'@opentelemetry/semantic-conventions'
|
|
32
|
+
];
|
|
33
|
+
if (!checkInstalled(...required)) {
|
|
34
|
+
throw new Error(`Required OpenTelemetry packages not installed. Please ensure that all necessary peerDependencies are installed:\n${required.map(module => `- ${module}`).join('\n')}`);
|
|
35
|
+
}
|
|
36
|
+
const { propagation, trace } = require('@opentelemetry/api');
|
|
37
|
+
const { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } = require('@opentelemetry/core');
|
|
38
|
+
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
39
|
+
const { Resource } = require('@opentelemetry/resources');
|
|
40
|
+
const { BatchSpanProcessor, ConsoleSpanExporter, NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
41
|
+
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
|
30
42
|
const resource = Resource.default().merge(new Resource({
|
|
31
43
|
[SEMRESATTRS_SERVICE_NAME]: name,
|
|
32
44
|
}));
|
|
@@ -38,6 +50,12 @@ module.exports = {
|
|
|
38
50
|
const processor = new BatchSpanProcessor(consoleExporter);
|
|
39
51
|
provider.addSpanProcessor(processor);
|
|
40
52
|
}
|
|
53
|
+
propagation.setGlobalPropagator(new CompositePropagator({
|
|
54
|
+
propagators: [
|
|
55
|
+
new W3CTraceContextPropagator(),
|
|
56
|
+
new W3CBaggagePropagator()
|
|
57
|
+
]
|
|
58
|
+
}));
|
|
41
59
|
const url = scorecardConfig.telemetryUrl ? scorecardConfig.telemetryUrl : 'https://telemetry.getscorecard.ai';
|
|
42
60
|
const otlpExporter = new OTLPTraceExporter({
|
|
43
61
|
url: `${url}/v1/traces`,
|
|
@@ -48,11 +66,11 @@ module.exports = {
|
|
|
48
66
|
const processor = new BatchSpanProcessor(otlpExporter);
|
|
49
67
|
provider.addSpanProcessor(processor);
|
|
50
68
|
provider.register();
|
|
51
|
-
if (checkInstalled('@langchain/core')) {
|
|
69
|
+
if (checkInstalled('@langchain/core', '@arizeai/openinference-instrumentation-langchain', '@opentelemetry/instrumentation')) {
|
|
52
70
|
const { LangChainInstrumentation } = require('@arizeai/openinference-instrumentation-langchain');
|
|
53
71
|
new LangChainInstrumentation().manuallyInstrument(require('@langchain/core/callbacks/manager'));
|
|
54
72
|
}
|
|
55
|
-
if (checkInstalled('openai')) {
|
|
73
|
+
if (checkInstalled('openai', '@arizeai/openinference-instrumentation-openai', '@opentelemetry/instrumentation')) {
|
|
56
74
|
const { OpenAIInstrumentation } = require('@arizeai/openinference-instrumentation-openai');
|
|
57
75
|
new OpenAIInstrumentation().manuallyInstrument(require('openai'));
|
|
58
76
|
}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { ScorecardClient as FernClient } from "../Client";
|
|
2
|
-
import { ScorecardEnvironment } from "../environments";
|
|
3
|
-
import * as core from "../core";
|
|
4
2
|
export declare namespace ScorecardClient {
|
|
5
|
-
interface Options {
|
|
6
|
-
/**
|
|
7
|
-
* Your Scorecard API Key. Defaults to the environment
|
|
8
|
-
* variable SCORECARD_API_KEY.
|
|
9
|
-
*/
|
|
10
|
-
apiKey?: core.Supplier<string>;
|
|
11
|
-
environment?: core.Supplier<ScorecardEnvironment | string>;
|
|
3
|
+
interface Options extends Omit<FernClient.Options, "fetcher"> {
|
|
12
4
|
}
|
|
13
5
|
interface RequestOptions extends FernClient.RequestOptions {
|
|
14
6
|
}
|
|
@@ -28,7 +20,7 @@ export declare namespace ScorecardClient {
|
|
|
28
20
|
}
|
|
29
21
|
}
|
|
30
22
|
export declare class ScorecardClient extends FernClient {
|
|
31
|
-
constructor(options
|
|
23
|
+
constructor(options: ScorecardClient.Options);
|
|
32
24
|
/**
|
|
33
25
|
* Runs all tests within a testset
|
|
34
26
|
*/
|
|
@@ -33,18 +33,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.ScorecardClient = void 0;
|
|
36
|
+
const api_1 = require("@opentelemetry/api");
|
|
36
37
|
const Client_1 = require("../Client");
|
|
38
|
+
const core_1 = require("../core");
|
|
37
39
|
const errors = __importStar(require("../errors"));
|
|
38
40
|
class ScorecardClient extends Client_1.ScorecardClient {
|
|
39
|
-
constructor(options
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
41
|
+
constructor(options) {
|
|
42
|
+
const fetcher = (args) => {
|
|
43
|
+
var _a;
|
|
44
|
+
args.headers = (_a = args.headers) !== null && _a !== void 0 ? _a : {};
|
|
45
|
+
api_1.propagation.inject(api_1.context.active(), args.headers);
|
|
46
|
+
return (0, core_1.fetcher)(args);
|
|
47
|
+
};
|
|
48
|
+
super(Object.assign(Object.assign({}, options), { fetcher }));
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Runs all tests within a testset
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scorecard-ai",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "https://github.com/scorecard-ai/scorecard-node",
|
|
6
6
|
"license": "See LICENSE",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@arizeai/openinference-instrumentation-openai": "^0.2.0",
|
|
25
25
|
"@langchain/core": "^0.1.63",
|
|
26
26
|
"@opentelemetry/api": "*",
|
|
27
|
+
"@opentelemetry/core": "*",
|
|
27
28
|
"@opentelemetry/exporter-trace-otlp-http": "*",
|
|
28
29
|
"@opentelemetry/instrumentation": ">=0.40.0",
|
|
29
30
|
"@opentelemetry/resources": "*",
|
|
@@ -44,6 +45,9 @@
|
|
|
44
45
|
"@opentelemetry/api": {
|
|
45
46
|
"optional": false
|
|
46
47
|
},
|
|
48
|
+
"@opentelemetry/core": {
|
|
49
|
+
"optional": false
|
|
50
|
+
},
|
|
47
51
|
"@opentelemetry/exporter-trace-otlp-http": {
|
|
48
52
|
"optional": false
|
|
49
53
|
},
|
|
@@ -78,6 +82,7 @@
|
|
|
78
82
|
"@arizeai/openinference-instrumentation-openai": "^0.2.0",
|
|
79
83
|
"@langchain/core": "^0.1.63",
|
|
80
84
|
"@opentelemetry/api": "latest",
|
|
85
|
+
"@opentelemetry/core": "latest",
|
|
81
86
|
"@opentelemetry/exporter-trace-otlp-http": "latest",
|
|
82
87
|
"@opentelemetry/instrumentation": "latest",
|
|
83
88
|
"@opentelemetry/resources": "latest",
|
package/telemetry.d.ts
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
declare const trace: any;
|
|
2
|
-
declare const OTLPTraceExporter: any;
|
|
3
|
-
declare const Resource: any;
|
|
4
|
-
declare const BatchSpanProcessor: any, ConsoleSpanExporter: any, NodeTracerProvider: any;
|
|
5
|
-
declare const SEMRESATTRS_SERVICE_NAME: any;
|
|
6
1
|
declare function checkInstalled(...modules: string[]): boolean;
|
package/telemetry.js
CHANGED
|
@@ -8,11 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const { trace } = require('@opentelemetry/api');
|
|
12
|
-
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
13
|
-
const { Resource } = require('@opentelemetry/resources');
|
|
14
|
-
const { BatchSpanProcessor, ConsoleSpanExporter, NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
15
|
-
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
|
16
11
|
function checkInstalled(...modules) {
|
|
17
12
|
for (let i = 0; i < modules.length; i++) {
|
|
18
13
|
let module = modules[i];
|
|
@@ -27,6 +22,23 @@ function checkInstalled(...modules) {
|
|
|
27
22
|
}
|
|
28
23
|
module.exports = {
|
|
29
24
|
setup(name, scorecardConfig, debug = false) {
|
|
25
|
+
const required = [
|
|
26
|
+
'@opentelemetry/api',
|
|
27
|
+
'@opentelemetry/core',
|
|
28
|
+
'@opentelemetry/exporter-trace-otlp-http',
|
|
29
|
+
'@opentelemetry/resources',
|
|
30
|
+
'@opentelemetry/sdk-trace-node',
|
|
31
|
+
'@opentelemetry/semantic-conventions'
|
|
32
|
+
];
|
|
33
|
+
if (!checkInstalled(...required)) {
|
|
34
|
+
throw new Error(`Required OpenTelemetry packages not installed. Please ensure that all necessary peerDependencies are installed:\n${required.map(module => `- ${module}`).join('\n')}`);
|
|
35
|
+
}
|
|
36
|
+
const { propagation, trace } = require('@opentelemetry/api');
|
|
37
|
+
const { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } = require('@opentelemetry/core');
|
|
38
|
+
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
39
|
+
const { Resource } = require('@opentelemetry/resources');
|
|
40
|
+
const { BatchSpanProcessor, ConsoleSpanExporter, NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
|
|
41
|
+
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
|
30
42
|
const resource = Resource.default().merge(new Resource({
|
|
31
43
|
[SEMRESATTRS_SERVICE_NAME]: name,
|
|
32
44
|
}));
|
|
@@ -38,6 +50,12 @@ module.exports = {
|
|
|
38
50
|
const processor = new BatchSpanProcessor(consoleExporter);
|
|
39
51
|
provider.addSpanProcessor(processor);
|
|
40
52
|
}
|
|
53
|
+
propagation.setGlobalPropagator(new CompositePropagator({
|
|
54
|
+
propagators: [
|
|
55
|
+
new W3CTraceContextPropagator(),
|
|
56
|
+
new W3CBaggagePropagator()
|
|
57
|
+
]
|
|
58
|
+
}));
|
|
41
59
|
const url = scorecardConfig.telemetryUrl ? scorecardConfig.telemetryUrl : 'https://telemetry.getscorecard.ai';
|
|
42
60
|
const otlpExporter = new OTLPTraceExporter({
|
|
43
61
|
url: `${url}/v1/traces`,
|
|
@@ -48,11 +66,11 @@ module.exports = {
|
|
|
48
66
|
const processor = new BatchSpanProcessor(otlpExporter);
|
|
49
67
|
provider.addSpanProcessor(processor);
|
|
50
68
|
provider.register();
|
|
51
|
-
if (checkInstalled('@langchain/core')) {
|
|
69
|
+
if (checkInstalled('@langchain/core', '@arizeai/openinference-instrumentation-langchain', '@opentelemetry/instrumentation')) {
|
|
52
70
|
const { LangChainInstrumentation } = require('@arizeai/openinference-instrumentation-langchain');
|
|
53
71
|
new LangChainInstrumentation().manuallyInstrument(require('@langchain/core/callbacks/manager'));
|
|
54
72
|
}
|
|
55
|
-
if (checkInstalled('openai')) {
|
|
73
|
+
if (checkInstalled('openai', '@arizeai/openinference-instrumentation-openai', '@opentelemetry/instrumentation')) {
|
|
56
74
|
const { OpenAIInstrumentation } = require('@arizeai/openinference-instrumentation-openai');
|
|
57
75
|
new OpenAIInstrumentation().manuallyInstrument(require('openai'));
|
|
58
76
|
}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { ScorecardClient as FernClient } from "../Client";
|
|
2
|
-
import { ScorecardEnvironment } from "../environments";
|
|
3
|
-
import * as core from "../core";
|
|
4
2
|
export declare namespace ScorecardClient {
|
|
5
|
-
interface Options {
|
|
6
|
-
/**
|
|
7
|
-
* Your Scorecard API Key. Defaults to the environment
|
|
8
|
-
* variable SCORECARD_API_KEY.
|
|
9
|
-
*/
|
|
10
|
-
apiKey?: core.Supplier<string>;
|
|
11
|
-
environment?: core.Supplier<ScorecardEnvironment | string>;
|
|
3
|
+
interface Options extends Omit<FernClient.Options, "fetcher"> {
|
|
12
4
|
}
|
|
13
5
|
interface RequestOptions extends FernClient.RequestOptions {
|
|
14
6
|
}
|
|
@@ -28,7 +20,7 @@ export declare namespace ScorecardClient {
|
|
|
28
20
|
}
|
|
29
21
|
}
|
|
30
22
|
export declare class ScorecardClient extends FernClient {
|
|
31
|
-
constructor(options
|
|
23
|
+
constructor(options: ScorecardClient.Options);
|
|
32
24
|
/**
|
|
33
25
|
* Runs all tests within a testset
|
|
34
26
|
*/
|