-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathevaluation-test-cases.ts
More file actions
334 lines (278 loc) · 8.01 KB
/
evaluation-test-cases.ts
File metadata and controls
334 lines (278 loc) · 8.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as EvaluationRunsAPI from './evaluation-runs';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class EvaluationTestCases extends APIResource {
/**
* To create an evaluation test-case send a POST request to
* `/v2/gen-ai/evaluation_test_cases`.
*
* @example
* ```ts
* const evaluationTestCase =
* await client.agents.evaluationTestCases.create();
* ```
*/
create(
body: EvaluationTestCaseCreateParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<EvaluationTestCaseCreateResponse> {
return this._client.post('/v2/gen-ai/evaluation_test_cases', {
body,
defaultBaseURL: 'https://api.digitalocean.com',
...options,
});
}
/**
* To retrive information about an existing evaluation test case, send a GET
* request to `/v2/gen-ai/evaluation_test_case/{test_case_uuid}`.
*
* @example
* ```ts
* const evaluationTestCase =
* await client.agents.evaluationTestCases.retrieve(
* '"123e4567-e89b-12d3-a456-426614174000"',
* );
* ```
*/
retrieve(
testCaseUuid: string,
query: EvaluationTestCaseRetrieveParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<EvaluationTestCaseRetrieveResponse> {
return this._client.get(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, {
query,
defaultBaseURL: 'https://api.digitalocean.com',
...options,
});
}
/**
* To update an evaluation test-case send a PUT request to
* `/v2/gen-ai/evaluation_test_cases/{test_case_uuid}`.
*
* @example
* ```ts
* const evaluationTestCase =
* await client.agents.evaluationTestCases.update(
* '"123e4567-e89b-12d3-a456-426614174000"',
* );
* ```
*/
update(
testCaseUuid: string,
body: EvaluationTestCaseUpdateParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<EvaluationTestCaseUpdateResponse> {
return this._client.put(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, {
body,
defaultBaseURL: 'https://api.digitalocean.com',
...options,
});
}
/**
* To list all evaluation test cases, send a GET request to
* `/v2/gen-ai/evaluation_test_cases`.
*
* @example
* ```ts
* const evaluationTestCases =
* await client.agents.evaluationTestCases.list();
* ```
*/
list(options?: RequestOptions): APIPromise<EvaluationTestCaseListResponse> {
return this._client.get('/v2/gen-ai/evaluation_test_cases', {
defaultBaseURL: 'https://api.digitalocean.com',
...options,
});
}
/**
* To list all evaluation runs by test case, send a GET request to
* `/v2/gen-ai/evaluation_test_cases/{evaluation_test_case_uuid}/evaluation_runs`.
*
* @example
* ```ts
* const response =
* await client.agents.evaluationTestCases.listEvaluationRuns(
* '"123e4567-e89b-12d3-a456-426614174000"',
* );
* ```
*/
listEvaluationRuns(
evaluationTestCaseUuid: string,
query: EvaluationTestCaseListEvaluationRunsParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<EvaluationTestCaseListEvaluationRunsResponse> {
return this._client.get(
path`/v2/gen-ai/evaluation_test_cases/${evaluationTestCaseUuid}/evaluation_runs`,
{ query, defaultBaseURL: 'https://api.digitalocean.com', ...options },
);
}
}
export interface APIEvaluationTestCase {
archived_at?: string;
created_at?: string;
created_by_user_email?: string;
created_by_user_id?: string;
dataset?: APIEvaluationTestCase.Dataset;
dataset_name?: string;
dataset_uuid?: string;
description?: string;
latest_version_number_of_runs?: number;
metrics?: Array<EvaluationRunsAPI.APIEvaluationMetric>;
name?: string;
star_metric?: APIStarMetric;
test_case_uuid?: string;
total_runs?: number;
updated_at?: string;
updated_by_user_email?: string;
updated_by_user_id?: string;
version?: number;
}
export namespace APIEvaluationTestCase {
export interface Dataset {
/**
* Time created at.
*/
created_at?: string;
/**
* Name of the dataset.
*/
dataset_name?: string;
/**
* UUID of the dataset.
*/
dataset_uuid?: string;
/**
* The size of the dataset uploaded file in bytes.
*/
file_size?: string;
/**
* Does the dataset have a ground truth column?
*/
has_ground_truth?: boolean;
/**
* Number of rows in the dataset.
*/
row_count?: number;
}
}
export interface APIStarMetric {
metric_uuid?: string;
name?: string;
/**
* The success threshold for the star metric. This is a value that the metric must
* reach to be considered successful.
*/
success_threshold?: number;
/**
* The success threshold for the star metric. This is a percentage value between 0
* and 100.
*/
success_threshold_pct?: number;
}
export interface EvaluationTestCaseCreateResponse {
/**
* Test‑case UUID.
*/
test_case_uuid?: string;
}
export interface EvaluationTestCaseRetrieveResponse {
evaluation_test_case?: APIEvaluationTestCase;
}
export interface EvaluationTestCaseUpdateResponse {
test_case_uuid?: string;
/**
* The new verson of the test case.
*/
version?: number;
}
export interface EvaluationTestCaseListResponse {
/**
* Alternative way of authentication for internal usage only - should not be
* exposed to public api
*/
evaluation_test_cases?: Array<APIEvaluationTestCase>;
}
export interface EvaluationTestCaseListEvaluationRunsResponse {
/**
* List of evaluation runs.
*/
evaluation_runs?: Array<EvaluationRunsAPI.APIEvaluationRun>;
}
export interface EvaluationTestCaseCreateParams {
/**
* Dataset against which the test‑case is executed.
*/
dataset_uuid?: string;
/**
* Description of the test case.
*/
description?: string;
/**
* Full metric list to use for evaluation test case.
*/
metrics?: Array<string>;
/**
* Name of the test case.
*/
name?: string;
star_metric?: APIStarMetric;
/**
* The workspace uuid.
*/
workspace_uuid?: string;
}
export interface EvaluationTestCaseRetrieveParams {
/**
* Version of the test case.
*/
evaluation_test_case_version?: number;
}
export interface EvaluationTestCaseUpdateParams {
/**
* Dataset against which the test‑case is executed.
*/
dataset_uuid?: string;
/**
* Description of the test case.
*/
description?: string;
metrics?: EvaluationTestCaseUpdateParams.Metrics;
/**
* Name of the test case.
*/
name?: string;
star_metric?: APIStarMetric;
/**
* Test-case UUID to update
*/
body_test_case_uuid?: string;
}
export namespace EvaluationTestCaseUpdateParams {
export interface Metrics {
metric_uuids?: Array<string>;
}
}
export interface EvaluationTestCaseListEvaluationRunsParams {
/**
* Version of the test case.
*/
evaluation_test_case_version?: number;
}
export declare namespace EvaluationTestCases {
export {
type APIEvaluationTestCase as APIEvaluationTestCase,
type APIStarMetric as APIStarMetric,
type EvaluationTestCaseCreateResponse as EvaluationTestCaseCreateResponse,
type EvaluationTestCaseRetrieveResponse as EvaluationTestCaseRetrieveResponse,
type EvaluationTestCaseUpdateResponse as EvaluationTestCaseUpdateResponse,
type EvaluationTestCaseListResponse as EvaluationTestCaseListResponse,
type EvaluationTestCaseListEvaluationRunsResponse as EvaluationTestCaseListEvaluationRunsResponse,
type EvaluationTestCaseCreateParams as EvaluationTestCaseCreateParams,
type EvaluationTestCaseRetrieveParams as EvaluationTestCaseRetrieveParams,
type EvaluationTestCaseUpdateParams as EvaluationTestCaseUpdateParams,
type EvaluationTestCaseListEvaluationRunsParams as EvaluationTestCaseListEvaluationRunsParams,
};
}