Skip to content

feat(api): api update #555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 77
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-cb8add05a7b418d6f8a5624be8477564853da49e8bf9671ae89b8ce49a04b6cd.yml
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ccbc7c04012cbcca678f13e39f66bb770b8b3a9d6f1815ce1b9c20fee099128.yml
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Methods:

- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand Down
157 changes: 157 additions & 0 deletions src/runloop_api_client/resources/scenarios/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from ...types import (
scenario_list_params,
scenario_create_params,
scenario_update_params,
scenario_start_run_params,
scenario_list_public_params,
)
Expand Down Expand Up @@ -182,6 +183,78 @@ def retrieve(
cast_to=ScenarioView,
)

def update(
self,
id: str,
*,
input_context: InputContextParam,
name: str,
scoring_contract: ScoringContractParam,
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioView:
"""
Update a Scenario, a repeatable AI coding evaluation test that defines the
starting environment as well as evaluation success criteria.

Args:
input_context: The input context for the Scenario.

name: Name of the scenario.

scoring_contract: The scoring contract for the Scenario.

environment_parameters: The Environment in which the Scenario will run.

metadata: User defined metadata to attach to the scenario for organization.

reference_output: A string representation of the reference output to solve the scenario. Commonly
can be the result of a git diff or a sequence of command actions to apply to the
environment.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
f"/v1/scenarios/{id}",
body=maybe_transform(
{
"input_context": input_context,
"name": name,
"scoring_contract": scoring_contract,
"environment_parameters": environment_parameters,
"metadata": metadata,
"reference_output": reference_output,
},
scenario_update_params.ScenarioUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=ScenarioView,
)

def list(
self,
*,
Expand Down Expand Up @@ -474,6 +547,78 @@ async def retrieve(
cast_to=ScenarioView,
)

async def update(
self,
id: str,
*,
input_context: InputContextParam,
name: str,
scoring_contract: ScoringContractParam,
environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
reference_output: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioView:
"""
Update a Scenario, a repeatable AI coding evaluation test that defines the
starting environment as well as evaluation success criteria.

Args:
input_context: The input context for the Scenario.

name: Name of the scenario.

scoring_contract: The scoring contract for the Scenario.

environment_parameters: The Environment in which the Scenario will run.

metadata: User defined metadata to attach to the scenario for organization.

reference_output: A string representation of the reference output to solve the scenario. Commonly
can be the result of a git diff or a sequence of command actions to apply to the
environment.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
f"/v1/scenarios/{id}",
body=await async_maybe_transform(
{
"input_context": input_context,
"name": name,
"scoring_contract": scoring_contract,
"environment_parameters": environment_parameters,
"metadata": metadata,
"reference_output": reference_output,
},
scenario_update_params.ScenarioUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=ScenarioView,
)

def list(
self,
*,
Expand Down Expand Up @@ -646,6 +791,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
self.retrieve = to_raw_response_wrapper(
scenarios.retrieve,
)
self.update = to_raw_response_wrapper(
scenarios.update,
)
self.list = to_raw_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -675,6 +823,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
self.retrieve = async_to_raw_response_wrapper(
scenarios.retrieve,
)
self.update = async_to_raw_response_wrapper(
scenarios.update,
)
self.list = async_to_raw_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -704,6 +855,9 @@ def __init__(self, scenarios: ScenariosResource) -> None:
self.retrieve = to_streamed_response_wrapper(
scenarios.retrieve,
)
self.update = to_streamed_response_wrapper(
scenarios.update,
)
self.list = to_streamed_response_wrapper(
scenarios.list,
)
Expand Down Expand Up @@ -733,6 +887,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None:
self.retrieve = async_to_streamed_response_wrapper(
scenarios.retrieve,
)
self.update = async_to_streamed_response_wrapper(
scenarios.update,
)
self.list = async_to_streamed_response_wrapper(
scenarios.list,
)
Expand Down
1 change: 1 addition & 0 deletions src/runloop_api_client/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from .repository_list_params import RepositoryListParams as RepositoryListParams
from .scenario_create_params import ScenarioCreateParams as ScenarioCreateParams
from .scenario_run_list_view import ScenarioRunListView as ScenarioRunListView
from .scenario_update_params import ScenarioUpdateParams as ScenarioUpdateParams
from .scoring_contract_param import ScoringContractParam as ScoringContractParam
from .scoring_function_param import ScoringFunctionParam as ScoringFunctionParam
from .benchmark_create_params import BenchmarkCreateParams as BenchmarkCreateParams
Expand Down
36 changes: 36 additions & 0 deletions src/runloop_api_client/types/scenario_update_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, Optional
from typing_extensions import Required, TypedDict

from .input_context_param import InputContextParam
from .scoring_contract_param import ScoringContractParam
from .scenario_environment_param import ScenarioEnvironmentParam

__all__ = ["ScenarioUpdateParams"]


class ScenarioUpdateParams(TypedDict, total=False):
input_context: Required[InputContextParam]
"""The input context for the Scenario."""

name: Required[str]
"""Name of the scenario."""

scoring_contract: Required[ScoringContractParam]
"""The scoring contract for the Scenario."""

environment_parameters: Optional[ScenarioEnvironmentParam]
"""The Environment in which the Scenario will run."""

metadata: Optional[Dict[str, str]]
"""User defined metadata to attach to the scenario for organization."""

reference_output: Optional[str]
"""A string representation of the reference output to solve the scenario.

Commonly can be the result of a git diff or a sequence of command actions to
apply to the environment.
"""
2 changes: 1 addition & 1 deletion src/runloop_api_client/types/scoring_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ScoringFunction(BaseModel):
"""

weight: float
"""Wight to apply to scoring function score.
"""Weight to apply to scoring function score.

Weights of all scoring functions should sum to 1.0.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/types/scoring_function_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ScoringFunctionParam(TypedDict, total=False):
"""

weight: Required[float]
"""Wight to apply to scoring function score.
"""Weight to apply to scoring function score.

Weights of all scoring functions should sum to 1.0.
"""
Expand Down
Loading