Skip to content

Commit cf64ada

Browse files
feat(api): api update (#555)
1 parent 3139fbf commit cf64ada

8 files changed

Lines changed: 445 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 77
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-cb8add05a7b418d6f8a5624be8477564853da49e8bf9671ae89b8ce49a04b6cd.yml
1+
configured_endpoints: 78
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ccbc7c04012cbcca678f13e39f66bb770b8b3a9d6f1815ce1b9c20fee099128.yml

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Methods:
278278

279279
- <code title="post /v1/scenarios">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">create</a>(\*\*<a href="src/runloop_api_client/types/scenario_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
280280
- <code title="get /v1/scenarios/{id}">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
281+
- <code title="post /v1/scenarios/{id}">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">update</a>(id, \*\*<a href="src/runloop_api_client/types/scenario_update_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">ScenarioView</a></code>
281282
- <code title="get /v1/scenarios">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">list</a>(\*\*<a href="src/runloop_api_client/types/scenario_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">SyncScenariosCursorIDPage[ScenarioView]</a></code>
282283
- <code title="get /v1/scenarios/list_public">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">list_public</a>(\*\*<a href="src/runloop_api_client/types/scenario_list_public_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_view.py">SyncScenariosCursorIDPage[ScenarioView]</a></code>
283284
- <code title="post /v1/scenarios/start_run">client.scenarios.<a href="./src/runloop_api_client/resources/scenarios/scenarios.py">start_run</a>(\*\*<a href="src/runloop_api_client/types/scenario_start_run_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_run_view.py">ScenarioRunView</a></code>

src/runloop_api_client/resources/scenarios/scenarios.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ...types import (
1818
scenario_list_params,
1919
scenario_create_params,
20+
scenario_update_params,
2021
scenario_start_run_params,
2122
scenario_list_public_params,
2223
)
@@ -182,6 +183,78 @@ def retrieve(
182183
cast_to=ScenarioView,
183184
)
184185

186+
def update(
187+
self,
188+
id: str,
189+
*,
190+
input_context: InputContextParam,
191+
name: str,
192+
scoring_contract: ScoringContractParam,
193+
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
194+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
195+
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
196+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
197+
# The extra values given here take precedence over values defined on the client or passed to this method.
198+
extra_headers: Headers | None = None,
199+
extra_query: Query | None = None,
200+
extra_body: Body | None = None,
201+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
202+
idempotency_key: str | None = None,
203+
) -> ScenarioView:
204+
"""
205+
Update a Scenario, a repeatable AI coding evaluation test that defines the
206+
starting environment as well as evaluation success criteria.
207+
208+
Args:
209+
input_context: The input context for the Scenario.
210+
211+
name: Name of the scenario.
212+
213+
scoring_contract: The scoring contract for the Scenario.
214+
215+
environment_parameters: The Environment in which the Scenario will run.
216+
217+
metadata: User defined metadata to attach to the scenario for organization.
218+
219+
reference_output: A string representation of the reference output to solve the scenario. Commonly
220+
can be the result of a git diff or a sequence of command actions to apply to the
221+
environment.
222+
223+
extra_headers: Send extra headers
224+
225+
extra_query: Add additional query parameters to the request
226+
227+
extra_body: Add additional JSON properties to the request
228+
229+
timeout: Override the client-level default timeout for this request, in seconds
230+
231+
idempotency_key: Specify a custom idempotency key for this request
232+
"""
233+
if not id:
234+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
235+
return self._post(
236+
f"/v1/scenarios/{id}",
237+
body=maybe_transform(
238+
{
239+
"input_context": input_context,
240+
"name": name,
241+
"scoring_contract": scoring_contract,
242+
"environment_parameters": environment_parameters,
243+
"metadata": metadata,
244+
"reference_output": reference_output,
245+
},
246+
scenario_update_params.ScenarioUpdateParams,
247+
),
248+
options=make_request_options(
249+
extra_headers=extra_headers,
250+
extra_query=extra_query,
251+
extra_body=extra_body,
252+
timeout=timeout,
253+
idempotency_key=idempotency_key,
254+
),
255+
cast_to=ScenarioView,
256+
)
257+
185258
def list(
186259
self,
187260
*,
@@ -474,6 +547,78 @@ async def retrieve(
474547
cast_to=ScenarioView,
475548
)
476549

550+
async def update(
551+
self,
552+
id: str,
553+
*,
554+
input_context: InputContextParam,
555+
name: str,
556+
scoring_contract: ScoringContractParam,
557+
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
558+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
559+
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
560+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
561+
# The extra values given here take precedence over values defined on the client or passed to this method.
562+
extra_headers: Headers | None = None,
563+
extra_query: Query | None = None,
564+
extra_body: Body | None = None,
565+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
566+
idempotency_key: str | None = None,
567+
) -> ScenarioView:
568+
"""
569+
Update a Scenario, a repeatable AI coding evaluation test that defines the
570+
starting environment as well as evaluation success criteria.
571+
572+
Args:
573+
input_context: The input context for the Scenario.
574+
575+
name: Name of the scenario.
576+
577+
scoring_contract: The scoring contract for the Scenario.
578+
579+
environment_parameters: The Environment in which the Scenario will run.
580+
581+
metadata: User defined metadata to attach to the scenario for organization.
582+
583+
reference_output: A string representation of the reference output to solve the scenario. Commonly
584+
can be the result of a git diff or a sequence of command actions to apply to the
585+
environment.
586+
587+
extra_headers: Send extra headers
588+
589+
extra_query: Add additional query parameters to the request
590+
591+
extra_body: Add additional JSON properties to the request
592+
593+
timeout: Override the client-level default timeout for this request, in seconds
594+
595+
idempotency_key: Specify a custom idempotency key for this request
596+
"""
597+
if not id:
598+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
599+
return await self._post(
600+
f"/v1/scenarios/{id}",
601+
body=await async_maybe_transform(
602+
{
603+
"input_context": input_context,
604+
"name": name,
605+
"scoring_contract": scoring_contract,
606+
"environment_parameters": environment_parameters,
607+
"metadata": metadata,
608+
"reference_output": reference_output,
609+
},
610+
scenario_update_params.ScenarioUpdateParams,
611+
),
612+
options=make_request_options(
613+
extra_headers=extra_headers,
614+
extra_query=extra_query,
615+
extra_body=extra_body,
616+
timeout=timeout,
617+
idempotency_key=idempotency_key,
618+
),
619+
cast_to=ScenarioView,
620+
)
621+
477622
def list(
478623
self,
479624
*,
@@ -646,6 +791,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
646791
self.retrieve = to_raw_response_wrapper(
647792
scenarios.retrieve,
648793
)
794+
self.update = to_raw_response_wrapper(
795+
scenarios.update,
796+
)
649797
self.list = to_raw_response_wrapper(
650798
scenarios.list,
651799
)
@@ -675,6 +823,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
675823
self.retrieve = async_to_raw_response_wrapper(
676824
scenarios.retrieve,
677825
)
826+
self.update = async_to_raw_response_wrapper(
827+
scenarios.update,
828+
)
678829
self.list = async_to_raw_response_wrapper(
679830
scenarios.list,
680831
)
@@ -704,6 +855,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
704855
self.retrieve = to_streamed_response_wrapper(
705856
scenarios.retrieve,
706857
)
858+
self.update = to_streamed_response_wrapper(
859+
scenarios.update,
860+
)
707861
self.list = to_streamed_response_wrapper(
708862
scenarios.list,
709863
)
@@ -733,6 +887,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
733887
self.retrieve = async_to_streamed_response_wrapper(
734888
scenarios.retrieve,
735889
)
890+
self.update = async_to_streamed_response_wrapper(
891+
scenarios.update,
892+
)
736893
self.list = async_to_streamed_response_wrapper(
737894
scenarios.list,
738895
)

src/runloop_api_client/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from .repository_list_params import RepositoryListParams as RepositoryListParams
3636
from .scenario_create_params import ScenarioCreateParams as ScenarioCreateParams
3737
from .scenario_run_list_view import ScenarioRunListView as ScenarioRunListView
38+
from .scenario_update_params import ScenarioUpdateParams as ScenarioUpdateParams
3839
from .scoring_contract_param import ScoringContractParam as ScoringContractParam
3940
from .scoring_function_param import ScoringFunctionParam as ScoringFunctionParam
4041
from .benchmark_create_params import BenchmarkCreateParams as BenchmarkCreateParams
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Dict, Optional
6+
from typing_extensions import Required, TypedDict
7+
8+
from .input_context_param import InputContextParam
9+
from .scoring_contract_param import ScoringContractParam
10+
from .scenario_environment_param import ScenarioEnvironmentParam
11+
12+
__all__ = ["ScenarioUpdateParams"]
13+
14+
15+
class ScenarioUpdateParams(TypedDict, total=False):
16+
input_context: Required[InputContextParam]
17+
"""The input context for the Scenario."""
18+
19+
name: Required[str]
20+
"""Name of the scenario."""
21+
22+
scoring_contract: Required[ScoringContractParam]
23+
"""The scoring contract for the Scenario."""
24+
25+
environment_parameters: Optional[ScenarioEnvironmentParam]
26+
"""The Environment in which the Scenario will run."""
27+
28+
metadata: Optional[Dict[str, str]]
29+
"""User defined metadata to attach to the scenario for organization."""
30+
31+
reference_output: Optional[str]
32+
"""A string representation of the reference output to solve the scenario.
33+
34+
Commonly can be the result of a git diff or a sequence of command actions to
35+
apply to the environment.
36+
"""

src/runloop_api_client/types/scoring_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ScoringFunction(BaseModel):
2020
"""
2121

2222
weight: float
23-
"""Wight to apply to scoring function score.
23+
"""Weight to apply to scoring function score.
2424
2525
Weights of all scoring functions should sum to 1.0.
2626
"""

src/runloop_api_client/types/scoring_function_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ScoringFunctionParam(TypedDict, total=False):
2121
"""
2222

2323
weight: Required[float]
24-
"""Wight to apply to scoring function score.
24+
"""Weight to apply to scoring function score.
2525
2626
Weights of all scoring functions should sum to 1.0.
2727
"""

0 commit comments

Comments
 (0)