Skip to content

Commit cfd04b6

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

8 files changed

Lines changed: 91 additions & 83 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
@@ -21,6 +21,7 @@ from runloop_api_client.types import (
2121
BenchmarkRunListView,
2222
BenchmarkRunView,
2323
BenchmarkScenarioUpdateParameters,
24+
BenchmarkUpdateParameters,
2425
BenchmarkView,
2526
ScenarioDefinitionListView,
2627
StartBenchmarkRunParameters,

src/runloop_api_client/resources/benchmarks/benchmarks.py

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ def create(
8989
Create a Benchmark with a set of Scenarios.
9090
9191
Args:
92-
name: The name of the Benchmark. This must be unique.
92+
name: The unique name of the Benchmark.
9393
9494
attribution: Attribution information for the benchmark.
9595
9696
description: Detailed description of the benchmark.
9797
98-
metadata: User defined metadata to attach to the benchmark for organization.
98+
metadata: User defined metadata to attach to the benchmark.
9999
100100
required_environment_variables: Environment variables required to run the benchmark. If any required variables
101-
are not supplied, the benchmark will fail to start
101+
are not supplied, the benchmark will fail to start.
102102
103103
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
104104
mapped to the your user secret by name). If any of these secrets are not
@@ -177,12 +177,12 @@ def update(
177177
self,
178178
id: str,
179179
*,
180-
name: str,
181180
attribution: Optional[str] | Omit = omit,
182181
description: Optional[str] | Omit = omit,
183182
metadata: Optional[Dict[str, str]] | Omit = omit,
183+
name: Optional[str] | Omit = omit,
184184
required_environment_variables: Optional[SequenceNotStr[str]] | Omit = omit,
185-
required_secret_names: SequenceNotStr[str] | Omit = omit,
185+
required_secret_names: Optional[SequenceNotStr[str]] | Omit = omit,
186186
scenario_ids: Optional[SequenceNotStr[str]] | Omit = omit,
187187
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
188188
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -192,26 +192,30 @@ def update(
192192
timeout: float | httpx.Timeout | None | NotGiven = not_given,
193193
idempotency_key: str | None = None,
194194
) -> BenchmarkView:
195-
"""
196-
Update a Benchmark with a set of Scenarios.
195+
"""Update a Benchmark.
196+
197+
Fields that are null will preserve the existing value.
198+
Fields that are provided (including empty values) will replace the existing
199+
value entirely.
197200
198201
Args:
199-
name: The name of the Benchmark. This must be unique.
202+
attribution: Attribution information for the benchmark. Pass in empty string to clear.
200203
201-
attribution: Attribution information for the benchmark.
204+
description: Detailed description of the benchmark. Pass in empty string to clear.
202205
203-
description: Detailed description of the benchmark.
206+
metadata: User defined metadata to attach to the benchmark. Pass in empty map to clear.
204207
205-
metadata: User defined metadata to attach to the benchmark for organization.
208+
name: The unique name of the Benchmark. Cannot be blank.
206209
207210
required_environment_variables: Environment variables required to run the benchmark. If any required variables
208-
are not supplied, the benchmark will fail to start
211+
are not supplied, the benchmark will fail to start. Pass in empty list to clear.
209212
210213
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
211214
mapped to the your user secret by name). If any of these secrets are not
212-
provided or the mapping is incorrect, the benchmark will fail to start.
215+
provided or the mapping is incorrect, the benchmark will fail to start. Pass in
216+
empty list to clear.
213217
214-
scenario_ids: The Scenario IDs that make up the Benchmark.
218+
scenario_ids: The Scenario IDs that make up the Benchmark. Pass in empty list to clear.
215219
216220
extra_headers: Send extra headers
217221
@@ -229,10 +233,10 @@ def update(
229233
f"/v1/benchmarks/{id}",
230234
body=maybe_transform(
231235
{
232-
"name": name,
233236
"attribution": attribution,
234237
"description": description,
235238
"metadata": metadata,
239+
"name": name,
236240
"required_environment_variables": required_environment_variables,
237241
"required_secret_names": required_secret_names,
238242
"scenario_ids": scenario_ids,
@@ -554,16 +558,16 @@ async def create(
554558
Create a Benchmark with a set of Scenarios.
555559
556560
Args:
557-
name: The name of the Benchmark. This must be unique.
561+
name: The unique name of the Benchmark.
558562
559563
attribution: Attribution information for the benchmark.
560564
561565
description: Detailed description of the benchmark.
562566
563-
metadata: User defined metadata to attach to the benchmark for organization.
567+
metadata: User defined metadata to attach to the benchmark.
564568
565569
required_environment_variables: Environment variables required to run the benchmark. If any required variables
566-
are not supplied, the benchmark will fail to start
570+
are not supplied, the benchmark will fail to start.
567571
568572
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
569573
mapped to the your user secret by name). If any of these secrets are not
@@ -642,12 +646,12 @@ async def update(
642646
self,
643647
id: str,
644648
*,
645-
name: str,
646649
attribution: Optional[str] | Omit = omit,
647650
description: Optional[str] | Omit = omit,
648651
metadata: Optional[Dict[str, str]] | Omit = omit,
652+
name: Optional[str] | Omit = omit,
649653
required_environment_variables: Optional[SequenceNotStr[str]] | Omit = omit,
650-
required_secret_names: SequenceNotStr[str] | Omit = omit,
654+
required_secret_names: Optional[SequenceNotStr[str]] | Omit = omit,
651655
scenario_ids: Optional[SequenceNotStr[str]] | Omit = omit,
652656
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
653657
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -657,26 +661,30 @@ async def update(
657661
timeout: float | httpx.Timeout | None | NotGiven = not_given,
658662
idempotency_key: str | None = None,
659663
) -> BenchmarkView:
660-
"""
661-
Update a Benchmark with a set of Scenarios.
664+
"""Update a Benchmark.
665+
666+
Fields that are null will preserve the existing value.
667+
Fields that are provided (including empty values) will replace the existing
668+
value entirely.
662669
663670
Args:
664-
name: The name of the Benchmark. This must be unique.
671+
attribution: Attribution information for the benchmark. Pass in empty string to clear.
665672
666-
attribution: Attribution information for the benchmark.
673+
description: Detailed description of the benchmark. Pass in empty string to clear.
667674
668-
description: Detailed description of the benchmark.
675+
metadata: User defined metadata to attach to the benchmark. Pass in empty map to clear.
669676
670-
metadata: User defined metadata to attach to the benchmark for organization.
677+
name: The unique name of the Benchmark. Cannot be blank.
671678
672679
required_environment_variables: Environment variables required to run the benchmark. If any required variables
673-
are not supplied, the benchmark will fail to start
680+
are not supplied, the benchmark will fail to start. Pass in empty list to clear.
674681
675682
required_secret_names: Secrets required to run the benchmark with (environment variable name will be
676683
mapped to the your user secret by name). If any of these secrets are not
677-
provided or the mapping is incorrect, the benchmark will fail to start.
684+
provided or the mapping is incorrect, the benchmark will fail to start. Pass in
685+
empty list to clear.
678686
679-
scenario_ids: The Scenario IDs that make up the Benchmark.
687+
scenario_ids: The Scenario IDs that make up the Benchmark. Pass in empty list to clear.
680688
681689
extra_headers: Send extra headers
682690
@@ -694,10 +702,10 @@ async def update(
694702
f"/v1/benchmarks/{id}",
695703
body=await async_maybe_transform(
696704
{
697-
"name": name,
698705
"attribution": attribution,
699706
"description": description,
700707
"metadata": metadata,
708+
"name": name,
701709
"required_environment_variables": required_environment_variables,
702710
"required_secret_names": required_secret_names,
703711
"scenario_ids": scenario_ids,

src/runloop_api_client/resources/scenarios/scenarios.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -221,31 +221,32 @@ def update(
221221
timeout: float | httpx.Timeout | None | NotGiven = not_given,
222222
idempotency_key: str | None = None,
223223
) -> ScenarioView:
224-
"""
225-
Update a Scenario, a repeatable AI coding evaluation test that defines the
226-
starting environment as well as evaluation success criteria. Only provided
227-
fields will be updated.
224+
"""Update a Scenario.
225+
226+
Fields that are null will preserve the existing value. Fields
227+
that are provided (including empty values) will replace the existing value
228+
entirely.
228229
229230
Args:
230231
environment_parameters: The Environment in which the Scenario will run.
231232
232233
input_context: The input context for the Scenario.
233234
234-
metadata: User defined metadata to attach to the scenario for organization.
235+
metadata: User defined metadata to attach to the scenario. Pass in empty map to clear.
235236
236-
name: Name of the scenario.
237+
name: Name of the scenario. Cannot be blank.
237238
238239
reference_output: A string representation of the reference output to solve the scenario. Commonly
239240
can be the result of a git diff or a sequence of command actions to apply to the
240-
environment.
241+
environment. Pass in empty string to clear.
241242
242-
required_environment_variables: Environment variables required to run the scenario.
243+
required_environment_variables: Environment variables required to run the scenario. Pass in empty list to clear.
243244
244-
required_secret_names: Secrets required to run the scenario.
245+
required_secret_names: Secrets required to run the scenario. Pass in empty list to clear.
245246
246247
scoring_contract: The scoring contract for the Scenario.
247248
248-
validation_type: Validation strategy.
249+
validation_type: Validation strategy. Pass in empty string to clear.
249250
250251
extra_headers: Send extra headers
251252
@@ -682,31 +683,32 @@ async def update(
682683
timeout: float | httpx.Timeout | None | NotGiven = not_given,
683684
idempotency_key: str | None = None,
684685
) -> ScenarioView:
685-
"""
686-
Update a Scenario, a repeatable AI coding evaluation test that defines the
687-
starting environment as well as evaluation success criteria. Only provided
688-
fields will be updated.
686+
"""Update a Scenario.
687+
688+
Fields that are null will preserve the existing value. Fields
689+
that are provided (including empty values) will replace the existing value
690+
entirely.
689691
690692
Args:
691693
environment_parameters: The Environment in which the Scenario will run.
692694
693695
input_context: The input context for the Scenario.
694696
695-
metadata: User defined metadata to attach to the scenario for organization.
697+
metadata: User defined metadata to attach to the scenario. Pass in empty map to clear.
696698
697-
name: Name of the scenario.
699+
name: Name of the scenario. Cannot be blank.
698700
699701
reference_output: A string representation of the reference output to solve the scenario. Commonly
700702
can be the result of a git diff or a sequence of command actions to apply to the
701-
environment.
703+
environment. Pass in empty string to clear.
702704
703-
required_environment_variables: Environment variables required to run the scenario.
705+
required_environment_variables: Environment variables required to run the scenario. Pass in empty list to clear.
704706
705-
required_secret_names: Secrets required to run the scenario.
707+
required_secret_names: Secrets required to run the scenario. Pass in empty list to clear.
706708
707709
scoring_contract: The scoring contract for the Scenario.
708710
709-
validation_type: Validation strategy.
711+
validation_type: Validation strategy. Pass in empty string to clear.
710712
711713
extra_headers: Send extra headers
712714

src/runloop_api_client/types/benchmark_create_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class BenchmarkCreateParams(TypedDict, total=False):
1414
name: Required[str]
15-
"""The name of the Benchmark. This must be unique."""
15+
"""The unique name of the Benchmark."""
1616

1717
attribution: Optional[str]
1818
"""Attribution information for the benchmark."""
@@ -21,12 +21,12 @@ class BenchmarkCreateParams(TypedDict, total=False):
2121
"""Detailed description of the benchmark."""
2222

2323
metadata: Optional[Dict[str, str]]
24-
"""User defined metadata to attach to the benchmark for organization."""
24+
"""User defined metadata to attach to the benchmark."""
2525

2626
required_environment_variables: Optional[SequenceNotStr[str]]
2727
"""Environment variables required to run the benchmark.
2828
29-
If any required variables are not supplied, the benchmark will fail to start
29+
If any required variables are not supplied, the benchmark will fail to start.
3030
"""
3131

3232
required_secret_names: SequenceNotStr[str]

src/runloop_api_client/types/benchmark_update_params.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,40 @@
33
from __future__ import annotations
44

55
from typing import Dict, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import TypedDict
77

88
from .._types import SequenceNotStr
99

1010
__all__ = ["BenchmarkUpdateParams"]
1111

1212

1313
class BenchmarkUpdateParams(TypedDict, total=False):
14-
name: Required[str]
15-
"""The name of the Benchmark. This must be unique."""
16-
1714
attribution: Optional[str]
18-
"""Attribution information for the benchmark."""
15+
"""Attribution information for the benchmark. Pass in empty string to clear."""
1916

2017
description: Optional[str]
21-
"""Detailed description of the benchmark."""
18+
"""Detailed description of the benchmark. Pass in empty string to clear."""
2219

2320
metadata: Optional[Dict[str, str]]
24-
"""User defined metadata to attach to the benchmark for organization."""
21+
"""User defined metadata to attach to the benchmark. Pass in empty map to clear."""
22+
23+
name: Optional[str]
24+
"""The unique name of the Benchmark. Cannot be blank."""
2525

2626
required_environment_variables: Optional[SequenceNotStr[str]]
2727
"""Environment variables required to run the benchmark.
2828
29-
If any required variables are not supplied, the benchmark will fail to start
29+
If any required variables are not supplied, the benchmark will fail to start.
30+
Pass in empty list to clear.
3031
"""
3132

32-
required_secret_names: SequenceNotStr[str]
33+
required_secret_names: Optional[SequenceNotStr[str]]
3334
"""
3435
Secrets required to run the benchmark with (environment variable name will be
3536
mapped to the your user secret by name). If any of these secrets are not
36-
provided or the mapping is incorrect, the benchmark will fail to start.
37+
provided or the mapping is incorrect, the benchmark will fail to start. Pass in
38+
empty list to clear.
3739
"""
3840

3941
scenario_ids: Optional[SequenceNotStr[str]]
40-
"""The Scenario IDs that make up the Benchmark."""
42+
"""The Scenario IDs that make up the Benchmark. Pass in empty list to clear."""

src/runloop_api_client/types/scenario_update_params.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,29 @@ class ScenarioUpdateParams(TypedDict, total=False):
2121
"""The input context for the Scenario."""
2222

2323
metadata: Optional[Dict[str, str]]
24-
"""User defined metadata to attach to the scenario for organization."""
24+
"""User defined metadata to attach to the scenario. Pass in empty map to clear."""
2525

2626
name: Optional[str]
27-
"""Name of the scenario."""
27+
"""Name of the scenario. Cannot be blank."""
2828

2929
reference_output: Optional[str]
3030
"""A string representation of the reference output to solve the scenario.
3131
3232
Commonly can be the result of a git diff or a sequence of command actions to
33-
apply to the environment.
33+
apply to the environment. Pass in empty string to clear.
3434
"""
3535

3636
required_environment_variables: Optional[SequenceNotStr[str]]
37-
"""Environment variables required to run the scenario."""
37+
"""Environment variables required to run the scenario.
38+
39+
Pass in empty list to clear.
40+
"""
3841

3942
required_secret_names: Optional[SequenceNotStr[str]]
40-
"""Secrets required to run the scenario."""
43+
"""Secrets required to run the scenario. Pass in empty list to clear."""
4144

4245
scoring_contract: Optional[ScoringContractUpdateParam]
4346
"""The scoring contract for the Scenario."""
4447

4548
validation_type: Optional[Literal["UNSPECIFIED", "FORWARD", "REVERSE", "EVALUATION"]]
46-
"""Validation strategy."""
49+
"""Validation strategy. Pass in empty string to clear."""

0 commit comments

Comments
 (0)