@eigenpal/sdk 0.8.0 → 0.9.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/CHANGELOG.md +10 -0
- package/package.json +2 -2
- package/src/generated/index.ts +2 -2
- package/src/generated/sdk.gen.ts +354 -63
- package/src/generated/types.gen.ts +2467 -622
- package/src/index.ts +4 -0
- package/src/lib/files.ts +9 -0
- package/src/resources/automations.ts +58 -0
- package/src/resources/runs.ts +108 -7
- package/src/telemetry.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -68,6 +68,10 @@ export type {
|
|
|
68
68
|
RunUsageResponse,
|
|
69
69
|
RunsCancelResponse,
|
|
70
70
|
RunsFeedbackClearResponse,
|
|
71
|
+
RunsFeedbackExpectedCreateResponse,
|
|
72
|
+
RunsFeedbackExpectedFileDeleteResponse,
|
|
73
|
+
RunsFeedbackExpectedFileUpdateResponse,
|
|
74
|
+
RunsFeedbackExpectedGetResponse,
|
|
71
75
|
RunsFeedbackGetResponse,
|
|
72
76
|
RunsFeedbackUpdateResponse,
|
|
73
77
|
RunsGetResponse,
|
package/src/lib/files.ts
CHANGED
|
@@ -237,3 +237,12 @@ export async function buildRunMultipart(args: {
|
|
|
237
237
|
}
|
|
238
238
|
return { formData: fd, fileCount };
|
|
239
239
|
}
|
|
240
|
+
|
|
241
|
+
/** Build multipart for endpoints that accept one file field plus optional name. */
|
|
242
|
+
export async function buildSingleFileMultipart(file: FileInput, name?: string): Promise<FormData> {
|
|
243
|
+
const fd = new FormData();
|
|
244
|
+
const { blob, filename } = await resolveFileBlob(file);
|
|
245
|
+
fd.append('file', blob, filename);
|
|
246
|
+
if (name) fd.append('name', name);
|
|
247
|
+
return fd;
|
|
248
|
+
}
|
|
@@ -13,10 +13,14 @@ import {
|
|
|
13
13
|
automationsExamplesUpdate,
|
|
14
14
|
automationsExperimentsCancel,
|
|
15
15
|
automationsExperimentsCreate,
|
|
16
|
+
automationsExperimentsCreateStream,
|
|
17
|
+
automationsExperimentsExport,
|
|
18
|
+
automationsExperimentsExportAll,
|
|
16
19
|
automationsExperimentsGet,
|
|
17
20
|
automationsExperimentsList,
|
|
18
21
|
automationsGet,
|
|
19
22
|
automationsList,
|
|
23
|
+
automationsSync,
|
|
20
24
|
automationsTriggersGet,
|
|
21
25
|
automationsVersionsList,
|
|
22
26
|
} from '../generated/sdk.gen';
|
|
@@ -71,6 +75,12 @@ export class AutomationsResource {
|
|
|
71
75
|
automationsTriggersGet({ client: this.client, path: { id }, signal: options.signal })
|
|
72
76
|
);
|
|
73
77
|
}
|
|
78
|
+
|
|
79
|
+
async sync(id: string, options: SignalOptions = {}): Promise<AnyResponse> {
|
|
80
|
+
return this.dispatch(() =>
|
|
81
|
+
automationsSync({ client: this.client, path: { id }, signal: options.signal })
|
|
82
|
+
);
|
|
83
|
+
}
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
export class AutomationDatasetResource {
|
|
@@ -296,4 +306,52 @@ export class AutomationExperimentsResource {
|
|
|
296
306
|
})
|
|
297
307
|
);
|
|
298
308
|
}
|
|
309
|
+
|
|
310
|
+
async export(
|
|
311
|
+
automationId: string,
|
|
312
|
+
experimentId: string,
|
|
313
|
+
options: { format?: 'csv' | 'json'; signal?: AbortSignal } = {}
|
|
314
|
+
): Promise<string> {
|
|
315
|
+
return this.dispatch(() =>
|
|
316
|
+
automationsExperimentsExport({
|
|
317
|
+
client: this.client,
|
|
318
|
+
path: { id: automationId, experimentId },
|
|
319
|
+
query: { format: options.format ?? 'csv' },
|
|
320
|
+
parseAs: 'text',
|
|
321
|
+
signal: options.signal,
|
|
322
|
+
})
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
async exportAll(
|
|
327
|
+
automationId: string,
|
|
328
|
+
options: { format?: 'csv' | 'json'; signal?: AbortSignal } = {}
|
|
329
|
+
): Promise<string> {
|
|
330
|
+
return this.dispatch(() =>
|
|
331
|
+
automationsExperimentsExportAll({
|
|
332
|
+
client: this.client,
|
|
333
|
+
path: { id: automationId },
|
|
334
|
+
query: { format: options.format ?? 'csv' },
|
|
335
|
+
parseAs: 'text',
|
|
336
|
+
signal: options.signal,
|
|
337
|
+
})
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
async createStream(
|
|
342
|
+
automationId: string,
|
|
343
|
+
body: Record<string, unknown> = {},
|
|
344
|
+
options: SignalOptions = {}
|
|
345
|
+
): Promise<ReadableStream<Uint8Array> | null> {
|
|
346
|
+
return this.dispatch(
|
|
347
|
+
() =>
|
|
348
|
+
automationsExperimentsCreateStream({
|
|
349
|
+
client: this.client,
|
|
350
|
+
path: { id: automationId },
|
|
351
|
+
body: body as never,
|
|
352
|
+
parseAs: 'stream',
|
|
353
|
+
signal: options.signal,
|
|
354
|
+
}) as Promise<OperationResult<ReadableStream<Uint8Array> | null>>
|
|
355
|
+
);
|
|
356
|
+
}
|
|
299
357
|
}
|
package/src/resources/runs.ts
CHANGED
|
@@ -4,15 +4,20 @@ import {
|
|
|
4
4
|
runsArtifactsGet,
|
|
5
5
|
runsArtifactsList,
|
|
6
6
|
runsCancel,
|
|
7
|
-
runsEvalResultsList,
|
|
8
7
|
runsEventsList,
|
|
9
8
|
runsFeedbackClear,
|
|
9
|
+
runsFeedbackExpectedCreate,
|
|
10
|
+
runsFeedbackExpectedFileDelete,
|
|
11
|
+
runsFeedbackExpectedFileGet,
|
|
12
|
+
runsFeedbackExpectedFileUpdate,
|
|
13
|
+
runsFeedbackExpectedGet,
|
|
10
14
|
runsFeedbackGet,
|
|
11
15
|
runsFeedbackUpdate,
|
|
12
16
|
runsGet,
|
|
13
17
|
runsList,
|
|
14
18
|
runsPromote,
|
|
15
19
|
runsRerun,
|
|
20
|
+
runsScoresList,
|
|
16
21
|
runsStepsList,
|
|
17
22
|
runsTraceGet,
|
|
18
23
|
runsUsageGet,
|
|
@@ -20,9 +25,12 @@ import {
|
|
|
20
25
|
import type {
|
|
21
26
|
RunsArtifactsListResponse,
|
|
22
27
|
RunsCancelResponse,
|
|
23
|
-
RunsEvalResultsListResponse,
|
|
24
28
|
RunsEventsListResponse,
|
|
25
29
|
RunsFeedbackClearResponse,
|
|
30
|
+
RunsFeedbackExpectedCreateResponse,
|
|
31
|
+
RunsFeedbackExpectedFileDeleteResponse,
|
|
32
|
+
RunsFeedbackExpectedFileUpdateResponse,
|
|
33
|
+
RunsFeedbackExpectedGetResponse,
|
|
26
34
|
RunsFeedbackGetResponse,
|
|
27
35
|
RunsFeedbackUpdateResponse,
|
|
28
36
|
RunsGetResponse,
|
|
@@ -30,10 +38,12 @@ import type {
|
|
|
30
38
|
RunsListResponse,
|
|
31
39
|
RunsPromoteResponse,
|
|
32
40
|
RunsRerunResponse,
|
|
41
|
+
RunsScoresListResponse,
|
|
33
42
|
RunsStepsListResponse,
|
|
34
43
|
RunsTraceGetResponse,
|
|
35
44
|
RunsUsageGetResponse,
|
|
36
45
|
} from '../generated/types.gen';
|
|
46
|
+
import { buildSingleFileMultipart, type FileInput } from '../lib/files';
|
|
37
47
|
|
|
38
48
|
type Dispatch = <T>(call: () => Promise<OperationResult<T>>) => Promise<T>;
|
|
39
49
|
type SignalOptions = { signal?: AbortSignal };
|
|
@@ -51,7 +61,7 @@ function formatExpand(expand: RunExpand | undefined): string | undefined {
|
|
|
51
61
|
|
|
52
62
|
export class RunsResource {
|
|
53
63
|
public readonly artifacts: RunsArtifactsResource;
|
|
54
|
-
public readonly
|
|
64
|
+
public readonly scores: RunsScoresResource;
|
|
55
65
|
public readonly feedback: RunsFeedbackResource;
|
|
56
66
|
public readonly trace: RunsTraceResource;
|
|
57
67
|
|
|
@@ -60,7 +70,7 @@ export class RunsResource {
|
|
|
60
70
|
private readonly dispatch: Dispatch
|
|
61
71
|
) {
|
|
62
72
|
this.artifacts = new RunsArtifactsResource(client, dispatch);
|
|
63
|
-
this.
|
|
73
|
+
this.scores = new RunsScoresResource(client, dispatch);
|
|
64
74
|
this.feedback = new RunsFeedbackResource(client, dispatch);
|
|
65
75
|
this.trace = new RunsTraceResource(client, dispatch);
|
|
66
76
|
}
|
|
@@ -203,17 +213,108 @@ export class RunsFeedbackResource {
|
|
|
203
213
|
runsFeedbackClear({ client: this.client, path: { id: runId }, signal: options.signal })
|
|
204
214
|
);
|
|
205
215
|
}
|
|
216
|
+
|
|
217
|
+
async listExpected(
|
|
218
|
+
runId: string,
|
|
219
|
+
options: SignalOptions = {}
|
|
220
|
+
): Promise<RunsFeedbackExpectedGetResponse> {
|
|
221
|
+
return this.dispatch(() =>
|
|
222
|
+
runsFeedbackExpectedGet({ client: this.client, path: { id: runId }, signal: options.signal })
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async copyOutputToExpected(
|
|
227
|
+
runId: string,
|
|
228
|
+
outputFileName: string,
|
|
229
|
+
options: { expectedName?: string; signal?: AbortSignal } = {}
|
|
230
|
+
): Promise<RunsFeedbackExpectedCreateResponse> {
|
|
231
|
+
return this.dispatch(() =>
|
|
232
|
+
runsFeedbackExpectedCreate({
|
|
233
|
+
client: this.client,
|
|
234
|
+
path: { id: runId },
|
|
235
|
+
body: {
|
|
236
|
+
outputFileName,
|
|
237
|
+
...(options.expectedName ? { expectedName: options.expectedName } : {}),
|
|
238
|
+
},
|
|
239
|
+
signal: options.signal,
|
|
240
|
+
})
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async uploadExpected(
|
|
245
|
+
runId: string,
|
|
246
|
+
file: FileInput,
|
|
247
|
+
options: { name?: string; signal?: AbortSignal } = {}
|
|
248
|
+
): Promise<RunsFeedbackExpectedCreateResponse> {
|
|
249
|
+
const formData = await buildSingleFileMultipart(file, options.name);
|
|
250
|
+
return this.dispatch(
|
|
251
|
+
() =>
|
|
252
|
+
this.client.post({
|
|
253
|
+
url: '/api/v1/runs/{id}/feedback/expected',
|
|
254
|
+
path: { id: runId },
|
|
255
|
+
body: formData,
|
|
256
|
+
bodySerializer: null,
|
|
257
|
+
headers: { 'Content-Type': null },
|
|
258
|
+
signal: options.signal,
|
|
259
|
+
}) as Promise<OperationResult<RunsFeedbackExpectedCreateResponse>>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async downloadExpected(
|
|
264
|
+
runId: string,
|
|
265
|
+
filename: string,
|
|
266
|
+
options: SignalOptions = {}
|
|
267
|
+
): Promise<Blob> {
|
|
268
|
+
return this.dispatch(async () => {
|
|
269
|
+
const response = await runsFeedbackExpectedFileGet({
|
|
270
|
+
client: this.client,
|
|
271
|
+
path: { id: runId, filename },
|
|
272
|
+
signal: options.signal,
|
|
273
|
+
});
|
|
274
|
+
return response as OperationResult<Blob>;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async renameExpected(
|
|
279
|
+
runId: string,
|
|
280
|
+
filename: string,
|
|
281
|
+
newFilename: string,
|
|
282
|
+
options: SignalOptions = {}
|
|
283
|
+
): Promise<RunsFeedbackExpectedFileUpdateResponse> {
|
|
284
|
+
return this.dispatch(() =>
|
|
285
|
+
runsFeedbackExpectedFileUpdate({
|
|
286
|
+
client: this.client,
|
|
287
|
+
path: { id: runId, filename },
|
|
288
|
+
body: { name: newFilename },
|
|
289
|
+
signal: options.signal,
|
|
290
|
+
})
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async deleteExpected(
|
|
295
|
+
runId: string,
|
|
296
|
+
filename: string,
|
|
297
|
+
options: SignalOptions = {}
|
|
298
|
+
): Promise<RunsFeedbackExpectedFileDeleteResponse> {
|
|
299
|
+
return this.dispatch(() =>
|
|
300
|
+
runsFeedbackExpectedFileDelete({
|
|
301
|
+
client: this.client,
|
|
302
|
+
path: { id: runId, filename },
|
|
303
|
+
signal: options.signal,
|
|
304
|
+
})
|
|
305
|
+
);
|
|
306
|
+
}
|
|
206
307
|
}
|
|
207
308
|
|
|
208
|
-
export class
|
|
309
|
+
export class RunsScoresResource {
|
|
209
310
|
constructor(
|
|
210
311
|
private readonly client: Client,
|
|
211
312
|
private readonly dispatch: Dispatch
|
|
212
313
|
) {}
|
|
213
314
|
|
|
214
|
-
async list(runId: string, options: SignalOptions = {}): Promise<
|
|
315
|
+
async list(runId: string, options: SignalOptions = {}): Promise<RunsScoresListResponse> {
|
|
215
316
|
return this.dispatch(() =>
|
|
216
|
-
|
|
317
|
+
runsScoresList({ client: this.client, path: { id: runId }, signal: options.signal })
|
|
217
318
|
);
|
|
218
319
|
}
|
|
219
320
|
}
|
package/src/telemetry.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export const SDK_LANGUAGE = 'typescript';
|
|
20
20
|
// Rewritten at publish time by scripts/render-sdk-versions.sh.
|
|
21
21
|
// Keep this string literal exactly stable — sed matches on it.
|
|
22
|
-
export const SDK_VERSION = '0.
|
|
22
|
+
export const SDK_VERSION = '0.9.1';
|
|
23
23
|
|
|
24
24
|
function detectRuntime(): string {
|
|
25
25
|
const g = globalThis as unknown as {
|