@inkeep/agents-sdk 0.65.2 → 0.66.1
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/evaluationClient.d.ts +1 -0
- package/dist/evaluationClient.js +131 -387
- package/package.json +2 -2
package/dist/evaluationClient.js
CHANGED
|
@@ -5,7 +5,6 @@ import { apiFetch, getLogger } from "@inkeep/agents-core";
|
|
|
5
5
|
* Client-side class for interacting with the Evaluations API
|
|
6
6
|
* These methods make HTTP requests to the server instead of direct database calls
|
|
7
7
|
*/
|
|
8
|
-
const logger = getLogger("evaluationClient");
|
|
9
8
|
function parseError(errorText) {
|
|
10
9
|
try {
|
|
11
10
|
const errorJson = JSON.parse(errorText);
|
|
@@ -22,11 +21,16 @@ var EvaluationClient = class {
|
|
|
22
21
|
projectId;
|
|
23
22
|
apiUrl;
|
|
24
23
|
apiKey;
|
|
24
|
+
logger;
|
|
25
25
|
constructor(config) {
|
|
26
26
|
this.tenantId = config.tenantId;
|
|
27
27
|
this.projectId = config.projectId;
|
|
28
28
|
this.apiUrl = config.apiUrl;
|
|
29
29
|
this.apiKey = config.apiKey;
|
|
30
|
+
this.logger = getLogger("EvalClient").with({
|
|
31
|
+
tenantId: config.tenantId,
|
|
32
|
+
projectId: config.projectId
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
buildUrl(...pathSegments) {
|
|
32
36
|
return `${this.apiUrl}/manage/tenants/${this.tenantId}/projects/${this.projectId}/evals/${pathSegments.join("/")}`;
|
|
@@ -37,10 +41,7 @@ var EvaluationClient = class {
|
|
|
37
41
|
return headers;
|
|
38
42
|
}
|
|
39
43
|
async listDatasets() {
|
|
40
|
-
logger.info(
|
|
41
|
-
tenantId: this.tenantId,
|
|
42
|
-
projectId: this.projectId
|
|
43
|
-
}, "Listing datasets via API");
|
|
44
|
+
this.logger.info("Listing datasets via API");
|
|
44
45
|
const url = this.buildUrl("datasets");
|
|
45
46
|
try {
|
|
46
47
|
const response = await apiFetch(url, {
|
|
@@ -49,7 +50,7 @@ var EvaluationClient = class {
|
|
|
49
50
|
});
|
|
50
51
|
if (!response.ok) {
|
|
51
52
|
const errorMessage = parseError(await response.text()) ?? `Failed to list datasets: ${response.status} ${response.statusText}`;
|
|
52
|
-
logger.error({
|
|
53
|
+
this.logger.error({
|
|
53
54
|
status: response.status,
|
|
54
55
|
error: errorMessage
|
|
55
56
|
}, "Failed to list datasets via API");
|
|
@@ -57,20 +58,12 @@ var EvaluationClient = class {
|
|
|
57
58
|
}
|
|
58
59
|
return (await response.json()).data;
|
|
59
60
|
} catch (error) {
|
|
60
|
-
logger.error({
|
|
61
|
-
error,
|
|
62
|
-
tenantId: this.tenantId,
|
|
63
|
-
projectId: this.projectId
|
|
64
|
-
}, "Failed to list datasets");
|
|
61
|
+
this.logger.error({ error }, "Failed to list datasets");
|
|
65
62
|
throw error;
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
async getDataset(datasetId) {
|
|
69
|
-
logger.info({
|
|
70
|
-
tenantId: this.tenantId,
|
|
71
|
-
projectId: this.projectId,
|
|
72
|
-
datasetId
|
|
73
|
-
}, "Getting dataset via API");
|
|
66
|
+
this.logger.info({ datasetId }, "Getting dataset via API");
|
|
74
67
|
const url = this.buildUrl("datasets", datasetId);
|
|
75
68
|
try {
|
|
76
69
|
const response = await apiFetch(url, {
|
|
@@ -79,11 +72,11 @@ var EvaluationClient = class {
|
|
|
79
72
|
});
|
|
80
73
|
if (!response.ok) {
|
|
81
74
|
if (response.status === 404) {
|
|
82
|
-
logger.info({ datasetId }, "Dataset not found");
|
|
75
|
+
this.logger.info({ datasetId }, "Dataset not found");
|
|
83
76
|
return null;
|
|
84
77
|
}
|
|
85
78
|
const errorMessage = parseError(await response.text()) ?? `Failed to get dataset: ${response.status} ${response.statusText}`;
|
|
86
|
-
logger.error({
|
|
79
|
+
this.logger.error({
|
|
87
80
|
status: response.status,
|
|
88
81
|
error: errorMessage
|
|
89
82
|
}, "Failed to get dataset via API");
|
|
@@ -91,20 +84,15 @@ var EvaluationClient = class {
|
|
|
91
84
|
}
|
|
92
85
|
return (await response.json()).data;
|
|
93
86
|
} catch (error) {
|
|
94
|
-
logger.error({
|
|
87
|
+
this.logger.error({
|
|
95
88
|
error,
|
|
96
|
-
tenantId: this.tenantId,
|
|
97
|
-
projectId: this.projectId,
|
|
98
89
|
datasetId
|
|
99
90
|
}, "Failed to get dataset");
|
|
100
91
|
throw error;
|
|
101
92
|
}
|
|
102
93
|
}
|
|
103
94
|
async createDataset(datasetData) {
|
|
104
|
-
logger.info(
|
|
105
|
-
tenantId: this.tenantId,
|
|
106
|
-
projectId: this.projectId
|
|
107
|
-
}, "Creating dataset via API");
|
|
95
|
+
this.logger.info("Creating dataset via API");
|
|
108
96
|
const url = this.buildUrl("datasets");
|
|
109
97
|
try {
|
|
110
98
|
const response = await apiFetch(url, {
|
|
@@ -114,33 +102,22 @@ var EvaluationClient = class {
|
|
|
114
102
|
});
|
|
115
103
|
if (!response.ok) {
|
|
116
104
|
const errorMessage = parseError(await response.text()) ?? `Failed to create dataset: ${response.status} ${response.statusText}`;
|
|
117
|
-
logger.error({
|
|
105
|
+
this.logger.error({
|
|
118
106
|
status: response.status,
|
|
119
107
|
error: errorMessage
|
|
120
108
|
}, "Failed to create dataset via API");
|
|
121
109
|
throw new Error(errorMessage);
|
|
122
110
|
}
|
|
123
111
|
const result = await response.json();
|
|
124
|
-
logger.info(
|
|
125
|
-
tenantId: this.tenantId,
|
|
126
|
-
projectId: this.projectId
|
|
127
|
-
}, "Successfully created dataset via API");
|
|
112
|
+
this.logger.info("Successfully created dataset via API");
|
|
128
113
|
return result.data;
|
|
129
114
|
} catch (error) {
|
|
130
|
-
logger.error({
|
|
131
|
-
error,
|
|
132
|
-
tenantId: this.tenantId,
|
|
133
|
-
projectId: this.projectId
|
|
134
|
-
}, "Failed to create dataset");
|
|
115
|
+
this.logger.error({ error }, "Failed to create dataset");
|
|
135
116
|
throw error;
|
|
136
117
|
}
|
|
137
118
|
}
|
|
138
119
|
async updateDataset(datasetId, updateData) {
|
|
139
|
-
logger.info({
|
|
140
|
-
tenantId: this.tenantId,
|
|
141
|
-
projectId: this.projectId,
|
|
142
|
-
datasetId
|
|
143
|
-
}, "Updating dataset via API");
|
|
120
|
+
this.logger.info({ datasetId }, "Updating dataset via API");
|
|
144
121
|
const url = this.buildUrl("datasets", datasetId);
|
|
145
122
|
try {
|
|
146
123
|
const response = await apiFetch(url, {
|
|
@@ -150,35 +127,25 @@ var EvaluationClient = class {
|
|
|
150
127
|
});
|
|
151
128
|
if (!response.ok) {
|
|
152
129
|
const errorMessage = parseError(await response.text()) ?? `Failed to update dataset: ${response.status} ${response.statusText}`;
|
|
153
|
-
logger.error({
|
|
130
|
+
this.logger.error({
|
|
154
131
|
status: response.status,
|
|
155
132
|
error: errorMessage
|
|
156
133
|
}, "Failed to update dataset via API");
|
|
157
134
|
throw new Error(errorMessage);
|
|
158
135
|
}
|
|
159
136
|
const result = await response.json();
|
|
160
|
-
logger.info({
|
|
161
|
-
tenantId: this.tenantId,
|
|
162
|
-
projectId: this.projectId,
|
|
163
|
-
datasetId
|
|
164
|
-
}, "Successfully updated dataset via API");
|
|
137
|
+
this.logger.info({ datasetId }, "Successfully updated dataset via API");
|
|
165
138
|
return result.data;
|
|
166
139
|
} catch (error) {
|
|
167
|
-
logger.error({
|
|
140
|
+
this.logger.error({
|
|
168
141
|
error,
|
|
169
|
-
tenantId: this.tenantId,
|
|
170
|
-
projectId: this.projectId,
|
|
171
142
|
datasetId
|
|
172
143
|
}, "Failed to update dataset");
|
|
173
144
|
throw error;
|
|
174
145
|
}
|
|
175
146
|
}
|
|
176
147
|
async deleteDataset(datasetId) {
|
|
177
|
-
logger.info({
|
|
178
|
-
tenantId: this.tenantId,
|
|
179
|
-
projectId: this.projectId,
|
|
180
|
-
datasetId
|
|
181
|
-
}, "Deleting dataset via API");
|
|
148
|
+
this.logger.info({ datasetId }, "Deleting dataset via API");
|
|
182
149
|
const url = this.buildUrl("datasets", datasetId);
|
|
183
150
|
try {
|
|
184
151
|
const response = await apiFetch(url, {
|
|
@@ -187,33 +154,23 @@ var EvaluationClient = class {
|
|
|
187
154
|
});
|
|
188
155
|
if (!response.ok) {
|
|
189
156
|
const errorMessage = parseError(await response.text()) ?? `Failed to delete dataset: ${response.status} ${response.statusText}`;
|
|
190
|
-
logger.error({
|
|
157
|
+
this.logger.error({
|
|
191
158
|
status: response.status,
|
|
192
159
|
error: errorMessage
|
|
193
160
|
}, "Failed to delete dataset via API");
|
|
194
161
|
throw new Error(errorMessage);
|
|
195
162
|
}
|
|
196
|
-
logger.info({
|
|
197
|
-
tenantId: this.tenantId,
|
|
198
|
-
projectId: this.projectId,
|
|
199
|
-
datasetId
|
|
200
|
-
}, "Successfully deleted dataset via API");
|
|
163
|
+
this.logger.info({ datasetId }, "Successfully deleted dataset via API");
|
|
201
164
|
} catch (error) {
|
|
202
|
-
logger.error({
|
|
165
|
+
this.logger.error({
|
|
203
166
|
error,
|
|
204
|
-
tenantId: this.tenantId,
|
|
205
|
-
projectId: this.projectId,
|
|
206
167
|
datasetId
|
|
207
168
|
}, "Failed to delete dataset");
|
|
208
169
|
throw error;
|
|
209
170
|
}
|
|
210
171
|
}
|
|
211
172
|
async listDatasetItems(datasetId) {
|
|
212
|
-
logger.info({
|
|
213
|
-
tenantId: this.tenantId,
|
|
214
|
-
projectId: this.projectId,
|
|
215
|
-
datasetId
|
|
216
|
-
}, "Listing dataset items via API");
|
|
173
|
+
this.logger.info({ datasetId }, "Listing dataset items via API");
|
|
217
174
|
const url = this.buildUrl("dataset-items", datasetId);
|
|
218
175
|
try {
|
|
219
176
|
const response = await apiFetch(url, {
|
|
@@ -222,7 +179,7 @@ var EvaluationClient = class {
|
|
|
222
179
|
});
|
|
223
180
|
if (!response.ok) {
|
|
224
181
|
const errorMessage = parseError(await response.text()) ?? `Failed to list dataset items: ${response.status} ${response.statusText}`;
|
|
225
|
-
logger.error({
|
|
182
|
+
this.logger.error({
|
|
226
183
|
status: response.status,
|
|
227
184
|
error: errorMessage
|
|
228
185
|
}, "Failed to list dataset items via API");
|
|
@@ -230,19 +187,15 @@ var EvaluationClient = class {
|
|
|
230
187
|
}
|
|
231
188
|
return (await response.json()).data;
|
|
232
189
|
} catch (error) {
|
|
233
|
-
logger.error({
|
|
190
|
+
this.logger.error({
|
|
234
191
|
error,
|
|
235
|
-
tenantId: this.tenantId,
|
|
236
|
-
projectId: this.projectId,
|
|
237
192
|
datasetId
|
|
238
193
|
}, "Failed to list dataset items");
|
|
239
194
|
throw error;
|
|
240
195
|
}
|
|
241
196
|
}
|
|
242
197
|
async getDatasetItem(datasetId, itemId) {
|
|
243
|
-
logger.info({
|
|
244
|
-
tenantId: this.tenantId,
|
|
245
|
-
projectId: this.projectId,
|
|
198
|
+
this.logger.info({
|
|
246
199
|
datasetId,
|
|
247
200
|
itemId
|
|
248
201
|
}, "Getting dataset item via API");
|
|
@@ -254,11 +207,11 @@ var EvaluationClient = class {
|
|
|
254
207
|
});
|
|
255
208
|
if (!response.ok) {
|
|
256
209
|
if (response.status === 404) {
|
|
257
|
-
logger.info({ itemId }, "Dataset item not found");
|
|
210
|
+
this.logger.info({ itemId }, "Dataset item not found");
|
|
258
211
|
return null;
|
|
259
212
|
}
|
|
260
213
|
const errorMessage = parseError(await response.text()) ?? `Failed to get dataset item: ${response.status} ${response.statusText}`;
|
|
261
|
-
logger.error({
|
|
214
|
+
this.logger.error({
|
|
262
215
|
status: response.status,
|
|
263
216
|
error: errorMessage
|
|
264
217
|
}, "Failed to get dataset item via API");
|
|
@@ -266,10 +219,8 @@ var EvaluationClient = class {
|
|
|
266
219
|
}
|
|
267
220
|
return (await response.json()).data;
|
|
268
221
|
} catch (error) {
|
|
269
|
-
logger.error({
|
|
222
|
+
this.logger.error({
|
|
270
223
|
error,
|
|
271
|
-
tenantId: this.tenantId,
|
|
272
|
-
projectId: this.projectId,
|
|
273
224
|
datasetId,
|
|
274
225
|
itemId
|
|
275
226
|
}, "Failed to get dataset item");
|
|
@@ -277,11 +228,7 @@ var EvaluationClient = class {
|
|
|
277
228
|
}
|
|
278
229
|
}
|
|
279
230
|
async createDatasetItem(datasetId, itemData) {
|
|
280
|
-
logger.info({
|
|
281
|
-
tenantId: this.tenantId,
|
|
282
|
-
projectId: this.projectId,
|
|
283
|
-
datasetId
|
|
284
|
-
}, "Creating dataset item via API");
|
|
231
|
+
this.logger.info({ datasetId }, "Creating dataset item via API");
|
|
285
232
|
const url = this.buildUrl("dataset-items", datasetId, "items");
|
|
286
233
|
try {
|
|
287
234
|
const response = await apiFetch(url, {
|
|
@@ -291,33 +238,25 @@ var EvaluationClient = class {
|
|
|
291
238
|
});
|
|
292
239
|
if (!response.ok) {
|
|
293
240
|
const errorMessage = parseError(await response.text()) ?? `Failed to create dataset item: ${response.status} ${response.statusText}`;
|
|
294
|
-
logger.error({
|
|
241
|
+
this.logger.error({
|
|
295
242
|
status: response.status,
|
|
296
243
|
error: errorMessage
|
|
297
244
|
}, "Failed to create dataset item via API");
|
|
298
245
|
throw new Error(errorMessage);
|
|
299
246
|
}
|
|
300
247
|
const result = await response.json();
|
|
301
|
-
logger.info({
|
|
302
|
-
tenantId: this.tenantId,
|
|
303
|
-
projectId: this.projectId,
|
|
304
|
-
datasetId
|
|
305
|
-
}, "Successfully created dataset item via API");
|
|
248
|
+
this.logger.info({ datasetId }, "Successfully created dataset item via API");
|
|
306
249
|
return result.data;
|
|
307
250
|
} catch (error) {
|
|
308
|
-
logger.error({
|
|
251
|
+
this.logger.error({
|
|
309
252
|
error,
|
|
310
|
-
tenantId: this.tenantId,
|
|
311
|
-
projectId: this.projectId,
|
|
312
253
|
datasetId
|
|
313
254
|
}, "Failed to create dataset item");
|
|
314
255
|
throw error;
|
|
315
256
|
}
|
|
316
257
|
}
|
|
317
258
|
async createDatasetItems(datasetId, itemsData) {
|
|
318
|
-
logger.info({
|
|
319
|
-
tenantId: this.tenantId,
|
|
320
|
-
projectId: this.projectId,
|
|
259
|
+
this.logger.info({
|
|
321
260
|
datasetId,
|
|
322
261
|
count: itemsData.length
|
|
323
262
|
}, "Creating dataset items via API");
|
|
@@ -330,34 +269,28 @@ var EvaluationClient = class {
|
|
|
330
269
|
});
|
|
331
270
|
if (!response.ok) {
|
|
332
271
|
const errorMessage = parseError(await response.text()) ?? `Failed to create dataset items: ${response.status} ${response.statusText}`;
|
|
333
|
-
logger.error({
|
|
272
|
+
this.logger.error({
|
|
334
273
|
status: response.status,
|
|
335
274
|
error: errorMessage
|
|
336
275
|
}, "Failed to create dataset items via API");
|
|
337
276
|
throw new Error(errorMessage);
|
|
338
277
|
}
|
|
339
278
|
const result = await response.json();
|
|
340
|
-
logger.info({
|
|
341
|
-
tenantId: this.tenantId,
|
|
342
|
-
projectId: this.projectId,
|
|
279
|
+
this.logger.info({
|
|
343
280
|
datasetId,
|
|
344
281
|
count: result.data.length
|
|
345
282
|
}, "Successfully created dataset items via API");
|
|
346
283
|
return result.data;
|
|
347
284
|
} catch (error) {
|
|
348
|
-
logger.error({
|
|
285
|
+
this.logger.error({
|
|
349
286
|
error,
|
|
350
|
-
tenantId: this.tenantId,
|
|
351
|
-
projectId: this.projectId,
|
|
352
287
|
datasetId
|
|
353
288
|
}, "Failed to create dataset items");
|
|
354
289
|
throw error;
|
|
355
290
|
}
|
|
356
291
|
}
|
|
357
292
|
async updateDatasetItem(datasetId, itemId, updateData) {
|
|
358
|
-
logger.info({
|
|
359
|
-
tenantId: this.tenantId,
|
|
360
|
-
projectId: this.projectId,
|
|
293
|
+
this.logger.info({
|
|
361
294
|
datasetId,
|
|
362
295
|
itemId
|
|
363
296
|
}, "Updating dataset item via API");
|
|
@@ -370,25 +303,21 @@ var EvaluationClient = class {
|
|
|
370
303
|
});
|
|
371
304
|
if (!response.ok) {
|
|
372
305
|
const errorMessage = parseError(await response.text()) ?? `Failed to update dataset item: ${response.status} ${response.statusText}`;
|
|
373
|
-
logger.error({
|
|
306
|
+
this.logger.error({
|
|
374
307
|
status: response.status,
|
|
375
308
|
error: errorMessage
|
|
376
309
|
}, "Failed to update dataset item via API");
|
|
377
310
|
throw new Error(errorMessage);
|
|
378
311
|
}
|
|
379
312
|
const result = await response.json();
|
|
380
|
-
logger.info({
|
|
381
|
-
tenantId: this.tenantId,
|
|
382
|
-
projectId: this.projectId,
|
|
313
|
+
this.logger.info({
|
|
383
314
|
datasetId,
|
|
384
315
|
itemId
|
|
385
316
|
}, "Successfully updated dataset item via API");
|
|
386
317
|
return result.data;
|
|
387
318
|
} catch (error) {
|
|
388
|
-
logger.error({
|
|
319
|
+
this.logger.error({
|
|
389
320
|
error,
|
|
390
|
-
tenantId: this.tenantId,
|
|
391
|
-
projectId: this.projectId,
|
|
392
321
|
datasetId,
|
|
393
322
|
itemId
|
|
394
323
|
}, "Failed to update dataset item");
|
|
@@ -396,9 +325,7 @@ var EvaluationClient = class {
|
|
|
396
325
|
}
|
|
397
326
|
}
|
|
398
327
|
async deleteDatasetItem(datasetId, itemId) {
|
|
399
|
-
logger.info({
|
|
400
|
-
tenantId: this.tenantId,
|
|
401
|
-
projectId: this.projectId,
|
|
328
|
+
this.logger.info({
|
|
402
329
|
datasetId,
|
|
403
330
|
itemId
|
|
404
331
|
}, "Deleting dataset item via API");
|
|
@@ -410,23 +337,19 @@ var EvaluationClient = class {
|
|
|
410
337
|
});
|
|
411
338
|
if (!response.ok) {
|
|
412
339
|
const errorMessage = parseError(await response.text()) ?? `Failed to delete dataset item: ${response.status} ${response.statusText}`;
|
|
413
|
-
logger.error({
|
|
340
|
+
this.logger.error({
|
|
414
341
|
status: response.status,
|
|
415
342
|
error: errorMessage
|
|
416
343
|
}, "Failed to delete dataset item via API");
|
|
417
344
|
throw new Error(errorMessage);
|
|
418
345
|
}
|
|
419
|
-
logger.info({
|
|
420
|
-
tenantId: this.tenantId,
|
|
421
|
-
projectId: this.projectId,
|
|
346
|
+
this.logger.info({
|
|
422
347
|
datasetId,
|
|
423
348
|
itemId
|
|
424
349
|
}, "Successfully deleted dataset item via API");
|
|
425
350
|
} catch (error) {
|
|
426
|
-
logger.error({
|
|
351
|
+
this.logger.error({
|
|
427
352
|
error,
|
|
428
|
-
tenantId: this.tenantId,
|
|
429
|
-
projectId: this.projectId,
|
|
430
353
|
datasetId,
|
|
431
354
|
itemId
|
|
432
355
|
}, "Failed to delete dataset item");
|
|
@@ -434,10 +357,7 @@ var EvaluationClient = class {
|
|
|
434
357
|
}
|
|
435
358
|
}
|
|
436
359
|
async listEvaluators() {
|
|
437
|
-
logger.info(
|
|
438
|
-
tenantId: this.tenantId,
|
|
439
|
-
projectId: this.projectId
|
|
440
|
-
}, "Listing evaluators via API");
|
|
360
|
+
this.logger.info("Listing evaluators via API");
|
|
441
361
|
const url = this.buildUrl("evaluators");
|
|
442
362
|
try {
|
|
443
363
|
const response = await apiFetch(url, {
|
|
@@ -446,7 +366,7 @@ var EvaluationClient = class {
|
|
|
446
366
|
});
|
|
447
367
|
if (!response.ok) {
|
|
448
368
|
const errorMessage = parseError(await response.text()) ?? `Failed to list evaluators: ${response.status} ${response.statusText}`;
|
|
449
|
-
logger.error({
|
|
369
|
+
this.logger.error({
|
|
450
370
|
status: response.status,
|
|
451
371
|
error: errorMessage
|
|
452
372
|
}, "Failed to list evaluators via API");
|
|
@@ -454,20 +374,12 @@ var EvaluationClient = class {
|
|
|
454
374
|
}
|
|
455
375
|
return (await response.json()).data;
|
|
456
376
|
} catch (error) {
|
|
457
|
-
logger.error({
|
|
458
|
-
error,
|
|
459
|
-
tenantId: this.tenantId,
|
|
460
|
-
projectId: this.projectId
|
|
461
|
-
}, "Failed to list evaluators");
|
|
377
|
+
this.logger.error({ error }, "Failed to list evaluators");
|
|
462
378
|
throw error;
|
|
463
379
|
}
|
|
464
380
|
}
|
|
465
381
|
async getEvaluator(evaluatorId) {
|
|
466
|
-
logger.info({
|
|
467
|
-
tenantId: this.tenantId,
|
|
468
|
-
projectId: this.projectId,
|
|
469
|
-
evaluatorId
|
|
470
|
-
}, "Getting evaluator via API");
|
|
382
|
+
this.logger.info({ evaluatorId }, "Getting evaluator via API");
|
|
471
383
|
const url = this.buildUrl("evaluators", evaluatorId);
|
|
472
384
|
try {
|
|
473
385
|
const response = await apiFetch(url, {
|
|
@@ -476,11 +388,11 @@ var EvaluationClient = class {
|
|
|
476
388
|
});
|
|
477
389
|
if (!response.ok) {
|
|
478
390
|
if (response.status === 404) {
|
|
479
|
-
logger.info({ evaluatorId }, "Evaluator not found");
|
|
391
|
+
this.logger.info({ evaluatorId }, "Evaluator not found");
|
|
480
392
|
return null;
|
|
481
393
|
}
|
|
482
394
|
const errorMessage = parseError(await response.text()) ?? `Failed to get evaluator: ${response.status} ${response.statusText}`;
|
|
483
|
-
logger.error({
|
|
395
|
+
this.logger.error({
|
|
484
396
|
status: response.status,
|
|
485
397
|
error: errorMessage
|
|
486
398
|
}, "Failed to get evaluator via API");
|
|
@@ -488,20 +400,15 @@ var EvaluationClient = class {
|
|
|
488
400
|
}
|
|
489
401
|
return (await response.json()).data;
|
|
490
402
|
} catch (error) {
|
|
491
|
-
logger.error({
|
|
403
|
+
this.logger.error({
|
|
492
404
|
error,
|
|
493
|
-
tenantId: this.tenantId,
|
|
494
|
-
projectId: this.projectId,
|
|
495
405
|
evaluatorId
|
|
496
406
|
}, "Failed to get evaluator");
|
|
497
407
|
throw error;
|
|
498
408
|
}
|
|
499
409
|
}
|
|
500
410
|
async createEvaluator(evaluatorData) {
|
|
501
|
-
logger.info(
|
|
502
|
-
tenantId: this.tenantId,
|
|
503
|
-
projectId: this.projectId
|
|
504
|
-
}, "Creating evaluator via API");
|
|
411
|
+
this.logger.info("Creating evaluator via API");
|
|
505
412
|
const url = this.buildUrl("evaluators");
|
|
506
413
|
try {
|
|
507
414
|
const response = await apiFetch(url, {
|
|
@@ -511,33 +418,22 @@ var EvaluationClient = class {
|
|
|
511
418
|
});
|
|
512
419
|
if (!response.ok) {
|
|
513
420
|
const errorMessage = parseError(await response.text()) ?? `Failed to create evaluator: ${response.status} ${response.statusText}`;
|
|
514
|
-
logger.error({
|
|
421
|
+
this.logger.error({
|
|
515
422
|
status: response.status,
|
|
516
423
|
error: errorMessage
|
|
517
424
|
}, "Failed to create evaluator via API");
|
|
518
425
|
throw new Error(errorMessage);
|
|
519
426
|
}
|
|
520
427
|
const result = await response.json();
|
|
521
|
-
logger.info(
|
|
522
|
-
tenantId: this.tenantId,
|
|
523
|
-
projectId: this.projectId
|
|
524
|
-
}, "Successfully created evaluator via API");
|
|
428
|
+
this.logger.info("Successfully created evaluator via API");
|
|
525
429
|
return result.data;
|
|
526
430
|
} catch (error) {
|
|
527
|
-
logger.error({
|
|
528
|
-
error,
|
|
529
|
-
tenantId: this.tenantId,
|
|
530
|
-
projectId: this.projectId
|
|
531
|
-
}, "Failed to create evaluator");
|
|
431
|
+
this.logger.error({ error }, "Failed to create evaluator");
|
|
532
432
|
throw error;
|
|
533
433
|
}
|
|
534
434
|
}
|
|
535
435
|
async updateEvaluator(evaluatorId, updateData) {
|
|
536
|
-
logger.info({
|
|
537
|
-
tenantId: this.tenantId,
|
|
538
|
-
projectId: this.projectId,
|
|
539
|
-
evaluatorId
|
|
540
|
-
}, "Updating evaluator via API");
|
|
436
|
+
this.logger.info({ evaluatorId }, "Updating evaluator via API");
|
|
541
437
|
const url = this.buildUrl("evaluators", evaluatorId);
|
|
542
438
|
try {
|
|
543
439
|
const response = await apiFetch(url, {
|
|
@@ -547,35 +443,25 @@ var EvaluationClient = class {
|
|
|
547
443
|
});
|
|
548
444
|
if (!response.ok) {
|
|
549
445
|
const errorMessage = parseError(await response.text()) ?? `Failed to update evaluator: ${response.status} ${response.statusText}`;
|
|
550
|
-
logger.error({
|
|
446
|
+
this.logger.error({
|
|
551
447
|
status: response.status,
|
|
552
448
|
error: errorMessage
|
|
553
449
|
}, "Failed to update evaluator via API");
|
|
554
450
|
throw new Error(errorMessage);
|
|
555
451
|
}
|
|
556
452
|
const result = await response.json();
|
|
557
|
-
logger.info({
|
|
558
|
-
tenantId: this.tenantId,
|
|
559
|
-
projectId: this.projectId,
|
|
560
|
-
evaluatorId
|
|
561
|
-
}, "Successfully updated evaluator via API");
|
|
453
|
+
this.logger.info({ evaluatorId }, "Successfully updated evaluator via API");
|
|
562
454
|
return result.data;
|
|
563
455
|
} catch (error) {
|
|
564
|
-
logger.error({
|
|
456
|
+
this.logger.error({
|
|
565
457
|
error,
|
|
566
|
-
tenantId: this.tenantId,
|
|
567
|
-
projectId: this.projectId,
|
|
568
458
|
evaluatorId
|
|
569
459
|
}, "Failed to update evaluator");
|
|
570
460
|
throw error;
|
|
571
461
|
}
|
|
572
462
|
}
|
|
573
463
|
async deleteEvaluator(evaluatorId) {
|
|
574
|
-
logger.info({
|
|
575
|
-
tenantId: this.tenantId,
|
|
576
|
-
projectId: this.projectId,
|
|
577
|
-
evaluatorId
|
|
578
|
-
}, "Deleting evaluator via API");
|
|
464
|
+
this.logger.info({ evaluatorId }, "Deleting evaluator via API");
|
|
579
465
|
const url = this.buildUrl("evaluators", evaluatorId);
|
|
580
466
|
try {
|
|
581
467
|
const response = await apiFetch(url, {
|
|
@@ -584,32 +470,23 @@ var EvaluationClient = class {
|
|
|
584
470
|
});
|
|
585
471
|
if (!response.ok) {
|
|
586
472
|
const errorMessage = parseError(await response.text()) ?? `Failed to delete evaluator: ${response.status} ${response.statusText}`;
|
|
587
|
-
logger.error({
|
|
473
|
+
this.logger.error({
|
|
588
474
|
status: response.status,
|
|
589
475
|
error: errorMessage
|
|
590
476
|
}, "Failed to delete evaluator via API");
|
|
591
477
|
throw new Error(errorMessage);
|
|
592
478
|
}
|
|
593
|
-
logger.info({
|
|
594
|
-
tenantId: this.tenantId,
|
|
595
|
-
projectId: this.projectId,
|
|
596
|
-
evaluatorId
|
|
597
|
-
}, "Successfully deleted evaluator via API");
|
|
479
|
+
this.logger.info({ evaluatorId }, "Successfully deleted evaluator via API");
|
|
598
480
|
} catch (error) {
|
|
599
|
-
logger.error({
|
|
481
|
+
this.logger.error({
|
|
600
482
|
error,
|
|
601
|
-
tenantId: this.tenantId,
|
|
602
|
-
projectId: this.projectId,
|
|
603
483
|
evaluatorId
|
|
604
484
|
}, "Failed to delete evaluator");
|
|
605
485
|
throw error;
|
|
606
486
|
}
|
|
607
487
|
}
|
|
608
488
|
async listEvaluationSuiteConfigs() {
|
|
609
|
-
logger.info(
|
|
610
|
-
tenantId: this.tenantId,
|
|
611
|
-
projectId: this.projectId
|
|
612
|
-
}, "Listing evaluation suite configs via API");
|
|
489
|
+
this.logger.info("Listing evaluation suite configs via API");
|
|
613
490
|
const url = this.buildUrl("evaluation-suite-configs");
|
|
614
491
|
try {
|
|
615
492
|
const response = await apiFetch(url, {
|
|
@@ -618,7 +495,7 @@ var EvaluationClient = class {
|
|
|
618
495
|
});
|
|
619
496
|
if (!response.ok) {
|
|
620
497
|
const errorMessage = parseError(await response.text()) ?? `Failed to list evaluation suite configs: ${response.status} ${response.statusText}`;
|
|
621
|
-
logger.error({
|
|
498
|
+
this.logger.error({
|
|
622
499
|
status: response.status,
|
|
623
500
|
error: errorMessage
|
|
624
501
|
}, "Failed to list evaluation suite configs via API");
|
|
@@ -626,20 +503,12 @@ var EvaluationClient = class {
|
|
|
626
503
|
}
|
|
627
504
|
return (await response.json()).data;
|
|
628
505
|
} catch (error) {
|
|
629
|
-
logger.error({
|
|
630
|
-
error,
|
|
631
|
-
tenantId: this.tenantId,
|
|
632
|
-
projectId: this.projectId
|
|
633
|
-
}, "Failed to list evaluation suite configs");
|
|
506
|
+
this.logger.error({ error }, "Failed to list evaluation suite configs");
|
|
634
507
|
throw error;
|
|
635
508
|
}
|
|
636
509
|
}
|
|
637
510
|
async getEvaluationSuiteConfig(configId) {
|
|
638
|
-
logger.info({
|
|
639
|
-
tenantId: this.tenantId,
|
|
640
|
-
projectId: this.projectId,
|
|
641
|
-
configId
|
|
642
|
-
}, "Getting evaluation suite config via API");
|
|
511
|
+
this.logger.info({ configId }, "Getting evaluation suite config via API");
|
|
643
512
|
const url = this.buildUrl("evaluation-suite-configs", configId);
|
|
644
513
|
try {
|
|
645
514
|
const response = await apiFetch(url, {
|
|
@@ -648,11 +517,11 @@ var EvaluationClient = class {
|
|
|
648
517
|
});
|
|
649
518
|
if (!response.ok) {
|
|
650
519
|
if (response.status === 404) {
|
|
651
|
-
logger.info({ configId }, "Evaluation suite config not found");
|
|
520
|
+
this.logger.info({ configId }, "Evaluation suite config not found");
|
|
652
521
|
return null;
|
|
653
522
|
}
|
|
654
523
|
const errorMessage = parseError(await response.text()) ?? `Failed to get evaluation suite config: ${response.status} ${response.statusText}`;
|
|
655
|
-
logger.error({
|
|
524
|
+
this.logger.error({
|
|
656
525
|
status: response.status,
|
|
657
526
|
error: errorMessage
|
|
658
527
|
}, "Failed to get evaluation suite config via API");
|
|
@@ -660,20 +529,15 @@ var EvaluationClient = class {
|
|
|
660
529
|
}
|
|
661
530
|
return (await response.json()).data;
|
|
662
531
|
} catch (error) {
|
|
663
|
-
logger.error({
|
|
532
|
+
this.logger.error({
|
|
664
533
|
error,
|
|
665
|
-
tenantId: this.tenantId,
|
|
666
|
-
projectId: this.projectId,
|
|
667
534
|
configId
|
|
668
535
|
}, "Failed to get evaluation suite config");
|
|
669
536
|
throw error;
|
|
670
537
|
}
|
|
671
538
|
}
|
|
672
539
|
async createEvaluationSuiteConfig(configData) {
|
|
673
|
-
logger.info(
|
|
674
|
-
tenantId: this.tenantId,
|
|
675
|
-
projectId: this.projectId
|
|
676
|
-
}, "Creating evaluation suite config via API");
|
|
540
|
+
this.logger.info("Creating evaluation suite config via API");
|
|
677
541
|
const url = this.buildUrl("evaluation-suite-configs");
|
|
678
542
|
try {
|
|
679
543
|
const response = await apiFetch(url, {
|
|
@@ -683,33 +547,22 @@ var EvaluationClient = class {
|
|
|
683
547
|
});
|
|
684
548
|
if (!response.ok) {
|
|
685
549
|
const errorMessage = parseError(await response.text()) ?? `Failed to create evaluation suite config: ${response.status} ${response.statusText}`;
|
|
686
|
-
logger.error({
|
|
550
|
+
this.logger.error({
|
|
687
551
|
status: response.status,
|
|
688
552
|
error: errorMessage
|
|
689
553
|
}, "Failed to create evaluation suite config via API");
|
|
690
554
|
throw new Error(errorMessage);
|
|
691
555
|
}
|
|
692
556
|
const result = await response.json();
|
|
693
|
-
logger.info(
|
|
694
|
-
tenantId: this.tenantId,
|
|
695
|
-
projectId: this.projectId
|
|
696
|
-
}, "Successfully created evaluation suite config via API");
|
|
557
|
+
this.logger.info("Successfully created evaluation suite config via API");
|
|
697
558
|
return result.data;
|
|
698
559
|
} catch (error) {
|
|
699
|
-
logger.error({
|
|
700
|
-
error,
|
|
701
|
-
tenantId: this.tenantId,
|
|
702
|
-
projectId: this.projectId
|
|
703
|
-
}, "Failed to create evaluation suite config");
|
|
560
|
+
this.logger.error({ error }, "Failed to create evaluation suite config");
|
|
704
561
|
throw error;
|
|
705
562
|
}
|
|
706
563
|
}
|
|
707
564
|
async updateEvaluationSuiteConfig(configId, updateData) {
|
|
708
|
-
logger.info({
|
|
709
|
-
tenantId: this.tenantId,
|
|
710
|
-
projectId: this.projectId,
|
|
711
|
-
configId
|
|
712
|
-
}, "Updating evaluation suite config via API");
|
|
565
|
+
this.logger.info({ configId }, "Updating evaluation suite config via API");
|
|
713
566
|
const url = this.buildUrl("evaluation-suite-configs", configId);
|
|
714
567
|
try {
|
|
715
568
|
const response = await apiFetch(url, {
|
|
@@ -719,35 +572,25 @@ var EvaluationClient = class {
|
|
|
719
572
|
});
|
|
720
573
|
if (!response.ok) {
|
|
721
574
|
const errorMessage = parseError(await response.text()) ?? `Failed to update evaluation suite config: ${response.status} ${response.statusText}`;
|
|
722
|
-
logger.error({
|
|
575
|
+
this.logger.error({
|
|
723
576
|
status: response.status,
|
|
724
577
|
error: errorMessage
|
|
725
578
|
}, "Failed to update evaluation suite config via API");
|
|
726
579
|
throw new Error(errorMessage);
|
|
727
580
|
}
|
|
728
581
|
const result = await response.json();
|
|
729
|
-
logger.info({
|
|
730
|
-
tenantId: this.tenantId,
|
|
731
|
-
projectId: this.projectId,
|
|
732
|
-
configId
|
|
733
|
-
}, "Successfully updated evaluation suite config via API");
|
|
582
|
+
this.logger.info({ configId }, "Successfully updated evaluation suite config via API");
|
|
734
583
|
return result.data;
|
|
735
584
|
} catch (error) {
|
|
736
|
-
logger.error({
|
|
585
|
+
this.logger.error({
|
|
737
586
|
error,
|
|
738
|
-
tenantId: this.tenantId,
|
|
739
|
-
projectId: this.projectId,
|
|
740
587
|
configId
|
|
741
588
|
}, "Failed to update evaluation suite config");
|
|
742
589
|
throw error;
|
|
743
590
|
}
|
|
744
591
|
}
|
|
745
592
|
async deleteEvaluationSuiteConfig(configId) {
|
|
746
|
-
logger.info({
|
|
747
|
-
tenantId: this.tenantId,
|
|
748
|
-
projectId: this.projectId,
|
|
749
|
-
configId
|
|
750
|
-
}, "Deleting evaluation suite config via API");
|
|
593
|
+
this.logger.info({ configId }, "Deleting evaluation suite config via API");
|
|
751
594
|
const url = this.buildUrl("evaluation-suite-configs", configId);
|
|
752
595
|
try {
|
|
753
596
|
const response = await apiFetch(url, {
|
|
@@ -756,33 +599,23 @@ var EvaluationClient = class {
|
|
|
756
599
|
});
|
|
757
600
|
if (!response.ok) {
|
|
758
601
|
const errorMessage = parseError(await response.text()) ?? `Failed to delete evaluation suite config: ${response.status} ${response.statusText}`;
|
|
759
|
-
logger.error({
|
|
602
|
+
this.logger.error({
|
|
760
603
|
status: response.status,
|
|
761
604
|
error: errorMessage
|
|
762
605
|
}, "Failed to delete evaluation suite config via API");
|
|
763
606
|
throw new Error(errorMessage);
|
|
764
607
|
}
|
|
765
|
-
logger.info({
|
|
766
|
-
tenantId: this.tenantId,
|
|
767
|
-
projectId: this.projectId,
|
|
768
|
-
configId
|
|
769
|
-
}, "Successfully deleted evaluation suite config via API");
|
|
608
|
+
this.logger.info({ configId }, "Successfully deleted evaluation suite config via API");
|
|
770
609
|
} catch (error) {
|
|
771
|
-
logger.error({
|
|
610
|
+
this.logger.error({
|
|
772
611
|
error,
|
|
773
|
-
tenantId: this.tenantId,
|
|
774
|
-
projectId: this.projectId,
|
|
775
612
|
configId
|
|
776
613
|
}, "Failed to delete evaluation suite config");
|
|
777
614
|
throw error;
|
|
778
615
|
}
|
|
779
616
|
}
|
|
780
617
|
async listEvaluationSuiteConfigEvaluators(configId) {
|
|
781
|
-
logger.info({
|
|
782
|
-
tenantId: this.tenantId,
|
|
783
|
-
projectId: this.projectId,
|
|
784
|
-
configId
|
|
785
|
-
}, "Listing evaluators for evaluation suite config via API");
|
|
618
|
+
this.logger.info({ configId }, "Listing evaluators for evaluation suite config via API");
|
|
786
619
|
const url = this.buildUrl("evaluation-suite-configs", configId, "evaluators");
|
|
787
620
|
try {
|
|
788
621
|
const response = await apiFetch(url, {
|
|
@@ -791,7 +624,7 @@ var EvaluationClient = class {
|
|
|
791
624
|
});
|
|
792
625
|
if (!response.ok) {
|
|
793
626
|
const errorMessage = parseError(await response.text()) ?? `Failed to list evaluators for evaluation suite config: ${response.status} ${response.statusText}`;
|
|
794
|
-
logger.error({
|
|
627
|
+
this.logger.error({
|
|
795
628
|
status: response.status,
|
|
796
629
|
error: errorMessage
|
|
797
630
|
}, "Failed to list evaluators for evaluation suite config via API");
|
|
@@ -799,19 +632,15 @@ var EvaluationClient = class {
|
|
|
799
632
|
}
|
|
800
633
|
return (await response.json()).data;
|
|
801
634
|
} catch (error) {
|
|
802
|
-
logger.error({
|
|
635
|
+
this.logger.error({
|
|
803
636
|
error,
|
|
804
|
-
tenantId: this.tenantId,
|
|
805
|
-
projectId: this.projectId,
|
|
806
637
|
configId
|
|
807
638
|
}, "Failed to list evaluators for evaluation suite config");
|
|
808
639
|
throw error;
|
|
809
640
|
}
|
|
810
641
|
}
|
|
811
642
|
async addEvaluatorToSuiteConfig(configId, evaluatorId) {
|
|
812
|
-
logger.info({
|
|
813
|
-
tenantId: this.tenantId,
|
|
814
|
-
projectId: this.projectId,
|
|
643
|
+
this.logger.info({
|
|
815
644
|
configId,
|
|
816
645
|
evaluatorId
|
|
817
646
|
}, "Adding evaluator to evaluation suite config via API");
|
|
@@ -823,25 +652,21 @@ var EvaluationClient = class {
|
|
|
823
652
|
});
|
|
824
653
|
if (!response.ok) {
|
|
825
654
|
const errorMessage = parseError(await response.text()) ?? `Failed to add evaluator to evaluation suite config: ${response.status} ${response.statusText}`;
|
|
826
|
-
logger.error({
|
|
655
|
+
this.logger.error({
|
|
827
656
|
status: response.status,
|
|
828
657
|
error: errorMessage
|
|
829
658
|
}, "Failed to add evaluator to evaluation suite config via API");
|
|
830
659
|
throw new Error(errorMessage);
|
|
831
660
|
}
|
|
832
661
|
const result = await response.json();
|
|
833
|
-
logger.info({
|
|
834
|
-
tenantId: this.tenantId,
|
|
835
|
-
projectId: this.projectId,
|
|
662
|
+
this.logger.info({
|
|
836
663
|
configId,
|
|
837
664
|
evaluatorId
|
|
838
665
|
}, "Successfully added evaluator to evaluation suite config via API");
|
|
839
666
|
return result.data;
|
|
840
667
|
} catch (error) {
|
|
841
|
-
logger.error({
|
|
668
|
+
this.logger.error({
|
|
842
669
|
error,
|
|
843
|
-
tenantId: this.tenantId,
|
|
844
|
-
projectId: this.projectId,
|
|
845
670
|
configId,
|
|
846
671
|
evaluatorId
|
|
847
672
|
}, "Failed to add evaluator to evaluation suite config");
|
|
@@ -849,9 +674,7 @@ var EvaluationClient = class {
|
|
|
849
674
|
}
|
|
850
675
|
}
|
|
851
676
|
async removeEvaluatorFromSuiteConfig(configId, evaluatorId) {
|
|
852
|
-
logger.info({
|
|
853
|
-
tenantId: this.tenantId,
|
|
854
|
-
projectId: this.projectId,
|
|
677
|
+
this.logger.info({
|
|
855
678
|
configId,
|
|
856
679
|
evaluatorId
|
|
857
680
|
}, "Removing evaluator from evaluation suite config via API");
|
|
@@ -863,23 +686,19 @@ var EvaluationClient = class {
|
|
|
863
686
|
});
|
|
864
687
|
if (!response.ok) {
|
|
865
688
|
const errorMessage = parseError(await response.text()) ?? `Failed to remove evaluator from evaluation suite config: ${response.status} ${response.statusText}`;
|
|
866
|
-
logger.error({
|
|
689
|
+
this.logger.error({
|
|
867
690
|
status: response.status,
|
|
868
691
|
error: errorMessage
|
|
869
692
|
}, "Failed to remove evaluator from evaluation suite config via API");
|
|
870
693
|
throw new Error(errorMessage);
|
|
871
694
|
}
|
|
872
|
-
logger.info({
|
|
873
|
-
tenantId: this.tenantId,
|
|
874
|
-
projectId: this.projectId,
|
|
695
|
+
this.logger.info({
|
|
875
696
|
configId,
|
|
876
697
|
evaluatorId
|
|
877
698
|
}, "Successfully removed evaluator from evaluation suite config via API");
|
|
878
699
|
} catch (error) {
|
|
879
|
-
logger.error({
|
|
700
|
+
this.logger.error({
|
|
880
701
|
error,
|
|
881
|
-
tenantId: this.tenantId,
|
|
882
|
-
projectId: this.projectId,
|
|
883
702
|
configId,
|
|
884
703
|
evaluatorId
|
|
885
704
|
}, "Failed to remove evaluator from evaluation suite config");
|
|
@@ -887,11 +706,7 @@ var EvaluationClient = class {
|
|
|
887
706
|
}
|
|
888
707
|
}
|
|
889
708
|
async getEvaluationResult(resultId) {
|
|
890
|
-
logger.info({
|
|
891
|
-
tenantId: this.tenantId,
|
|
892
|
-
projectId: this.projectId,
|
|
893
|
-
resultId
|
|
894
|
-
}, "Getting evaluation result via API");
|
|
709
|
+
this.logger.info({ resultId }, "Getting evaluation result via API");
|
|
895
710
|
const url = this.buildUrl("evaluation-results", resultId);
|
|
896
711
|
try {
|
|
897
712
|
const response = await apiFetch(url, {
|
|
@@ -900,11 +715,11 @@ var EvaluationClient = class {
|
|
|
900
715
|
});
|
|
901
716
|
if (!response.ok) {
|
|
902
717
|
if (response.status === 404) {
|
|
903
|
-
logger.info({ resultId }, "Evaluation result not found");
|
|
718
|
+
this.logger.info({ resultId }, "Evaluation result not found");
|
|
904
719
|
return null;
|
|
905
720
|
}
|
|
906
721
|
const errorMessage = parseError(await response.text()) ?? `Failed to get evaluation result: ${response.status} ${response.statusText}`;
|
|
907
|
-
logger.error({
|
|
722
|
+
this.logger.error({
|
|
908
723
|
status: response.status,
|
|
909
724
|
error: errorMessage
|
|
910
725
|
}, "Failed to get evaluation result via API");
|
|
@@ -912,20 +727,15 @@ var EvaluationClient = class {
|
|
|
912
727
|
}
|
|
913
728
|
return (await response.json()).data;
|
|
914
729
|
} catch (error) {
|
|
915
|
-
logger.error({
|
|
730
|
+
this.logger.error({
|
|
916
731
|
error,
|
|
917
|
-
tenantId: this.tenantId,
|
|
918
|
-
projectId: this.projectId,
|
|
919
732
|
resultId
|
|
920
733
|
}, "Failed to get evaluation result");
|
|
921
734
|
throw error;
|
|
922
735
|
}
|
|
923
736
|
}
|
|
924
737
|
async createEvaluationResult(resultData) {
|
|
925
|
-
logger.info(
|
|
926
|
-
tenantId: this.tenantId,
|
|
927
|
-
projectId: this.projectId
|
|
928
|
-
}, "Creating evaluation result via API");
|
|
738
|
+
this.logger.info("Creating evaluation result via API");
|
|
929
739
|
const url = this.buildUrl("evaluation-results");
|
|
930
740
|
try {
|
|
931
741
|
const response = await apiFetch(url, {
|
|
@@ -935,33 +745,22 @@ var EvaluationClient = class {
|
|
|
935
745
|
});
|
|
936
746
|
if (!response.ok) {
|
|
937
747
|
const errorMessage = parseError(await response.text()) ?? `Failed to create evaluation result: ${response.status} ${response.statusText}`;
|
|
938
|
-
logger.error({
|
|
748
|
+
this.logger.error({
|
|
939
749
|
status: response.status,
|
|
940
750
|
error: errorMessage
|
|
941
751
|
}, "Failed to create evaluation result via API");
|
|
942
752
|
throw new Error(errorMessage);
|
|
943
753
|
}
|
|
944
754
|
const result = await response.json();
|
|
945
|
-
logger.info(
|
|
946
|
-
tenantId: this.tenantId,
|
|
947
|
-
projectId: this.projectId
|
|
948
|
-
}, "Successfully created evaluation result via API");
|
|
755
|
+
this.logger.info("Successfully created evaluation result via API");
|
|
949
756
|
return result.data;
|
|
950
757
|
} catch (error) {
|
|
951
|
-
logger.error({
|
|
952
|
-
error,
|
|
953
|
-
tenantId: this.tenantId,
|
|
954
|
-
projectId: this.projectId
|
|
955
|
-
}, "Failed to create evaluation result");
|
|
758
|
+
this.logger.error({ error }, "Failed to create evaluation result");
|
|
956
759
|
throw error;
|
|
957
760
|
}
|
|
958
761
|
}
|
|
959
762
|
async updateEvaluationResult(resultId, updateData) {
|
|
960
|
-
logger.info({
|
|
961
|
-
tenantId: this.tenantId,
|
|
962
|
-
projectId: this.projectId,
|
|
963
|
-
resultId
|
|
964
|
-
}, "Updating evaluation result via API");
|
|
763
|
+
this.logger.info({ resultId }, "Updating evaluation result via API");
|
|
965
764
|
const url = this.buildUrl("evaluation-results", resultId);
|
|
966
765
|
try {
|
|
967
766
|
const response = await apiFetch(url, {
|
|
@@ -971,35 +770,25 @@ var EvaluationClient = class {
|
|
|
971
770
|
});
|
|
972
771
|
if (!response.ok) {
|
|
973
772
|
const errorMessage = parseError(await response.text()) ?? `Failed to update evaluation result: ${response.status} ${response.statusText}`;
|
|
974
|
-
logger.error({
|
|
773
|
+
this.logger.error({
|
|
975
774
|
status: response.status,
|
|
976
775
|
error: errorMessage
|
|
977
776
|
}, "Failed to update evaluation result via API");
|
|
978
777
|
throw new Error(errorMessage);
|
|
979
778
|
}
|
|
980
779
|
const result = await response.json();
|
|
981
|
-
logger.info({
|
|
982
|
-
tenantId: this.tenantId,
|
|
983
|
-
projectId: this.projectId,
|
|
984
|
-
resultId
|
|
985
|
-
}, "Successfully updated evaluation result via API");
|
|
780
|
+
this.logger.info({ resultId }, "Successfully updated evaluation result via API");
|
|
986
781
|
return result.data;
|
|
987
782
|
} catch (error) {
|
|
988
|
-
logger.error({
|
|
783
|
+
this.logger.error({
|
|
989
784
|
error,
|
|
990
|
-
tenantId: this.tenantId,
|
|
991
|
-
projectId: this.projectId,
|
|
992
785
|
resultId
|
|
993
786
|
}, "Failed to update evaluation result");
|
|
994
787
|
throw error;
|
|
995
788
|
}
|
|
996
789
|
}
|
|
997
790
|
async deleteEvaluationResult(resultId) {
|
|
998
|
-
logger.info({
|
|
999
|
-
tenantId: this.tenantId,
|
|
1000
|
-
projectId: this.projectId,
|
|
1001
|
-
resultId
|
|
1002
|
-
}, "Deleting evaluation result via API");
|
|
791
|
+
this.logger.info({ resultId }, "Deleting evaluation result via API");
|
|
1003
792
|
const url = this.buildUrl("evaluation-results", resultId);
|
|
1004
793
|
try {
|
|
1005
794
|
const response = await apiFetch(url, {
|
|
@@ -1008,22 +797,16 @@ var EvaluationClient = class {
|
|
|
1008
797
|
});
|
|
1009
798
|
if (!response.ok) {
|
|
1010
799
|
const errorMessage = parseError(await response.text()) ?? `Failed to delete evaluation result: ${response.status} ${response.statusText}`;
|
|
1011
|
-
logger.error({
|
|
800
|
+
this.logger.error({
|
|
1012
801
|
status: response.status,
|
|
1013
802
|
error: errorMessage
|
|
1014
803
|
}, "Failed to delete evaluation result via API");
|
|
1015
804
|
throw new Error(errorMessage);
|
|
1016
805
|
}
|
|
1017
|
-
logger.info({
|
|
1018
|
-
tenantId: this.tenantId,
|
|
1019
|
-
projectId: this.projectId,
|
|
1020
|
-
resultId
|
|
1021
|
-
}, "Successfully deleted evaluation result via API");
|
|
806
|
+
this.logger.info({ resultId }, "Successfully deleted evaluation result via API");
|
|
1022
807
|
} catch (error) {
|
|
1023
|
-
logger.error({
|
|
808
|
+
this.logger.error({
|
|
1024
809
|
error,
|
|
1025
|
-
tenantId: this.tenantId,
|
|
1026
|
-
projectId: this.projectId,
|
|
1027
810
|
resultId
|
|
1028
811
|
}, "Failed to delete evaluation result");
|
|
1029
812
|
throw error;
|
|
@@ -1038,9 +821,7 @@ var EvaluationClient = class {
|
|
|
1038
821
|
if (evaluationData.conversationIds?.length) jobFilters.conversationIds = evaluationData.conversationIds;
|
|
1039
822
|
if (evaluationData.dateRange) jobFilters.dateRange = evaluationData.dateRange;
|
|
1040
823
|
if (evaluationData.datasetRunIds?.length) jobFilters.datasetRunIds = evaluationData.datasetRunIds;
|
|
1041
|
-
logger.info({
|
|
1042
|
-
tenantId: this.tenantId,
|
|
1043
|
-
projectId: this.projectId,
|
|
824
|
+
this.logger.info({
|
|
1044
825
|
jobFilters,
|
|
1045
826
|
evaluatorIds: evaluationData.evaluatorIds
|
|
1046
827
|
}, "Triggering batch evaluation via API");
|
|
@@ -1057,38 +838,26 @@ var EvaluationClient = class {
|
|
|
1057
838
|
});
|
|
1058
839
|
if (!response.ok) {
|
|
1059
840
|
const errorMessage = parseError(await response.text()) ?? `Failed to trigger batch evaluation: ${response.status} ${response.statusText}`;
|
|
1060
|
-
logger.error({
|
|
841
|
+
this.logger.error({
|
|
1061
842
|
status: response.status,
|
|
1062
843
|
error: errorMessage
|
|
1063
844
|
}, "Failed to trigger batch evaluation via API");
|
|
1064
845
|
throw new Error(errorMessage);
|
|
1065
846
|
}
|
|
1066
847
|
const result = await response.json();
|
|
1067
|
-
logger.info({
|
|
1068
|
-
tenantId: this.tenantId,
|
|
1069
|
-
projectId: this.projectId,
|
|
1070
|
-
evaluationJobConfigId: result.data.id
|
|
1071
|
-
}, "Successfully triggered batch evaluation via API");
|
|
848
|
+
this.logger.info({ evaluationJobConfigId: result.data.id }, "Successfully triggered batch evaluation via API");
|
|
1072
849
|
return {
|
|
1073
850
|
message: "Batch evaluation triggered successfully",
|
|
1074
851
|
evaluationJobConfigId: result.data.id,
|
|
1075
852
|
evaluatorIds: evaluationData.evaluatorIds
|
|
1076
853
|
};
|
|
1077
854
|
} catch (error) {
|
|
1078
|
-
logger.error({
|
|
1079
|
-
error,
|
|
1080
|
-
tenantId: this.tenantId,
|
|
1081
|
-
projectId: this.projectId
|
|
1082
|
-
}, "Failed to trigger batch evaluation");
|
|
855
|
+
this.logger.error({ error }, "Failed to trigger batch evaluation");
|
|
1083
856
|
throw error;
|
|
1084
857
|
}
|
|
1085
858
|
}
|
|
1086
859
|
async createDatasetRunConfig(data) {
|
|
1087
|
-
logger.info({
|
|
1088
|
-
tenantId: this.tenantId,
|
|
1089
|
-
projectId: this.projectId,
|
|
1090
|
-
datasetId: data.datasetId
|
|
1091
|
-
}, "Creating dataset run config via API");
|
|
860
|
+
this.logger.info({ datasetId: data.datasetId }, "Creating dataset run config via API");
|
|
1092
861
|
const url = this.buildUrl("dataset-run-configs");
|
|
1093
862
|
try {
|
|
1094
863
|
const response = await apiFetch(url, {
|
|
@@ -1098,33 +867,22 @@ var EvaluationClient = class {
|
|
|
1098
867
|
});
|
|
1099
868
|
if (!response.ok) {
|
|
1100
869
|
const errorMessage = parseError(await response.text()) ?? `Failed to create dataset run config: ${response.status} ${response.statusText}`;
|
|
1101
|
-
logger.error({
|
|
870
|
+
this.logger.error({
|
|
1102
871
|
status: response.status,
|
|
1103
872
|
error: errorMessage
|
|
1104
873
|
}, "Failed to create dataset run config via API");
|
|
1105
874
|
throw new Error(errorMessage);
|
|
1106
875
|
}
|
|
1107
876
|
const result = await response.json();
|
|
1108
|
-
logger.info(
|
|
1109
|
-
tenantId: this.tenantId,
|
|
1110
|
-
projectId: this.projectId
|
|
1111
|
-
}, "Successfully created dataset run config via API");
|
|
877
|
+
this.logger.info("Successfully created dataset run config via API");
|
|
1112
878
|
return result.data;
|
|
1113
879
|
} catch (error) {
|
|
1114
|
-
logger.error({
|
|
1115
|
-
error,
|
|
1116
|
-
tenantId: this.tenantId,
|
|
1117
|
-
projectId: this.projectId
|
|
1118
|
-
}, "Failed to create dataset run config");
|
|
880
|
+
this.logger.error({ error }, "Failed to create dataset run config");
|
|
1119
881
|
throw error;
|
|
1120
882
|
}
|
|
1121
883
|
}
|
|
1122
884
|
async listDatasetRuns(datasetId) {
|
|
1123
|
-
logger.info({
|
|
1124
|
-
tenantId: this.tenantId,
|
|
1125
|
-
projectId: this.projectId,
|
|
1126
|
-
datasetId
|
|
1127
|
-
}, "Listing dataset runs via API");
|
|
885
|
+
this.logger.info({ datasetId }, "Listing dataset runs via API");
|
|
1128
886
|
const url = this.buildUrl("dataset-runs", "by-dataset", datasetId);
|
|
1129
887
|
try {
|
|
1130
888
|
const response = await apiFetch(url, {
|
|
@@ -1133,7 +891,7 @@ var EvaluationClient = class {
|
|
|
1133
891
|
});
|
|
1134
892
|
if (!response.ok) {
|
|
1135
893
|
const errorMessage = parseError(await response.text()) ?? `Failed to list dataset runs: ${response.status} ${response.statusText}`;
|
|
1136
|
-
logger.error({
|
|
894
|
+
this.logger.error({
|
|
1137
895
|
status: response.status,
|
|
1138
896
|
error: errorMessage
|
|
1139
897
|
}, "Failed to list dataset runs via API");
|
|
@@ -1141,21 +899,15 @@ var EvaluationClient = class {
|
|
|
1141
899
|
}
|
|
1142
900
|
return (await response.json()).data;
|
|
1143
901
|
} catch (error) {
|
|
1144
|
-
logger.error({
|
|
902
|
+
this.logger.error({
|
|
1145
903
|
error,
|
|
1146
|
-
tenantId: this.tenantId,
|
|
1147
|
-
projectId: this.projectId,
|
|
1148
904
|
datasetId
|
|
1149
905
|
}, "Failed to list dataset runs");
|
|
1150
906
|
throw error;
|
|
1151
907
|
}
|
|
1152
908
|
}
|
|
1153
909
|
async getDatasetRun(runId) {
|
|
1154
|
-
logger.info({
|
|
1155
|
-
tenantId: this.tenantId,
|
|
1156
|
-
projectId: this.projectId,
|
|
1157
|
-
runId
|
|
1158
|
-
}, "Getting dataset run via API");
|
|
910
|
+
this.logger.info({ runId }, "Getting dataset run via API");
|
|
1159
911
|
const url = this.buildUrl("dataset-runs", runId);
|
|
1160
912
|
try {
|
|
1161
913
|
const response = await apiFetch(url, {
|
|
@@ -1164,11 +916,11 @@ var EvaluationClient = class {
|
|
|
1164
916
|
});
|
|
1165
917
|
if (!response.ok) {
|
|
1166
918
|
if (response.status === 404) {
|
|
1167
|
-
logger.info({ runId }, "Dataset run not found");
|
|
919
|
+
this.logger.info({ runId }, "Dataset run not found");
|
|
1168
920
|
return null;
|
|
1169
921
|
}
|
|
1170
922
|
const errorMessage = parseError(await response.text()) ?? `Failed to get dataset run: ${response.status} ${response.statusText}`;
|
|
1171
|
-
logger.error({
|
|
923
|
+
this.logger.error({
|
|
1172
924
|
status: response.status,
|
|
1173
925
|
error: errorMessage
|
|
1174
926
|
}, "Failed to get dataset run via API");
|
|
@@ -1176,19 +928,15 @@ var EvaluationClient = class {
|
|
|
1176
928
|
}
|
|
1177
929
|
return (await response.json()).data;
|
|
1178
930
|
} catch (error) {
|
|
1179
|
-
logger.error({
|
|
931
|
+
this.logger.error({
|
|
1180
932
|
error,
|
|
1181
|
-
tenantId: this.tenantId,
|
|
1182
|
-
projectId: this.projectId,
|
|
1183
933
|
runId
|
|
1184
934
|
}, "Failed to get dataset run");
|
|
1185
935
|
throw error;
|
|
1186
936
|
}
|
|
1187
937
|
}
|
|
1188
938
|
async triggerDatasetRun(runConfigId, body) {
|
|
1189
|
-
logger.info({
|
|
1190
|
-
tenantId: this.tenantId,
|
|
1191
|
-
projectId: this.projectId,
|
|
939
|
+
this.logger.info({
|
|
1192
940
|
runConfigId,
|
|
1193
941
|
evaluatorIds: body?.evaluatorIds,
|
|
1194
942
|
branchName: body?.branchName
|
|
@@ -1202,25 +950,21 @@ var EvaluationClient = class {
|
|
|
1202
950
|
});
|
|
1203
951
|
if (!response.ok) {
|
|
1204
952
|
const errorMessage = parseError(await response.text()) ?? `Failed to trigger dataset run: ${response.status} ${response.statusText}`;
|
|
1205
|
-
logger.error({
|
|
953
|
+
this.logger.error({
|
|
1206
954
|
status: response.status,
|
|
1207
955
|
error: errorMessage
|
|
1208
956
|
}, "Failed to trigger dataset run via API");
|
|
1209
957
|
throw new Error(errorMessage);
|
|
1210
958
|
}
|
|
1211
959
|
const result = await response.json();
|
|
1212
|
-
logger.info({
|
|
1213
|
-
tenantId: this.tenantId,
|
|
1214
|
-
projectId: this.projectId,
|
|
960
|
+
this.logger.info({
|
|
1215
961
|
runConfigId,
|
|
1216
962
|
datasetRunId: result.datasetRunId
|
|
1217
963
|
}, "Successfully triggered dataset run via API");
|
|
1218
964
|
return result;
|
|
1219
965
|
} catch (error) {
|
|
1220
|
-
logger.error({
|
|
966
|
+
this.logger.error({
|
|
1221
967
|
error,
|
|
1222
|
-
tenantId: this.tenantId,
|
|
1223
|
-
projectId: this.projectId,
|
|
1224
968
|
runConfigId
|
|
1225
969
|
}, "Failed to trigger dataset run");
|
|
1226
970
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.1",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
17
17
|
"typescript": "^6.0.2",
|
|
18
18
|
"zod": "^4.3.6",
|
|
19
|
-
"@inkeep/agents-core": "^0.
|
|
19
|
+
"@inkeep/agents-core": "^0.66.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/js-yaml": "^4.0.9",
|