@kaiban/sdk 0.1.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/README.md +225 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +15 -0
- package/dist/lib/client.d.ts +65 -0
- package/dist/lib/client.js +51 -0
- package/dist/lib/http/HttpClient.d.ts +16 -0
- package/dist/lib/http/HttpClient.js +237 -0
- package/dist/lib/http/errors.d.ts +50 -0
- package/dist/lib/http/errors.js +126 -0
- package/dist/lib/http/types.d.ts +40 -0
- package/dist/lib/http/types.js +1 -0
- package/dist/lib/resources/ActivitiesClient.d.ts +89 -0
- package/dist/lib/resources/ActivitiesClient.js +99 -0
- package/dist/lib/resources/AgentsClient.d.ts +121 -0
- package/dist/lib/resources/AgentsClient.js +134 -0
- package/dist/lib/resources/BenchmarkExecutionsClient.d.ts +250 -0
- package/dist/lib/resources/BenchmarkExecutionsClient.js +261 -0
- package/dist/lib/resources/BenchmarksClient.d.ts +159 -0
- package/dist/lib/resources/BenchmarksClient.js +158 -0
- package/dist/lib/resources/BoardsClient.d.ts +65 -0
- package/dist/lib/resources/BoardsClient.js +74 -0
- package/dist/lib/resources/CardsClient.d.ts +161 -0
- package/dist/lib/resources/CardsClient.js +202 -0
- package/dist/lib/resources/ExternalChannelsClient.d.ts +65 -0
- package/dist/lib/resources/ExternalChannelsClient.js +74 -0
- package/dist/lib/resources/ResourcesClient.d.ts +92 -0
- package/dist/lib/resources/ResourcesClient.js +98 -0
- package/dist/lib/resources/SupervisorFeedbackClient.d.ts +75 -0
- package/dist/lib/resources/SupervisorFeedbackClient.js +67 -0
- package/dist/lib/resources/TeamMembersClient.d.ts +66 -0
- package/dist/lib/resources/TeamMembersClient.js +75 -0
- package/dist/lib/resources/TeamsClient.d.ts +83 -0
- package/dist/lib/resources/TeamsClient.js +92 -0
- package/dist/lib/resources/__tests__/ActivitiesClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/ActivitiesClient.test.js +33 -0
- package/dist/lib/resources/__tests__/AgentsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/AgentsClient.test.js +37 -0
- package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.js +59 -0
- package/dist/lib/resources/__tests__/BenchmarksClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/BenchmarksClient.test.js +42 -0
- package/dist/lib/resources/__tests__/BoardsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/BoardsClient.test.js +26 -0
- package/dist/lib/resources/__tests__/CardsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/CardsClient.test.js +62 -0
- package/dist/lib/resources/__tests__/ExternalChannelsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/ExternalChannelsClient.test.js +26 -0
- package/dist/lib/resources/__tests__/ResourcesClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/ResourcesClient.test.js +28 -0
- package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.js +24 -0
- package/dist/lib/resources/__tests__/TeamMembersClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/TeamMembersClient.test.js +26 -0
- package/dist/lib/resources/__tests__/TeamsClient.test.d.ts +1 -0
- package/dist/lib/resources/__tests__/TeamsClient.test.js +26 -0
- package/dist/test/helpers/mockFetch.d.ts +8 -0
- package/dist/test/helpers/mockFetch.js +22 -0
- package/dist/types/a2a-data-parts.d.ts +64 -0
- package/dist/types/a2a-data-parts.js +13 -0
- package/dist/types/entities/activities.d.ts +32 -0
- package/dist/types/entities/activities.js +1 -0
- package/dist/types/entities/agent.d.ts +16 -0
- package/dist/types/entities/agent.js +1 -0
- package/dist/types/entities/benchmark.d.ts +82 -0
- package/dist/types/entities/benchmark.js +1 -0
- package/dist/types/entities/board.d.ts +20 -0
- package/dist/types/entities/board.js +1 -0
- package/dist/types/entities/card.d.ts +50 -0
- package/dist/types/entities/card.js +1 -0
- package/dist/types/entities/external-channel.d.ts +12 -0
- package/dist/types/entities/external-channel.js +1 -0
- package/dist/types/entities/index.d.ts +9 -0
- package/dist/types/entities/index.js +9 -0
- package/dist/types/entities/resource.d.ts +16 -0
- package/dist/types/entities/resource.js +1 -0
- package/dist/types/entities/shared.d.ts +1 -0
- package/dist/types/entities/shared.js +2 -0
- package/dist/types/entities/team.d.ts +14 -0
- package/dist/types/entities/team.js +1 -0
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/entities.js +1 -0
- package/dist/types/requests.d.ts +22 -0
- package/dist/types/requests.js +1 -0
- package/dist/types/responses.d.ts +77 -0
- package/dist/types/responses.js +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { HttpClient } from '../http/HttpClient';
|
|
2
|
+
import { RequestOptions } from '../http/types';
|
|
3
|
+
import { BenchmarkExecution, CreateBenchmarkExecutionInput, TestCaseResult, CreateTestCaseResultInput, UpdateBenchmarkExecutionInput, UpdateTestCaseResultInput } from '../../types/entities';
|
|
4
|
+
import { ListParams, Paginated } from '../../types/responses';
|
|
5
|
+
/**
|
|
6
|
+
* Client for managing benchmark executions and test case results
|
|
7
|
+
* Benchmark executions track the results of running benchmarks against agents
|
|
8
|
+
* @category Resources
|
|
9
|
+
*/
|
|
10
|
+
export declare class BenchmarkExecutionsClient {
|
|
11
|
+
private readonly http;
|
|
12
|
+
constructor(http: HttpClient);
|
|
13
|
+
/**
|
|
14
|
+
* List benchmark executions with pagination, filters, and sorting
|
|
15
|
+
*
|
|
16
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
17
|
+
* @param params.cursor - Cursor for the next page of results
|
|
18
|
+
* @param params.limit - Number of items per page
|
|
19
|
+
* @param params.order_by - Fields to sort by
|
|
20
|
+
* @param options - Optional request configuration
|
|
21
|
+
*
|
|
22
|
+
* @returns A paginated list of benchmark executions
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const result = await client.benchmarkExecutions.list({ limit: 10 });
|
|
27
|
+
* console.log(result.items);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
list(params?: ListParams, options?: RequestOptions): Promise<Paginated<BenchmarkExecution>>;
|
|
31
|
+
/**
|
|
32
|
+
* Iterate through all benchmark executions using async generator
|
|
33
|
+
* Automatically handles pagination by following next_page_token
|
|
34
|
+
*
|
|
35
|
+
* @param params - Optional query parameters (excluding cursor)
|
|
36
|
+
* @param options - Optional request configuration
|
|
37
|
+
*
|
|
38
|
+
* @yields Individual BenchmarkExecution objects
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* for await (const execution of client.benchmarkExecutions.listAll()) {
|
|
43
|
+
* console.log(execution.id, execution.status);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<BenchmarkExecution, void, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new benchmark execution
|
|
50
|
+
*
|
|
51
|
+
* @param data - Execution creation data
|
|
52
|
+
* @param options - Optional request configuration
|
|
53
|
+
*
|
|
54
|
+
* @returns The newly created benchmark execution
|
|
55
|
+
*
|
|
56
|
+
* @throws {Error} If creation fails
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const execution = await client.benchmarkExecutions.create({
|
|
61
|
+
* benchmark_id: 'benchmark-123',
|
|
62
|
+
* agent_id: 'agent-456',
|
|
63
|
+
* status: 'pending'
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
create(data: CreateBenchmarkExecutionInput, options?: RequestOptions): Promise<BenchmarkExecution>;
|
|
68
|
+
/**
|
|
69
|
+
* Get a single benchmark execution by ID
|
|
70
|
+
*
|
|
71
|
+
* @param id - The unique identifier of the benchmark execution
|
|
72
|
+
* @param options - Optional request configuration
|
|
73
|
+
*
|
|
74
|
+
* @returns The benchmark execution object
|
|
75
|
+
*
|
|
76
|
+
* @throws {Error} If the execution is not found or request fails
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const execution = await client.benchmarkExecutions.get('execution-123');
|
|
81
|
+
* console.log(execution.status, execution.results);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
get(id: string, options?: RequestOptions): Promise<BenchmarkExecution>;
|
|
85
|
+
/**
|
|
86
|
+
* Update a benchmark execution's properties
|
|
87
|
+
*
|
|
88
|
+
* @param id - The unique identifier of the execution to update
|
|
89
|
+
* @param data - Execution data with fields to update
|
|
90
|
+
* @param options - Optional request configuration
|
|
91
|
+
*
|
|
92
|
+
* @returns The updated benchmark execution object
|
|
93
|
+
*
|
|
94
|
+
* @throws {Error} If the execution is not found or update fails
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const updated = await client.benchmarkExecutions.update('execution-123', {
|
|
99
|
+
* status: 'completed'
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
update(id: string, data: UpdateBenchmarkExecutionInput, options?: RequestOptions): Promise<BenchmarkExecution>;
|
|
104
|
+
/**
|
|
105
|
+
* Delete a benchmark execution by ID
|
|
106
|
+
*
|
|
107
|
+
* @param id - The unique identifier of the execution to delete
|
|
108
|
+
* @param options - Optional request configuration
|
|
109
|
+
*
|
|
110
|
+
* @returns Promise that resolves when the execution is deleted
|
|
111
|
+
*
|
|
112
|
+
* @throws {Error} If the execution is not found or deletion fails
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* await client.benchmarkExecutions.delete('execution-123');
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a test case result for a benchmark execution
|
|
122
|
+
*
|
|
123
|
+
* @param params - Test case creation parameters
|
|
124
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
125
|
+
* @param params.body - Test case result data
|
|
126
|
+
* @param options - Optional request configuration
|
|
127
|
+
*
|
|
128
|
+
* @returns The newly created test case result
|
|
129
|
+
*
|
|
130
|
+
* @throws {Error} If the execution is not found or creation fails
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const testCase = await client.benchmarkExecutions.createTestCase({
|
|
135
|
+
* execution_id: 'execution-123',
|
|
136
|
+
* body: {
|
|
137
|
+
* test_case_id: 'test-1',
|
|
138
|
+
* status: 'passed',
|
|
139
|
+
* score: 95
|
|
140
|
+
* }
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
createTestCase(params: {
|
|
145
|
+
execution_id: string;
|
|
146
|
+
body: CreateTestCaseResultInput;
|
|
147
|
+
}, options?: RequestOptions): Promise<TestCaseResult>;
|
|
148
|
+
/**
|
|
149
|
+
* List test case results for a benchmark execution
|
|
150
|
+
*
|
|
151
|
+
* @param params - List parameters including execution_id and pagination options
|
|
152
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
153
|
+
* @param params.cursor - Optional cursor for the next page of results
|
|
154
|
+
* @param params.limit - Optional number of items per page
|
|
155
|
+
* @param options - Optional request configuration
|
|
156
|
+
*
|
|
157
|
+
* @returns A paginated list of test case results
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const results = await client.benchmarkExecutions.listTestCases({
|
|
162
|
+
* execution_id: 'execution-123',
|
|
163
|
+
* limit: 20
|
|
164
|
+
* });
|
|
165
|
+
* console.log(results.items);
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
listTestCases(params: {
|
|
169
|
+
execution_id: string;
|
|
170
|
+
} & ListParams, options?: RequestOptions): Promise<Paginated<TestCaseResult>>;
|
|
171
|
+
/**
|
|
172
|
+
* Get a single test case result by ID
|
|
173
|
+
*
|
|
174
|
+
* @param params - Parameters for getting the test case
|
|
175
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
176
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
177
|
+
* @param options - Optional request configuration
|
|
178
|
+
*
|
|
179
|
+
* @returns The test case result object
|
|
180
|
+
*
|
|
181
|
+
* @throws {Error} If the test case is not found or request fails
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const testCase = await client.benchmarkExecutions.getTestCase({
|
|
186
|
+
* execution_id: 'execution-123',
|
|
187
|
+
* test_case_id: 'test-1'
|
|
188
|
+
* });
|
|
189
|
+
* console.log(testCase.status, testCase.score);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
getTestCase(params: {
|
|
193
|
+
execution_id: string;
|
|
194
|
+
test_case_id: string;
|
|
195
|
+
}, options?: RequestOptions): Promise<TestCaseResult>;
|
|
196
|
+
/**
|
|
197
|
+
* Update a test case result's properties
|
|
198
|
+
*
|
|
199
|
+
* @param params - Update parameters
|
|
200
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
201
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
202
|
+
* @param params.body - Test case result data with fields to update
|
|
203
|
+
* @param options - Optional request configuration
|
|
204
|
+
*
|
|
205
|
+
* @returns The updated test case result object
|
|
206
|
+
*
|
|
207
|
+
* @throws {Error} If the test case is not found or update fails
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const updated = await client.benchmarkExecutions.updateTestCase({
|
|
212
|
+
* execution_id: 'execution-123',
|
|
213
|
+
* test_case_id: 'test-1',
|
|
214
|
+
* body: {
|
|
215
|
+
* status: 'passed',
|
|
216
|
+
* score: 98
|
|
217
|
+
* }
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
updateTestCase(params: {
|
|
222
|
+
execution_id: string;
|
|
223
|
+
test_case_id: string;
|
|
224
|
+
body: UpdateTestCaseResultInput;
|
|
225
|
+
}, options?: RequestOptions): Promise<TestCaseResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Delete a test case result by ID
|
|
228
|
+
*
|
|
229
|
+
* @param params - Delete parameters
|
|
230
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
231
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
232
|
+
* @param options - Optional request configuration
|
|
233
|
+
*
|
|
234
|
+
* @returns Promise that resolves when the test case is deleted
|
|
235
|
+
*
|
|
236
|
+
* @throws {Error} If the test case is not found or deletion fails
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* await client.benchmarkExecutions.deleteTestCase({
|
|
241
|
+
* execution_id: 'execution-123',
|
|
242
|
+
* test_case_id: 'test-1'
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
deleteTestCase(params: {
|
|
247
|
+
execution_id: string;
|
|
248
|
+
test_case_id: string;
|
|
249
|
+
}, options?: RequestOptions): Promise<void>;
|
|
250
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for managing benchmark executions and test case results
|
|
3
|
+
* Benchmark executions track the results of running benchmarks against agents
|
|
4
|
+
* @category Resources
|
|
5
|
+
*/
|
|
6
|
+
export class BenchmarkExecutionsClient {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List benchmark executions with pagination, filters, and sorting
|
|
12
|
+
*
|
|
13
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
14
|
+
* @param params.cursor - Cursor for the next page of results
|
|
15
|
+
* @param params.limit - Number of items per page
|
|
16
|
+
* @param params.order_by - Fields to sort by
|
|
17
|
+
* @param options - Optional request configuration
|
|
18
|
+
*
|
|
19
|
+
* @returns A paginated list of benchmark executions
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const result = await client.benchmarkExecutions.list({ limit: 10 });
|
|
24
|
+
* console.log(result.items);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
list(params, options) {
|
|
28
|
+
return this.http.list('/benchmark-executions', params, options);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Iterate through all benchmark executions using async generator
|
|
32
|
+
* Automatically handles pagination by following next_page_token
|
|
33
|
+
*
|
|
34
|
+
* @param params - Optional query parameters (excluding cursor)
|
|
35
|
+
* @param options - Optional request configuration
|
|
36
|
+
*
|
|
37
|
+
* @yields Individual BenchmarkExecution objects
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* for await (const execution of client.benchmarkExecutions.listAll()) {
|
|
42
|
+
* console.log(execution.id, execution.status);
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
async *listAll(params, options) {
|
|
47
|
+
let pageToken = undefined;
|
|
48
|
+
do {
|
|
49
|
+
const page = await this.list({ ...(params || {}), cursor: pageToken }, options);
|
|
50
|
+
for (const item of page.items)
|
|
51
|
+
yield item;
|
|
52
|
+
pageToken = page.next_page_token;
|
|
53
|
+
} while (pageToken);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new benchmark execution
|
|
57
|
+
*
|
|
58
|
+
* @param data - Execution creation data
|
|
59
|
+
* @param options - Optional request configuration
|
|
60
|
+
*
|
|
61
|
+
* @returns The newly created benchmark execution
|
|
62
|
+
*
|
|
63
|
+
* @throws {Error} If creation fails
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const execution = await client.benchmarkExecutions.create({
|
|
68
|
+
* benchmark_id: 'benchmark-123',
|
|
69
|
+
* agent_id: 'agent-456',
|
|
70
|
+
* status: 'pending'
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
create(data, options) {
|
|
75
|
+
return this.http.post('/benchmark-executions', data, options);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get a single benchmark execution by ID
|
|
79
|
+
*
|
|
80
|
+
* @param id - The unique identifier of the benchmark execution
|
|
81
|
+
* @param options - Optional request configuration
|
|
82
|
+
*
|
|
83
|
+
* @returns The benchmark execution object
|
|
84
|
+
*
|
|
85
|
+
* @throws {Error} If the execution is not found or request fails
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const execution = await client.benchmarkExecutions.get('execution-123');
|
|
90
|
+
* console.log(execution.status, execution.results);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
get(id, options) {
|
|
94
|
+
return this.http.get(`/benchmark-execution/${encodeURIComponent(id)}`, options);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Update a benchmark execution's properties
|
|
98
|
+
*
|
|
99
|
+
* @param id - The unique identifier of the execution to update
|
|
100
|
+
* @param data - Execution data with fields to update
|
|
101
|
+
* @param options - Optional request configuration
|
|
102
|
+
*
|
|
103
|
+
* @returns The updated benchmark execution object
|
|
104
|
+
*
|
|
105
|
+
* @throws {Error} If the execution is not found or update fails
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const updated = await client.benchmarkExecutions.update('execution-123', {
|
|
110
|
+
* status: 'completed'
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
update(id, data, options) {
|
|
115
|
+
return this.http.put(`/benchmark-execution/${encodeURIComponent(id)}`, data, options);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Delete a benchmark execution by ID
|
|
119
|
+
*
|
|
120
|
+
* @param id - The unique identifier of the execution to delete
|
|
121
|
+
* @param options - Optional request configuration
|
|
122
|
+
*
|
|
123
|
+
* @returns Promise that resolves when the execution is deleted
|
|
124
|
+
*
|
|
125
|
+
* @throws {Error} If the execution is not found or deletion fails
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* await client.benchmarkExecutions.delete('execution-123');
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
delete(id, options) {
|
|
133
|
+
return this.http.delete(`/benchmark-execution/${encodeURIComponent(id)}`, options);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create a test case result for a benchmark execution
|
|
137
|
+
*
|
|
138
|
+
* @param params - Test case creation parameters
|
|
139
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
140
|
+
* @param params.body - Test case result data
|
|
141
|
+
* @param options - Optional request configuration
|
|
142
|
+
*
|
|
143
|
+
* @returns The newly created test case result
|
|
144
|
+
*
|
|
145
|
+
* @throws {Error} If the execution is not found or creation fails
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const testCase = await client.benchmarkExecutions.createTestCase({
|
|
150
|
+
* execution_id: 'execution-123',
|
|
151
|
+
* body: {
|
|
152
|
+
* test_case_id: 'test-1',
|
|
153
|
+
* status: 'passed',
|
|
154
|
+
* score: 95
|
|
155
|
+
* }
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
createTestCase(params, options) {
|
|
160
|
+
return this.http.post(`/benchmark-execution/${encodeURIComponent(params.execution_id)}/test-cases`, params.body, options);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* List test case results for a benchmark execution
|
|
164
|
+
*
|
|
165
|
+
* @param params - List parameters including execution_id and pagination options
|
|
166
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
167
|
+
* @param params.cursor - Optional cursor for the next page of results
|
|
168
|
+
* @param params.limit - Optional number of items per page
|
|
169
|
+
* @param options - Optional request configuration
|
|
170
|
+
*
|
|
171
|
+
* @returns A paginated list of test case results
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const results = await client.benchmarkExecutions.listTestCases({
|
|
176
|
+
* execution_id: 'execution-123',
|
|
177
|
+
* limit: 20
|
|
178
|
+
* });
|
|
179
|
+
* console.log(results.items);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
listTestCases(params, options) {
|
|
183
|
+
const { execution_id, ...rest } = params;
|
|
184
|
+
return this.http.get(`/benchmark-execution/${encodeURIComponent(execution_id)}/test-cases`, { ...options, query: { ...(rest || {}) } });
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get a single test case result by ID
|
|
188
|
+
*
|
|
189
|
+
* @param params - Parameters for getting the test case
|
|
190
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
191
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
192
|
+
* @param options - Optional request configuration
|
|
193
|
+
*
|
|
194
|
+
* @returns The test case result object
|
|
195
|
+
*
|
|
196
|
+
* @throws {Error} If the test case is not found or request fails
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const testCase = await client.benchmarkExecutions.getTestCase({
|
|
201
|
+
* execution_id: 'execution-123',
|
|
202
|
+
* test_case_id: 'test-1'
|
|
203
|
+
* });
|
|
204
|
+
* console.log(testCase.status, testCase.score);
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
getTestCase(params, options) {
|
|
208
|
+
return this.http.get(`/benchmark-execution/${encodeURIComponent(params.execution_id)}/test-cases/${encodeURIComponent(params.test_case_id)}`, options);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Update a test case result's properties
|
|
212
|
+
*
|
|
213
|
+
* @param params - Update parameters
|
|
214
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
215
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
216
|
+
* @param params.body - Test case result data with fields to update
|
|
217
|
+
* @param options - Optional request configuration
|
|
218
|
+
*
|
|
219
|
+
* @returns The updated test case result object
|
|
220
|
+
*
|
|
221
|
+
* @throws {Error} If the test case is not found or update fails
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const updated = await client.benchmarkExecutions.updateTestCase({
|
|
226
|
+
* execution_id: 'execution-123',
|
|
227
|
+
* test_case_id: 'test-1',
|
|
228
|
+
* body: {
|
|
229
|
+
* status: 'passed',
|
|
230
|
+
* score: 98
|
|
231
|
+
* }
|
|
232
|
+
* });
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
updateTestCase(params, options) {
|
|
236
|
+
return this.http.put(`/benchmark-execution/${encodeURIComponent(params.execution_id)}/test-cases/${encodeURIComponent(params.test_case_id)}`, params.body, options);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Delete a test case result by ID
|
|
240
|
+
*
|
|
241
|
+
* @param params - Delete parameters
|
|
242
|
+
* @param params.execution_id - The unique identifier of the benchmark execution
|
|
243
|
+
* @param params.test_case_id - The unique identifier of the test case result
|
|
244
|
+
* @param options - Optional request configuration
|
|
245
|
+
*
|
|
246
|
+
* @returns Promise that resolves when the test case is deleted
|
|
247
|
+
*
|
|
248
|
+
* @throws {Error} If the test case is not found or deletion fails
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* await client.benchmarkExecutions.deleteTestCase({
|
|
253
|
+
* execution_id: 'execution-123',
|
|
254
|
+
* test_case_id: 'test-1'
|
|
255
|
+
* });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
deleteTestCase(params, options) {
|
|
259
|
+
return this.http.delete(`/benchmark-execution/${encodeURIComponent(params.execution_id)}/test-cases/${encodeURIComponent(params.test_case_id)}`, options);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { HttpClient } from '../http/HttpClient';
|
|
2
|
+
import { RequestOptions } from '../http/types';
|
|
3
|
+
import { Benchmark, CreateBenchmarkInput, UpdateBenchmarkInput } from '../../types/entities';
|
|
4
|
+
import { ListParams, Paginated } from '../../types/responses';
|
|
5
|
+
/**
|
|
6
|
+
* Client for managing benchmarks in the Kaiban platform
|
|
7
|
+
* Benchmarks are used to evaluate and test agent performance
|
|
8
|
+
* @category Resources
|
|
9
|
+
*/
|
|
10
|
+
export declare class BenchmarksClient {
|
|
11
|
+
private readonly http;
|
|
12
|
+
constructor(http: HttpClient);
|
|
13
|
+
/**
|
|
14
|
+
* List benchmarks with pagination, filters, and sorting
|
|
15
|
+
*
|
|
16
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
17
|
+
* @param params.cursor - Cursor for the next page of results
|
|
18
|
+
* @param params.limit - Number of items per page
|
|
19
|
+
* @param params.order_by - Fields to sort by
|
|
20
|
+
* @param options - Optional request configuration
|
|
21
|
+
*
|
|
22
|
+
* @returns A paginated list of benchmarks
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const result = await client.benchmarks.list({ limit: 10 });
|
|
27
|
+
* console.log(result.items);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Benchmark>>;
|
|
31
|
+
/**
|
|
32
|
+
* Iterate through all benchmarks using async generator
|
|
33
|
+
* Automatically handles pagination by following next_page_token
|
|
34
|
+
*
|
|
35
|
+
* @param params - Optional query parameters (excluding cursor)
|
|
36
|
+
* @param options - Optional request configuration
|
|
37
|
+
*
|
|
38
|
+
* @yields Individual Benchmark objects
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* for await (const benchmark of client.benchmarks.listAll()) {
|
|
43
|
+
* console.log(benchmark.id, benchmark.name);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Benchmark, void, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Get a single benchmark by ID
|
|
50
|
+
*
|
|
51
|
+
* @param id - The unique identifier of the benchmark
|
|
52
|
+
* @param options - Optional request configuration
|
|
53
|
+
*
|
|
54
|
+
* @returns The benchmark object
|
|
55
|
+
*
|
|
56
|
+
* @throws {Error} If the benchmark is not found or request fails
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const benchmark = await client.benchmarks.get('benchmark-123');
|
|
61
|
+
* console.log(benchmark.name, benchmark.description);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
get(id: string, options?: RequestOptions): Promise<Benchmark>;
|
|
65
|
+
/**
|
|
66
|
+
* Create a new benchmark
|
|
67
|
+
*
|
|
68
|
+
* @param data - Benchmark creation data
|
|
69
|
+
* @param data.name - The benchmark name
|
|
70
|
+
* @param data.description - Optional description
|
|
71
|
+
* @param options - Optional request configuration
|
|
72
|
+
*
|
|
73
|
+
* @returns The newly created benchmark
|
|
74
|
+
*
|
|
75
|
+
* @throws {Error} If creation fails
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const benchmark = await client.benchmarks.create({
|
|
80
|
+
* name: 'Performance Test Suite',
|
|
81
|
+
* description: 'Test agent response times',
|
|
82
|
+
* test_cases: [...]
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
create(data: CreateBenchmarkInput, options?: RequestOptions): Promise<Benchmark>;
|
|
87
|
+
/**
|
|
88
|
+
* Update a benchmark's properties
|
|
89
|
+
*
|
|
90
|
+
* @param id - The unique identifier of the benchmark to update
|
|
91
|
+
* @param data - Benchmark data with fields to update
|
|
92
|
+
* @param options - Optional request configuration
|
|
93
|
+
*
|
|
94
|
+
* @returns The updated benchmark object
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} If the benchmark is not found or update fails
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const updated = await client.benchmarks.update('benchmark-123', {
|
|
101
|
+
* name: 'Updated Benchmark Name'
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
update(id: string, data: UpdateBenchmarkInput, options?: RequestOptions): Promise<Benchmark>;
|
|
106
|
+
/**
|
|
107
|
+
* Execute a benchmark against an agent
|
|
108
|
+
* Runs the benchmark test suite with specified configuration
|
|
109
|
+
*
|
|
110
|
+
* @param params - Execution parameters
|
|
111
|
+
* @param params.benchmark_id - The unique identifier of the benchmark to execute
|
|
112
|
+
* @param params.body - Execution configuration
|
|
113
|
+
* @param params.body.agentConfig - Agent configuration including ID, name, and card URL
|
|
114
|
+
* @param params.body.thresholds - Optional performance thresholds
|
|
115
|
+
* @param params.body.maxTests - Optional maximum number of tests to run
|
|
116
|
+
* @param params.body.parallel - Optional flag to run tests in parallel
|
|
117
|
+
* @param params.body.batchSize - Optional batch size for parallel execution
|
|
118
|
+
* @param options - Optional request configuration
|
|
119
|
+
*
|
|
120
|
+
* @returns A response with execution status message
|
|
121
|
+
*
|
|
122
|
+
* @throws {Error} If the benchmark is not found or execution fails
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const result = await client.benchmarks.execute({
|
|
127
|
+
* benchmark_id: 'benchmark-123',
|
|
128
|
+
* body: {
|
|
129
|
+
* agentConfig: {
|
|
130
|
+
* id: 'agent-456',
|
|
131
|
+
* name: 'Test Agent',
|
|
132
|
+
* cardUrl: 'https://example.com/agent-card'
|
|
133
|
+
* },
|
|
134
|
+
* maxTests: 100,
|
|
135
|
+
* parallel: true,
|
|
136
|
+
* batchSize: 10
|
|
137
|
+
* }
|
|
138
|
+
* });
|
|
139
|
+
* console.log(result.message);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
execute(params: {
|
|
143
|
+
benchmark_id: string;
|
|
144
|
+
body: {
|
|
145
|
+
agentConfig: {
|
|
146
|
+
id: string;
|
|
147
|
+
name?: string;
|
|
148
|
+
type?: string;
|
|
149
|
+
cardUrl?: string;
|
|
150
|
+
};
|
|
151
|
+
thresholds?: Record<string, number>;
|
|
152
|
+
maxTests?: number;
|
|
153
|
+
parallel?: boolean;
|
|
154
|
+
batchSize?: number;
|
|
155
|
+
};
|
|
156
|
+
}, options?: RequestOptions): Promise<{
|
|
157
|
+
message: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|