@iblai/data-layer 1.9.2 → 1.9.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/dist/index.d.ts +4734 -3
- package/dist/index.esm.js +389 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +423 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/evaluations/api-slice.d.ts +4314 -0
- package/dist/src/features/evaluations/constants.d.ts +102 -0
- package/dist/src/features/evaluations/types.d.ts +285 -0
- package/dist/src/features/mentor/privacy.d.ts +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { SERVICES } from '@data-layer/constants';
|
|
2
|
+
export declare const EVALUATIONS_REDUCER_PATH = "evaluationsApiSlice";
|
|
3
|
+
export declare const EVALUATIONS_ENDPOINTS: {
|
|
4
|
+
readonly GET_TASK: {
|
|
5
|
+
readonly service: SERVICES.AXD;
|
|
6
|
+
readonly path: (org: string, userId: string, taskId: string) => string;
|
|
7
|
+
};
|
|
8
|
+
readonly LIST_DATASETS: {
|
|
9
|
+
readonly service: SERVICES.AXD;
|
|
10
|
+
readonly path: (org: string, userId: string) => string;
|
|
11
|
+
};
|
|
12
|
+
readonly CREATE_DATASET: {
|
|
13
|
+
readonly service: SERVICES.AXD;
|
|
14
|
+
readonly path: (org: string, userId: string) => string;
|
|
15
|
+
};
|
|
16
|
+
readonly GET_DATASET: {
|
|
17
|
+
readonly service: SERVICES.AXD;
|
|
18
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
19
|
+
};
|
|
20
|
+
readonly LIST_DATASET_ITEMS: {
|
|
21
|
+
readonly service: SERVICES.AXD;
|
|
22
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
23
|
+
};
|
|
24
|
+
readonly ADD_DATASET_ITEMS: {
|
|
25
|
+
readonly service: SERVICES.AXD;
|
|
26
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
27
|
+
};
|
|
28
|
+
readonly UPLOAD_DATASET_CSV: {
|
|
29
|
+
readonly service: SERVICES.AXD;
|
|
30
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
31
|
+
};
|
|
32
|
+
readonly UPDATE_DATASET_ITEM: {
|
|
33
|
+
readonly service: SERVICES.AXD;
|
|
34
|
+
readonly path: (org: string, userId: string, datasetName: string, itemId: string) => string;
|
|
35
|
+
};
|
|
36
|
+
readonly DELETE_DATASET_ITEM: {
|
|
37
|
+
readonly service: SERVICES.AXD;
|
|
38
|
+
readonly path: (org: string, userId: string, datasetName: string, itemId: string) => string;
|
|
39
|
+
};
|
|
40
|
+
readonly LIST_RUNS: {
|
|
41
|
+
readonly service: SERVICES.AXD;
|
|
42
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
43
|
+
};
|
|
44
|
+
readonly START_RUN: {
|
|
45
|
+
readonly service: SERVICES.AXD;
|
|
46
|
+
readonly path: (org: string, userId: string, datasetName: string) => string;
|
|
47
|
+
};
|
|
48
|
+
readonly GET_RUN: {
|
|
49
|
+
readonly service: SERVICES.AXD;
|
|
50
|
+
readonly path: (org: string, userId: string, datasetName: string, runName: string) => string;
|
|
51
|
+
};
|
|
52
|
+
readonly EXPORT_RUN: {
|
|
53
|
+
readonly service: SERVICES.AXD;
|
|
54
|
+
readonly path: (org: string, userId: string, datasetName: string, runName: string) => string;
|
|
55
|
+
};
|
|
56
|
+
readonly DELETE_RUN: {
|
|
57
|
+
readonly service: SERVICES.AXD;
|
|
58
|
+
readonly path: (org: string, userId: string, datasetName: string, runName: string) => string;
|
|
59
|
+
};
|
|
60
|
+
readonly EVALUATE_RUN: {
|
|
61
|
+
readonly service: SERVICES.AXD;
|
|
62
|
+
readonly path: (org: string, userId: string, datasetName: string, runName: string) => string;
|
|
63
|
+
};
|
|
64
|
+
readonly LIST_RUN_JUDGES: {
|
|
65
|
+
readonly service: SERVICES.AXD;
|
|
66
|
+
readonly path: (org: string, userId: string, datasetName: string, runName: string) => string;
|
|
67
|
+
};
|
|
68
|
+
readonly LIST_JUDGES: {
|
|
69
|
+
readonly service: SERVICES.AXD;
|
|
70
|
+
readonly path: (org: string, userId: string) => string;
|
|
71
|
+
};
|
|
72
|
+
readonly LIST_SCORES: {
|
|
73
|
+
readonly service: SERVICES.AXD;
|
|
74
|
+
readonly path: (org: string, userId: string) => string;
|
|
75
|
+
};
|
|
76
|
+
readonly CREATE_SCORE: {
|
|
77
|
+
readonly service: SERVICES.AXD;
|
|
78
|
+
readonly path: (org: string, userId: string) => string;
|
|
79
|
+
};
|
|
80
|
+
readonly DELETE_SCORE: {
|
|
81
|
+
readonly service: SERVICES.AXD;
|
|
82
|
+
readonly path: (org: string, userId: string, scoreId: string) => string;
|
|
83
|
+
};
|
|
84
|
+
readonly LIST_SCORE_CONFIGS: {
|
|
85
|
+
readonly service: SERVICES.AXD;
|
|
86
|
+
readonly path: (org: string, userId: string) => string;
|
|
87
|
+
};
|
|
88
|
+
readonly CREATE_SCORE_CONFIG: {
|
|
89
|
+
readonly service: SERVICES.AXD;
|
|
90
|
+
readonly path: (org: string, userId: string) => string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export declare const EVALUATIONS_TAGS: {
|
|
94
|
+
readonly DATASETS: "EVAL_DATASETS";
|
|
95
|
+
readonly DATASET: "EVAL_DATASET";
|
|
96
|
+
readonly DATASET_ITEMS: "EVAL_DATASET_ITEMS";
|
|
97
|
+
readonly RUNS: "EVAL_RUNS";
|
|
98
|
+
readonly RUN: "EVAL_RUN";
|
|
99
|
+
readonly SCORES: "EVAL_SCORES";
|
|
100
|
+
readonly SCORE_CONFIGS: "EVAL_SCORE_CONFIGS";
|
|
101
|
+
readonly JUDGES: "EVAL_JUDGES";
|
|
102
|
+
};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
export type EvalScoreDataType = 'NUMERIC' | 'BOOLEAN' | 'CATEGORICAL';
|
|
2
|
+
export type EvalDatasetItemStatus = 'ACTIVE' | 'ARCHIVED';
|
|
3
|
+
/** Lifecycle status surfaced on runs and judge task records. */
|
|
4
|
+
export type EvalTaskStatusValue = 'pending' | 'in_progress' | 'completed' | 'failed' | (string & {});
|
|
5
|
+
/**
|
|
6
|
+
* Standard DRF page-number pagination envelope.
|
|
7
|
+
* `next` / `previous` are absolute URLs (or null at the boundaries).
|
|
8
|
+
*/
|
|
9
|
+
export interface EvalPaginatedResponse<T> {
|
|
10
|
+
count: number;
|
|
11
|
+
next: string | null;
|
|
12
|
+
previous: string | null;
|
|
13
|
+
results: T[];
|
|
14
|
+
}
|
|
15
|
+
/** Total page count derived from `count` and the requested page size. */
|
|
16
|
+
export declare function evalTotalPages(count: number | undefined, limit: number): number;
|
|
17
|
+
export interface EvalUserStamp {
|
|
18
|
+
username?: string;
|
|
19
|
+
user_email?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface EvalDataset extends EvalUserStamp {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
metadata: Record<string, unknown>;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}
|
|
28
|
+
/** Dataset item `input` may be a bare string or a structured object. */
|
|
29
|
+
export type EvalItemInput = string | Record<string, unknown>;
|
|
30
|
+
export interface EvalDatasetItem {
|
|
31
|
+
id: string;
|
|
32
|
+
input: EvalItemInput;
|
|
33
|
+
expected_output: string | null;
|
|
34
|
+
metadata: Record<string, unknown>;
|
|
35
|
+
status: EvalDatasetItemStatus;
|
|
36
|
+
source_trace_id: string | null;
|
|
37
|
+
source_observation_id: string | null;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
/** Present when `include_trace=true` and the item has a source trace. */
|
|
41
|
+
trace_input?: EvalItemInput | null;
|
|
42
|
+
trace_output?: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface EvalScore extends EvalUserStamp {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
value: number;
|
|
48
|
+
string_value: string | null;
|
|
49
|
+
data_type: EvalScoreDataType;
|
|
50
|
+
comment: string | null;
|
|
51
|
+
trace_id: string;
|
|
52
|
+
observation_id: string | null;
|
|
53
|
+
dataset_run_id: string | null;
|
|
54
|
+
created_at: string;
|
|
55
|
+
}
|
|
56
|
+
/** One (run, dataset_item) row, fully expanded on the run-detail endpoint. */
|
|
57
|
+
export interface EvalDatasetRunItem {
|
|
58
|
+
id: string;
|
|
59
|
+
dataset_item_id: string;
|
|
60
|
+
trace_id: string;
|
|
61
|
+
observation_id: string | null;
|
|
62
|
+
created_at: string;
|
|
63
|
+
input: EvalItemInput;
|
|
64
|
+
expected_output: EvalItemInput | null;
|
|
65
|
+
actual_output: EvalItemInput | null;
|
|
66
|
+
error: EvalItemInput | null;
|
|
67
|
+
scores: EvalScore[];
|
|
68
|
+
}
|
|
69
|
+
/** Judge task record (LLM-as-Judge job lifecycle). */
|
|
70
|
+
export interface EvalJudgeTask extends EvalUserStamp {
|
|
71
|
+
id: number;
|
|
72
|
+
dataset_name: string;
|
|
73
|
+
run_name: string;
|
|
74
|
+
score_name: string;
|
|
75
|
+
status: EvalTaskStatusValue;
|
|
76
|
+
task_id: string;
|
|
77
|
+
request_metadata: {
|
|
78
|
+
criteria?: string;
|
|
79
|
+
llm_provider?: string;
|
|
80
|
+
llm_name?: string;
|
|
81
|
+
max_concurrency?: number;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
error_message: string;
|
|
85
|
+
created_at: string;
|
|
86
|
+
started_at: string | null;
|
|
87
|
+
completed_at: string | null;
|
|
88
|
+
}
|
|
89
|
+
/** Run summary as returned by the runs list (merges pending + persisted). */
|
|
90
|
+
export interface EvalDatasetRun extends EvalUserStamp {
|
|
91
|
+
/** Empty string for a not-yet-persisted (pending/in_progress) run. */
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
metadata: Record<string, unknown>;
|
|
95
|
+
created_at: string;
|
|
96
|
+
updated_at: string;
|
|
97
|
+
status: EvalTaskStatusValue;
|
|
98
|
+
/** Present on pending/in-flight entries. */
|
|
99
|
+
task_id?: string;
|
|
100
|
+
task_record_id?: number;
|
|
101
|
+
}
|
|
102
|
+
/** Run detail: every item fully expanded plus in-flight judge records. */
|
|
103
|
+
export interface EvalDatasetRunDetail extends EvalDatasetRun {
|
|
104
|
+
dataset_run_items: EvalDatasetRunItem[];
|
|
105
|
+
pending_judges: EvalJudgeTask[];
|
|
106
|
+
}
|
|
107
|
+
export interface EvalScoreConfigCategory {
|
|
108
|
+
value: number;
|
|
109
|
+
label: string;
|
|
110
|
+
}
|
|
111
|
+
export interface EvalScoreConfig {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
data_type: EvalScoreDataType;
|
|
115
|
+
min_value: number | null;
|
|
116
|
+
max_value: number | null;
|
|
117
|
+
categories: EvalScoreConfigCategory[] | null;
|
|
118
|
+
description: string;
|
|
119
|
+
is_archived: boolean;
|
|
120
|
+
created_at: string;
|
|
121
|
+
}
|
|
122
|
+
export interface EvalPaginationParams {
|
|
123
|
+
page?: number;
|
|
124
|
+
limit?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface EvalTenantUserArgs {
|
|
127
|
+
org: string;
|
|
128
|
+
userId: string;
|
|
129
|
+
}
|
|
130
|
+
export interface ListDatasetsArgs extends EvalTenantUserArgs, EvalPaginationParams {
|
|
131
|
+
/** Case-insensitive substring match on the dataset name. */
|
|
132
|
+
name?: string;
|
|
133
|
+
/** Exact email match on the creator. */
|
|
134
|
+
user_email?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface CreateDatasetArgs extends EvalTenantUserArgs {
|
|
137
|
+
body: {
|
|
138
|
+
name: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
metadata?: Record<string, unknown>;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface DatasetNameArgs extends EvalTenantUserArgs {
|
|
144
|
+
datasetName: string;
|
|
145
|
+
}
|
|
146
|
+
export interface ListDatasetItemsArgs extends DatasetNameArgs, EvalPaginationParams {
|
|
147
|
+
/** Attach the linked trace's input/output to items with a source trace. */
|
|
148
|
+
include_trace?: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface AddDatasetItemsArgs extends DatasetNameArgs {
|
|
151
|
+
body: {
|
|
152
|
+
items: Array<{
|
|
153
|
+
input: string;
|
|
154
|
+
expected_output?: string | null;
|
|
155
|
+
}>;
|
|
156
|
+
} | {
|
|
157
|
+
trace_ids: string[];
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export interface UploadDatasetCsvArgs extends DatasetNameArgs {
|
|
161
|
+
formData: FormData;
|
|
162
|
+
}
|
|
163
|
+
export interface UpdateDatasetItemArgs extends DatasetNameArgs {
|
|
164
|
+
itemId: string;
|
|
165
|
+
body: Partial<{
|
|
166
|
+
input: string;
|
|
167
|
+
expected_output: string | null;
|
|
168
|
+
metadata: Record<string, unknown>;
|
|
169
|
+
status: EvalDatasetItemStatus;
|
|
170
|
+
}>;
|
|
171
|
+
}
|
|
172
|
+
export interface DeleteDatasetItemArgs extends DatasetNameArgs {
|
|
173
|
+
itemId: string;
|
|
174
|
+
}
|
|
175
|
+
export interface ListRunsArgs extends DatasetNameArgs, EvalPaginationParams {
|
|
176
|
+
/** Filter by the initiator's email. */
|
|
177
|
+
user_email?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface StartRunArgs extends DatasetNameArgs {
|
|
180
|
+
body: {
|
|
181
|
+
mentor_unique_id: string;
|
|
182
|
+
run_name?: string;
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export interface RunNameArgs extends DatasetNameArgs {
|
|
187
|
+
runName: string;
|
|
188
|
+
}
|
|
189
|
+
export interface EvaluateRunArgs extends RunNameArgs {
|
|
190
|
+
body: {
|
|
191
|
+
criteria: string;
|
|
192
|
+
score_name: string;
|
|
193
|
+
llm_provider?: string;
|
|
194
|
+
llm_name?: string;
|
|
195
|
+
max_concurrency?: number;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export interface ListRunJudgesArgs extends RunNameArgs, EvalPaginationParams {
|
|
199
|
+
status?: EvalTaskStatusValue;
|
|
200
|
+
user_email?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface ListJudgesArgs extends EvalTenantUserArgs, EvalPaginationParams {
|
|
203
|
+
status?: EvalTaskStatusValue;
|
|
204
|
+
user_email?: string;
|
|
205
|
+
dataset_name?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ListScoresArgs extends EvalTenantUserArgs, EvalPaginationParams {
|
|
208
|
+
dataset_run_id?: string;
|
|
209
|
+
trace_id?: string;
|
|
210
|
+
name?: string;
|
|
211
|
+
}
|
|
212
|
+
export interface CreateScoreArgs extends EvalTenantUserArgs {
|
|
213
|
+
/**
|
|
214
|
+
* Cache hint, not sent to the API: when set (with `runName`), the cached
|
|
215
|
+
* run detail is patched in place on success so the new score renders
|
|
216
|
+
* immediately — the eval store ingests scores asynchronously, so an
|
|
217
|
+
* immediate refetch would return the run without it.
|
|
218
|
+
*/
|
|
219
|
+
datasetName?: string;
|
|
220
|
+
/** Cache hint, see `datasetName`. */
|
|
221
|
+
runName?: string;
|
|
222
|
+
body: {
|
|
223
|
+
trace_id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
value: number;
|
|
226
|
+
data_type?: EvalScoreDataType;
|
|
227
|
+
comment?: string;
|
|
228
|
+
observation_id?: string;
|
|
229
|
+
config_id?: string;
|
|
230
|
+
dataset_run_id?: string;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export interface DeleteScoreArgs extends EvalTenantUserArgs {
|
|
234
|
+
scoreId: string;
|
|
235
|
+
/** Cache hint, see `CreateScoreArgs.datasetName`. */
|
|
236
|
+
datasetName?: string;
|
|
237
|
+
/** Cache hint, see `CreateScoreArgs.datasetName`. */
|
|
238
|
+
runName?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface ListScoreConfigsArgs extends EvalTenantUserArgs, EvalPaginationParams {
|
|
241
|
+
}
|
|
242
|
+
export interface CreateScoreConfigArgs extends EvalTenantUserArgs {
|
|
243
|
+
body: {
|
|
244
|
+
name: string;
|
|
245
|
+
data_type: EvalScoreDataType;
|
|
246
|
+
min_value?: number;
|
|
247
|
+
max_value?: number;
|
|
248
|
+
categories?: EvalScoreConfigCategory[];
|
|
249
|
+
description?: string;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/** 202 response when dispatching a run — a pending task record. */
|
|
253
|
+
export interface StartRunResponse extends EvalUserStamp {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
metadata: Record<string, unknown>;
|
|
257
|
+
created_at: string;
|
|
258
|
+
updated_at: string;
|
|
259
|
+
status: EvalTaskStatusValue;
|
|
260
|
+
task_id: string;
|
|
261
|
+
task_record_id: number;
|
|
262
|
+
}
|
|
263
|
+
/** 202 response when dispatching LLM-as-Judge — a pending judge record. */
|
|
264
|
+
export type EvaluateRunResponse = EvalJudgeTask;
|
|
265
|
+
export interface AddDatasetItemsResponse {
|
|
266
|
+
created: number;
|
|
267
|
+
items: EvalDatasetItem[];
|
|
268
|
+
}
|
|
269
|
+
export interface CreateScoreResponse extends EvalUserStamp {
|
|
270
|
+
status: string;
|
|
271
|
+
name: string;
|
|
272
|
+
value: number;
|
|
273
|
+
}
|
|
274
|
+
export interface GetTaskArgs extends EvalTenantUserArgs {
|
|
275
|
+
taskId: string;
|
|
276
|
+
}
|
|
277
|
+
export interface EvalTaskStatus {
|
|
278
|
+
task_id: string;
|
|
279
|
+
status: string;
|
|
280
|
+
result?: unknown;
|
|
281
|
+
error?: string | null;
|
|
282
|
+
date_done?: string | null;
|
|
283
|
+
traceback?: string | null;
|
|
284
|
+
[key: string]: unknown;
|
|
285
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `useGetMentorPublicSettingsQuery`) — this file just adds the typed
|
|
15
15
|
* surface for the new fields.
|
|
16
16
|
*/
|
|
17
|
-
export declare const PRIVACY_ACTIONS: readonly ["redact", "mask", "block"];
|
|
17
|
+
export declare const PRIVACY_ACTIONS: readonly ["allow", "redact", "mask", "block"];
|
|
18
18
|
export type PrivacyAction = (typeof PRIVACY_ACTIONS)[number];
|
|
19
19
|
export declare const PRIVACY_ENTITY_TYPES: readonly ["PERSON", "EMAIL_ADDRESS", "PHONE_NUMBER", "US_SSN", "CREDIT_CARD", "LOCATION", "DATE_TIME", "US_PASSPORT", "US_DRIVER_LICENSE", "IP_ADDRESS", "IBAN_CODE", "MEDICAL_LICENSE", "US_BANK_NUMBER"];
|
|
20
20
|
export type PrivacyEntityType = (typeof PRIVACY_ENTITY_TYPES)[number];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -112,6 +112,9 @@ export * from './features/workflows/constants';
|
|
|
112
112
|
export * from './features/audit-logs/api-slice';
|
|
113
113
|
export * from './features/audit-logs/constants';
|
|
114
114
|
export * from './features/audit-logs/types';
|
|
115
|
+
export * from './features/evaluations/api-slice';
|
|
116
|
+
export * from './features/evaluations/constants';
|
|
117
|
+
export * from './features/evaluations/types';
|
|
115
118
|
export * from './features/watched-groups/api-slice';
|
|
116
119
|
export * from './features/watched-groups/constants';
|
|
117
120
|
export * from './features/watched-groups/types';
|