Skip to content

Commit 8d9a60e

Browse files
fix(benchmarks): update() for benchmarks and scenarios replaces all provided fields and does not modify unspecified fields (#6702)
1 parent eb173df commit 8d9a60e

8 files changed

Lines changed: 133 additions & 50 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 98
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-370a5d676ff0ef41f3ca6ed669d29b6e3e6b7f0a914ac3dbed6bd45e75533c74.yml
3-
openapi_spec_hash: 7bb5ea1117d754b7985aff0da5bca3a7
4-
config_hash: 7b7fc2ccd6bf3551718a79332772e713
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-939601ae2016f4611626f9b52a14a4b4a2076879f49804942ac1788b3302b97a.yml
3+
openapi_spec_hash: 162edc35b9e7b1f45fe38484361aa880
4+
config_hash: cb8534d20a68a49b92726bedd50f8bb1

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Types:
1717
- <code><a href="./src/resources/benchmarks/benchmarks.ts">BenchmarkRunListView</a></code>
1818
- <code><a href="./src/resources/benchmarks/benchmarks.ts">BenchmarkRunView</a></code>
1919
- <code><a href="./src/resources/benchmarks/benchmarks.ts">BenchmarkScenarioUpdateParameters</a></code>
20+
- <code><a href="./src/resources/benchmarks/benchmarks.ts">BenchmarkUpdateParameters</a></code>
2021
- <code><a href="./src/resources/benchmarks/benchmarks.ts">BenchmarkView</a></code>
2122
- <code><a href="./src/resources/benchmarks/benchmarks.ts">ScenarioDefinitionListView</a></code>
2223
- <code><a href="./src/resources/benchmarks/benchmarks.ts">StartBenchmarkRunParameters</a></code>

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ import {
108108
BenchmarkRunView,
109109
BenchmarkScenarioUpdateParameters,
110110
BenchmarkStartRunParams,
111+
BenchmarkUpdateParameters,
111112
BenchmarkUpdateParams,
112113
BenchmarkUpdateScenariosParams,
113114
BenchmarkView,
@@ -445,6 +446,7 @@ export declare namespace Runloop {
445446
type BenchmarkRunListView as BenchmarkRunListView,
446447
type BenchmarkRunView as BenchmarkRunView,
447448
type BenchmarkScenarioUpdateParameters as BenchmarkScenarioUpdateParameters,
449+
type BenchmarkUpdateParameters as BenchmarkUpdateParameters,
448450
type BenchmarkView as BenchmarkView,
449451
type ScenarioDefinitionListView as ScenarioDefinitionListView,
450452
type StartBenchmarkRunParameters as StartBenchmarkRunParameters,

src/resources/benchmarks/benchmarks.ts

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,24 @@ export class Benchmarks extends APIResource {
3131
}
3232

3333
/**
34-
* Update a Benchmark with a set of Scenarios.
34+
* Update a Benchmark. Fields that are null will preserve the existing value.
35+
* Fields that are provided (including empty values) will replace the existing
36+
* value entirely.
3537
*/
3638
update(
3739
id: string,
38-
body: BenchmarkUpdateParams,
40+
body?: BenchmarkUpdateParams,
41+
options?: Core.RequestOptions,
42+
): Core.APIPromise<BenchmarkView>;
43+
update(id: string, options?: Core.RequestOptions): Core.APIPromise<BenchmarkView>;
44+
update(
45+
id: string,
46+
body: BenchmarkUpdateParams | Core.RequestOptions = {},
3947
options?: Core.RequestOptions,
4048
): Core.APIPromise<BenchmarkView> {
49+
if (isRequestOptions(body)) {
50+
return this.update(id, {}, body);
51+
}
4152
return this._client.post(`/v1/benchmarks/${id}`, { body, ...options });
4253
}
4354

@@ -142,7 +153,7 @@ export class BenchmarkRunViewsBenchmarkRunsCursorIDPage extends BenchmarkRunsCur
142153
*/
143154
export interface BenchmarkCreateParameters {
144155
/**
145-
* The name of the Benchmark. This must be unique.
156+
* The unique name of the Benchmark.
146157
*/
147158
name: string;
148159

@@ -157,13 +168,13 @@ export interface BenchmarkCreateParameters {
157168
description?: string | null;
158169

159170
/**
160-
* User defined metadata to attach to the benchmark for organization.
171+
* User defined metadata to attach to the benchmark.
161172
*/
162173
metadata?: { [key: string]: string } | null;
163174

164175
/**
165176
* Environment variables required to run the benchmark. If any required variables
166-
* are not supplied, the benchmark will fail to start
177+
* are not supplied, the benchmark will fail to start.
167178
*/
168179
required_environment_variables?: Array<string> | null;
169180

@@ -269,6 +280,52 @@ export interface BenchmarkScenarioUpdateParameters {
269280
scenarios_to_remove?: Array<string> | null;
270281
}
271282

283+
/**
284+
* BenchmarkUpdateParameters contain the set of parameters to update a Benchmark.
285+
* All fields are optional - null fields preserve existing values, provided fields
286+
* replace entirely.
287+
*/
288+
export interface BenchmarkUpdateParameters {
289+
/**
290+
* Attribution information for the benchmark. Pass in empty string to clear.
291+
*/
292+
attribution?: string | null;
293+
294+
/**
295+
* Detailed description of the benchmark. Pass in empty string to clear.
296+
*/
297+
description?: string | null;
298+
299+
/**
300+
* User defined metadata to attach to the benchmark. Pass in empty map to clear.
301+
*/
302+
metadata?: { [key: string]: string } | null;
303+
304+
/**
305+
* The unique name of the Benchmark. Cannot be blank.
306+
*/
307+
name?: string | null;
308+
309+
/**
310+
* Environment variables required to run the benchmark. If any required variables
311+
* are not supplied, the benchmark will fail to start. Pass in empty list to clear.
312+
*/
313+
required_environment_variables?: Array<string> | null;
314+
315+
/**
316+
* Secrets required to run the benchmark with (environment variable name will be
317+
* mapped to the your user secret by name). If any of these secrets are not
318+
* provided or the mapping is incorrect, the benchmark will fail to start. Pass in
319+
* empty list to clear.
320+
*/
321+
required_secret_names?: Array<string> | null;
322+
323+
/**
324+
* The Scenario IDs that make up the Benchmark. Pass in empty list to clear.
325+
*/
326+
scenario_ids?: Array<string> | null;
327+
}
328+
272329
/**
273330
* A BenchmarkDefinitionView represents a grouped set of Scenarios that together
274331
* form a Benchmark.
@@ -359,7 +416,7 @@ export interface StartBenchmarkRunParameters {
359416

360417
export interface BenchmarkCreateParams {
361418
/**
362-
* The name of the Benchmark. This must be unique.
419+
* The unique name of the Benchmark.
363420
*/
364421
name: string;
365422

@@ -374,13 +431,13 @@ export interface BenchmarkCreateParams {
374431
description?: string | null;
375432

376433
/**
377-
* User defined metadata to attach to the benchmark for organization.
434+
* User defined metadata to attach to the benchmark.
378435
*/
379436
metadata?: { [key: string]: string } | null;
380437

381438
/**
382439
* Environment variables required to run the benchmark. If any required variables
383-
* are not supplied, the benchmark will fail to start
440+
* are not supplied, the benchmark will fail to start.
384441
*/
385442
required_environment_variables?: Array<string> | null;
386443

@@ -399,40 +456,41 @@ export interface BenchmarkCreateParams {
399456

400457
export interface BenchmarkUpdateParams {
401458
/**
402-
* The name of the Benchmark. This must be unique.
403-
*/
404-
name: string;
405-
406-
/**
407-
* Attribution information for the benchmark.
459+
* Attribution information for the benchmark. Pass in empty string to clear.
408460
*/
409461
attribution?: string | null;
410462

411463
/**
412-
* Detailed description of the benchmark.
464+
* Detailed description of the benchmark. Pass in empty string to clear.
413465
*/
414466
description?: string | null;
415467

416468
/**
417-
* User defined metadata to attach to the benchmark for organization.
469+
* User defined metadata to attach to the benchmark. Pass in empty map to clear.
418470
*/
419471
metadata?: { [key: string]: string } | null;
420472

473+
/**
474+
* The unique name of the Benchmark. Cannot be blank.
475+
*/
476+
name?: string | null;
477+
421478
/**
422479
* Environment variables required to run the benchmark. If any required variables
423-
* are not supplied, the benchmark will fail to start
480+
* are not supplied, the benchmark will fail to start. Pass in empty list to clear.
424481
*/
425482
required_environment_variables?: Array<string> | null;
426483

427484
/**
428485
* Secrets required to run the benchmark with (environment variable name will be
429486
* mapped to the your user secret by name). If any of these secrets are not
430-
* provided or the mapping is incorrect, the benchmark will fail to start.
487+
* provided or the mapping is incorrect, the benchmark will fail to start. Pass in
488+
* empty list to clear.
431489
*/
432-
required_secret_names?: Array<string>;
490+
required_secret_names?: Array<string> | null;
433491

434492
/**
435-
* The Scenario IDs that make up the Benchmark.
493+
* The Scenario IDs that make up the Benchmark. Pass in empty list to clear.
436494
*/
437495
scenario_ids?: Array<string> | null;
438496
}
@@ -501,6 +559,7 @@ export declare namespace Benchmarks {
501559
type BenchmarkRunListView as BenchmarkRunListView,
502560
type BenchmarkRunView as BenchmarkRunView,
503561
type BenchmarkScenarioUpdateParameters as BenchmarkScenarioUpdateParameters,
562+
type BenchmarkUpdateParameters as BenchmarkUpdateParameters,
504563
type BenchmarkView as BenchmarkView,
505564
type ScenarioDefinitionListView as ScenarioDefinitionListView,
506565
type StartBenchmarkRunParameters as StartBenchmarkRunParameters,

src/resources/benchmarks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
type BenchmarkRunListView,
99
type BenchmarkRunView,
1010
type BenchmarkScenarioUpdateParameters,
11+
type BenchmarkUpdateParameters,
1112
type BenchmarkView,
1213
type ScenarioDefinitionListView,
1314
type StartBenchmarkRunParameters,

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export {
1818
type BenchmarkRunListView,
1919
type BenchmarkRunView,
2020
type BenchmarkScenarioUpdateParameters,
21+
type BenchmarkUpdateParameters,
2122
type BenchmarkView,
2223
type ScenarioDefinitionListView,
2324
type StartBenchmarkRunParameters,

src/resources/scenarios/scenarios.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export class Scenarios extends APIResource {
4848
}
4949

5050
/**
51-
* Update a Scenario, a repeatable AI coding evaluation test that defines the
52-
* starting environment as well as evaluation success criteria. Only provided
53-
* fields will be updated.
51+
* Update a Scenario. Fields that are null will preserve the existing value. Fields
52+
* that are provided (including empty values) will replace the existing value
53+
* entirely.
5454
*/
5555
update(
5656
id: string,
@@ -329,6 +329,11 @@ export interface ScenarioRunView {
329329
start_time_ms?: number;
330330
}
331331

332+
/**
333+
* ScenarioUpdateParameters contain the set of parameters to update a Scenario. All
334+
* fields are optional - null fields preserve existing values, provided fields
335+
* replace entirely.
336+
*/
332337
export interface ScenarioUpdateParameters {
333338
/**
334339
* The Environment in which the Scenario will run.
@@ -341,29 +346,29 @@ export interface ScenarioUpdateParameters {
341346
input_context?: InputContextUpdate | null;
342347

343348
/**
344-
* User defined metadata to attach to the scenario for organization.
349+
* User defined metadata to attach to the scenario. Pass in empty map to clear.
345350
*/
346351
metadata?: { [key: string]: string } | null;
347352

348353
/**
349-
* Name of the scenario.
354+
* Name of the scenario. Cannot be blank.
350355
*/
351356
name?: string | null;
352357

353358
/**
354359
* A string representation of the reference output to solve the scenario. Commonly
355360
* can be the result of a git diff or a sequence of command actions to apply to the
356-
* environment.
361+
* environment. Pass in empty string to clear.
357362
*/
358363
reference_output?: string | null;
359364

360365
/**
361-
* Environment variables required to run the scenario.
366+
* Environment variables required to run the scenario. Pass in empty list to clear.
362367
*/
363368
required_environment_variables?: Array<string> | null;
364369

365370
/**
366-
* Secrets required to run the scenario.
371+
* Secrets required to run the scenario. Pass in empty list to clear.
367372
*/
368373
required_secret_names?: Array<string> | null;
369374

@@ -373,7 +378,7 @@ export interface ScenarioUpdateParameters {
373378
scoring_contract?: ScoringContractUpdate | null;
374379

375380
/**
376-
* Validation strategy.
381+
* Validation strategy. Pass in empty string to clear.
377382
*/
378383
validation_type?: 'UNSPECIFIED' | 'FORWARD' | 'REVERSE' | 'EVALUATION' | null;
379384
}
@@ -752,29 +757,29 @@ export interface ScenarioUpdateParams {
752757
input_context?: InputContextUpdate | null;
753758

754759
/**
755-
* User defined metadata to attach to the scenario for organization.
760+
* User defined metadata to attach to the scenario. Pass in empty map to clear.
756761
*/
757762
metadata?: { [key: string]: string } | null;
758763

759764
/**
760-
* Name of the scenario.
765+
* Name of the scenario. Cannot be blank.
761766
*/
762767
name?: string | null;
763768

764769
/**
765770
* A string representation of the reference output to solve the scenario. Commonly
766771
* can be the result of a git diff or a sequence of command actions to apply to the
767-
* environment.
772+
* environment. Pass in empty string to clear.
768773
*/
769774
reference_output?: string | null;
770775

771776
/**
772-
* Environment variables required to run the scenario.
777+
* Environment variables required to run the scenario. Pass in empty list to clear.
773778
*/
774779
required_environment_variables?: Array<string> | null;
775780

776781
/**
777-
* Secrets required to run the scenario.
782+
* Secrets required to run the scenario. Pass in empty list to clear.
778783
*/
779784
required_secret_names?: Array<string> | null;
780785

@@ -784,7 +789,7 @@ export interface ScenarioUpdateParams {
784789
scoring_contract?: ScoringContractUpdate | null;
785790

786791
/**
787-
* Validation strategy.
792+
* Validation strategy. Pass in empty string to clear.
788793
*/
789794
validation_type?: 'UNSPECIFIED' | 'FORWARD' | 'REVERSE' | 'EVALUATION' | null;
790795
}

0 commit comments

Comments
 (0)