scorecard-ai 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/client.d.mts +6 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +2 -2
  8. package/client.mjs.map +1 -1
  9. package/internal/to-file.d.mts +1 -1
  10. package/internal/to-file.d.ts +1 -1
  11. package/internal/to-file.js +1 -1
  12. package/internal/to-file.mjs +1 -1
  13. package/package.json +1 -1
  14. package/resources/index.d.mts +3 -3
  15. package/resources/index.d.mts.map +1 -1
  16. package/resources/index.d.ts +3 -3
  17. package/resources/index.d.ts.map +1 -1
  18. package/resources/index.js.map +1 -1
  19. package/resources/index.mjs +2 -2
  20. package/resources/index.mjs.map +1 -1
  21. package/resources/metrics.d.mts +348 -28
  22. package/resources/metrics.d.mts.map +1 -1
  23. package/resources/metrics.d.ts +348 -28
  24. package/resources/metrics.d.ts.map +1 -1
  25. package/resources/metrics.js +30 -0
  26. package/resources/metrics.js.map +1 -1
  27. package/resources/metrics.mjs +30 -0
  28. package/resources/metrics.mjs.map +1 -1
  29. package/resources/records.d.mts +45 -1
  30. package/resources/records.d.mts.map +1 -1
  31. package/resources/records.d.ts +45 -1
  32. package/resources/records.d.ts.map +1 -1
  33. package/resources/records.js +32 -0
  34. package/resources/records.js.map +1 -1
  35. package/resources/records.mjs +32 -0
  36. package/resources/records.mjs.map +1 -1
  37. package/resources/runs.d.mts +52 -5
  38. package/resources/runs.d.mts.map +1 -1
  39. package/resources/runs.d.ts +52 -5
  40. package/resources/runs.d.ts.map +1 -1
  41. package/resources/runs.js +30 -0
  42. package/resources/runs.js.map +1 -1
  43. package/resources/runs.mjs +30 -0
  44. package/resources/runs.mjs.map +1 -1
  45. package/resources/scores.d.mts +1 -1
  46. package/resources/scores.d.ts +1 -1
  47. package/src/client.ts +36 -5
  48. package/src/internal/to-file.ts +1 -1
  49. package/src/resources/index.ts +18 -3
  50. package/src/resources/metrics.ts +438 -27
  51. package/src/resources/records.ts +68 -1
  52. package/src/resources/runs.ts +76 -5
  53. package/src/resources/scores.ts +1 -1
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -1,7 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as ScoresAPI from './scores';
4
5
  import { APIPromise } from '../core/api-promise';
6
+ import { PagePromise, PaginatedResponse, type PaginatedResponseParams } from '../core/pagination';
5
7
  import { RequestOptions } from '../internal/request-options';
6
8
  import { path } from '../internal/utils/path';
7
9
 
@@ -24,8 +26,47 @@ export class Records extends APIResource {
24
26
  create(runID: string, body: RecordCreateParams, options?: RequestOptions): APIPromise<Record> {
25
27
  return this._client.post(path`/runs/${runID}/records`, { body, ...options });
26
28
  }
29
+
30
+ /**
31
+ * Retrieve a paginated list of Records for a Run, including all scores for each
32
+ * record.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * // Automatically fetches more pages as needed.
37
+ * for await (const recordListResponse of client.records.list(
38
+ * '135',
39
+ * )) {
40
+ * // ...
41
+ * }
42
+ * ```
43
+ */
44
+ list(
45
+ runID: string,
46
+ query: RecordListParams | null | undefined = {},
47
+ options?: RequestOptions,
48
+ ): PagePromise<RecordListResponsesPaginatedResponse, RecordListResponse> {
49
+ return this._client.getAPIList(path`/runs/${runID}/records`, PaginatedResponse<RecordListResponse>, {
50
+ query,
51
+ ...options,
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Delete a specific Record by ID.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const record = await client.records.delete('777');
61
+ * ```
62
+ */
63
+ delete(recordID: string, options?: RequestOptions): APIPromise<RecordDeleteResponse> {
64
+ return this._client.delete(path`/records/${recordID}`, options);
65
+ }
27
66
  }
28
67
 
68
+ export type RecordListResponsesPaginatedResponse = PaginatedResponse<RecordListResponse>;
69
+
29
70
  /**
30
71
  * A record of a system execution in the Scorecard system.
31
72
  */
@@ -62,6 +103,23 @@ export interface Record {
62
103
  testcaseId?: string;
63
104
  }
64
105
 
106
+ /**
107
+ * A record with all its associated scores.
108
+ */
109
+ export interface RecordListResponse extends Record {
110
+ /**
111
+ * All scores associated with this record.
112
+ */
113
+ scores: Array<ScoresAPI.Score>;
114
+ }
115
+
116
+ export interface RecordDeleteResponse {
117
+ /**
118
+ * Whether the deletion was successful.
119
+ */
120
+ success: boolean;
121
+ }
122
+
65
123
  export interface RecordCreateParams {
66
124
  /**
67
125
  * The expected outputs for the Testcase.
@@ -85,6 +143,15 @@ export interface RecordCreateParams {
85
143
  testcaseId?: string;
86
144
  }
87
145
 
146
+ export interface RecordListParams extends PaginatedResponseParams {}
147
+
88
148
  export declare namespace Records {
89
- export { type Record as Record, type RecordCreateParams as RecordCreateParams };
149
+ export {
150
+ type Record as Record,
151
+ type RecordListResponse as RecordListResponse,
152
+ type RecordDeleteResponse as RecordDeleteResponse,
153
+ type RecordListResponsesPaginatedResponse as RecordListResponsesPaginatedResponse,
154
+ type RecordCreateParams as RecordCreateParams,
155
+ type RecordListParams as RecordListParams,
156
+ };
90
157
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { PagePromise, PaginatedResponse, type PaginatedResponseParams } from '../core/pagination';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
  import { path } from '../internal/utils/path';
7
8
 
@@ -21,8 +22,45 @@ export class Runs extends APIResource {
21
22
  create(projectID: string, body: RunCreateParams, options?: RequestOptions): APIPromise<Run> {
22
23
  return this._client.post(path`/projects/${projectID}/runs`, { body, ...options });
23
24
  }
25
+
26
+ /**
27
+ * Retrieve a paginated list of all Runs for a Project. Runs are ordered by
28
+ * creation date, most recent first.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // Automatically fetches more pages as needed.
33
+ * for await (const run of client.runs.list('314')) {
34
+ * // ...
35
+ * }
36
+ * ```
37
+ */
38
+ list(
39
+ projectID: string,
40
+ query: RunListParams | null | undefined = {},
41
+ options?: RequestOptions,
42
+ ): PagePromise<RunsPaginatedResponse, Run> {
43
+ return this._client.getAPIList(path`/projects/${projectID}/runs`, PaginatedResponse<Run>, {
44
+ query,
45
+ ...options,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Retrieve a specific Run by ID.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const run = await client.runs.get('135');
55
+ * ```
56
+ */
57
+ get(runID: string, options?: RequestOptions): APIPromise<Run> {
58
+ return this._client.get(path`/runs/${runID}`, options);
59
+ }
24
60
  }
25
61
 
62
+ export type RunsPaginatedResponse = PaginatedResponse<Run>;
63
+
26
64
  /**
27
65
  * A Run in the Scorecard system.
28
66
  */
@@ -37,6 +75,27 @@ export interface Run {
37
75
  */
38
76
  metricIds: Array<string>;
39
77
 
78
+ /**
79
+ * The IDs of the metric versions this Run is using.
80
+ */
81
+ metricVersionIds: Array<string>;
82
+
83
+ /**
84
+ * The number of expected records in the Run. Determined by the number of testcases
85
+ * in the Run's Testset at the time of Run creation.
86
+ */
87
+ numExpectedRecords: number | null;
88
+
89
+ /**
90
+ * The number of records in the Run.
91
+ */
92
+ numRecords: number;
93
+
94
+ /**
95
+ * The number of completed scores in the Run so far.
96
+ */
97
+ numScores: number;
98
+
40
99
  /**
41
100
  * The status of the Run.
42
101
  */
@@ -50,14 +109,19 @@ export interface Run {
50
109
  | 'completed';
51
110
 
52
111
  /**
53
- * The ID of the Testset this Run is testing.
112
+ * The ID of the system this Run is using.
54
113
  */
55
- testsetId: string | null;
114
+ systemId: string | null;
56
115
 
57
116
  /**
58
117
  * The ID of the system version this Run is using.
59
118
  */
60
- systemVersionId?: string;
119
+ systemVersionId: string | null;
120
+
121
+ /**
122
+ * The ID of the Testset this Run is testing.
123
+ */
124
+ testsetId: string | null;
61
125
  }
62
126
 
63
127
  export interface RunCreateParams {
@@ -69,7 +133,7 @@ export interface RunCreateParams {
69
133
  /**
70
134
  * The ID of the system version this Run is using.
71
135
  */
72
- systemVersionId?: string;
136
+ systemVersionId?: string | null;
73
137
 
74
138
  /**
75
139
  * The ID of the Testset this Run is testing.
@@ -77,6 +141,13 @@ export interface RunCreateParams {
77
141
  testsetId?: string | null;
78
142
  }
79
143
 
144
+ export interface RunListParams extends PaginatedResponseParams {}
145
+
80
146
  export declare namespace Runs {
81
- export { type Run as Run, type RunCreateParams as RunCreateParams };
147
+ export {
148
+ type Run as Run,
149
+ type RunsPaginatedResponse as RunsPaginatedResponse,
150
+ type RunCreateParams as RunCreateParams,
151
+ type RunListParams as RunListParams,
152
+ };
82
153
  }
@@ -81,7 +81,7 @@ export namespace Score {
81
81
 
82
82
  export interface ScoreUpsertParams {
83
83
  /**
84
- * Path param: The ID of the Record.
84
+ * Path param: The ID of the Record to upsert the Score for.
85
85
  */
86
86
  recordId: string;
87
87
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.1.1'; // x-release-please-version
1
+ export const VERSION = '2.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.1.1";
1
+ export declare const VERSION = "2.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.1.1";
1
+ export declare const VERSION = "2.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.1.1'; // x-release-please-version
4
+ exports.VERSION = '2.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.1.1'; // x-release-please-version
1
+ export const VERSION = '2.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map