Skip to content

feat(api): api update #573

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
Mar 21, 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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ccbc7c04012cbcca678f13e39f66bb770b8b3a9d6f1815ce1b9c20fee099128.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1c6045460c43f65b30ffcef9f707e8d71dca568bf8d208347a6046a6f03ff239.yml
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ blueprint_view = client.blueprints.create(
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down
12 changes: 8 additions & 4 deletions src/runloop_api_client/resources/scenarios/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ def complete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioRunView:
"""
Complete a currently running ScenarioRun.
"""Complete a currently running ScenarioRun.

Calling complete will shutdown
underlying Devbox resource.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -323,8 +325,10 @@ async def complete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> ScenarioRunView:
"""
Complete a currently running ScenarioRun.
"""Complete a currently running ScenarioRun.

Calling complete will shutdown
underlying Devbox resource.

Args:
extra_headers: Send extra headers
Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/benchmark_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class BenchmarkListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/benchmark_run_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class BenchmarkRunListView(BaseModel):
has_more: bool

remaining_count: int

runs: List[BenchmarkRunView]
"""List of BenchmarkRuns matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/blueprint_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class BlueprintListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/devbox_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ class DevboxListView(BaseModel):

has_more: bool

remaining_count: int

total_count: int
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/devbox_snapshot_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class DevboxSnapshotListView(BaseModel):
has_more: bool

remaining_count: int

snapshots: List[DevboxSnapshotView]
"""List of snapshots matching filter."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class RepositoryConnectionListView(BaseModel):
has_more: bool

remaining_count: int

repositories: List[RepositoryConnectionView]
"""List of repositories matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/scenario_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class ScenarioListView(BaseModel):
has_more: bool

remaining_count: int

scenarios: List[ScenarioView]
"""List of Scenarios matching filter."""

Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/scenario_run_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
class ScenarioRunListView(BaseModel):
has_more: bool

remaining_count: int

runs: List[ScenarioRunView]
"""List of ScenarioRuns matching filter."""

Expand Down
22 changes: 3 additions & 19 deletions src/runloop_api_client/types/scoring_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional

from .._models import BaseModel

Expand All @@ -11,29 +10,14 @@ class ScoringFunction(BaseModel):
name: str
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""

type: str
"""Type of the scoring function.
scoring_function: ScoringFunction
"""The scoring function to use for evaluating this scenario.

Use 'bash' as type and fill out 'bash_script' field for scoring via custom bash
scripts. Otherwise use a type corresponding to a custom scorer function or a
public Runloop scorer type.
The type field determines which built-in function to use.
"""

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

Weights of all scoring functions should sum to 1.0.
"""

bash_script: Optional[str] = None
"""
A single bash script that sets up the environment, scores, and prints the final
score to standard out. Score should be a float between 0.0 and 1.0, and look
like "score=[0.0..1.0].
"""

scorer_params: Optional[object] = None
"""
Additional JSON structured context to pass to the scoring function if using
custom scorer.
"""
119 changes: 100 additions & 19 deletions src/runloop_api_client/types/scoring_function_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,120 @@

from __future__ import annotations

from typing import Optional
from typing_extensions import Required, TypedDict
from typing import Union, Iterable, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict

__all__ = ["ScoringFunctionParam"]
__all__ = [
"ScoringFunctionParam",
"ScoringFunction",
"ScoringFunctionAstGrepScoringFunction",
"ScoringFunctionBashScriptScoringFunction",
"ScoringFunctionCommandScoringFunction",
"ScoringFunctionCustomScoringFunction",
"ScoringFunctionPythonScriptScoringFunction",
"ScoringFunctionTestBasedScoringFunction",
"ScoringFunctionTestBasedScoringFunctionTestFile",
]


class ScoringFunctionParam(TypedDict, total=False):
name: Required[str]
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""
class ScoringFunctionAstGrepScoringFunction(TypedDict, total=False):
pattern: Required[str]
"""AST pattern to match."""

type: Required[str]
"""Type of the scoring function.
search_directory: Required[str]
"""The path to search."""

Use 'bash' as type and fill out 'bash_script' field for scoring via custom bash
scripts. Otherwise use a type corresponding to a custom scorer function or a
public Runloop scorer type.
"""
type: Required[Literal["ast_grep_scorer"]]

weight: Required[float]
"""Weight to apply to scoring function score.
lang: str
"""The language of the pattern."""

Weights of all scoring functions should sum to 1.0.
"""

bash_script: Optional[str]
class ScoringFunctionBashScriptScoringFunction(TypedDict, total=False):
type: Required[Literal["bash_script_scorer"]]

bash_script: str
"""
A single bash script that sets up the environment, scores, and prints the final
score to standard out. Score should be a float between 0.0 and 1.0, and look
like "score=[0.0..1.0].
"""


class ScoringFunctionCommandScoringFunction(TypedDict, total=False):
type: Required[Literal["command_scorer"]]

command: str
"""The command to execute."""


class ScoringFunctionCustomScoringFunction(TypedDict, total=False):
type: Required[Literal["custom_scorer"]]

scorer_params: Optional[object]
"""Additional JSON structured context to pass to the scoring function."""


class ScoringFunctionPythonScriptScoringFunction(TypedDict, total=False):
python_script: Required[str]
"""Python script to be run.

The script should output the score to standard out as a float between 0.0 and
1.0.
"""
Additional JSON structured context to pass to the scoring function if using
custom scorer.

type: Required[Literal["python_script_scorer"]]

requirements_contents: str
"""Package dependencies to be installed.

The requirements should be a valid requirements.txt file.
"""


class ScoringFunctionTestBasedScoringFunctionTestFile(TypedDict, total=False):
file_contents: str
"""Content of the test file"""

file_path: str
"""
Path to write content of the test file, relative to your environment's working
directory
"""


class ScoringFunctionTestBasedScoringFunction(TypedDict, total=False):
type: Required[Literal["test_based_scorer"]]

test_command: str
"""The command to execute for running the tests"""

test_files: Iterable[ScoringFunctionTestBasedScoringFunctionTestFile]
"""List of test files to create"""


ScoringFunction: TypeAlias = Union[
ScoringFunctionAstGrepScoringFunction,
ScoringFunctionBashScriptScoringFunction,
ScoringFunctionCommandScoringFunction,
ScoringFunctionCustomScoringFunction,
ScoringFunctionPythonScriptScoringFunction,
ScoringFunctionTestBasedScoringFunction,
]


class ScoringFunctionParam(TypedDict, total=False):
name: Required[str]
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""

scoring_function: Required[ScoringFunction]
"""The scoring function to use for evaluating this scenario.

The type field determines which built-in function to use.
"""

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

Weights of all scoring functions should sum to 1.0.
"""
6 changes: 6 additions & 0 deletions src/runloop_api_client/types/shared/launch_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class LaunchParameters(BaseModel):
'createTunnel' API.
"""

custom_cpu_cores: Optional[int] = None
"""custom resource size, number of cpu cores, must be multiple of 2."""

custom_gb_memory: Optional[int] = None
"""custom memory size, number in Gi, must be a multiple of 2."""

keep_alive_time_seconds: Optional[int] = None
"""Time in seconds after which Devbox will automatically shutdown.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class LaunchParameters(TypedDict, total=False):
'createTunnel' API.
"""

custom_cpu_cores: Optional[int]
"""custom resource size, number of cpu cores, must be multiple of 2."""

custom_gb_memory: Optional[int]
"""custom memory size, number in Gi, must be a multiple of 2."""

keep_alive_time_seconds: Optional[int]
"""Time in seconds after which Devbox will automatically shutdown.

Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/scenarios/test_scorers.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def test_method_validate_with_all_params(self, client: Runloop) -> None:
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down Expand Up @@ -417,6 +419,8 @@ async def test_method_validate_with_all_params(self, async_client: AsyncRunloop)
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down
8 changes: 8 additions & 0 deletions tests/api_resources/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down Expand Up @@ -218,6 +220,8 @@ def test_method_preview_with_all_params(self, client: Runloop) -> None:
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down Expand Up @@ -281,6 +285,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down Expand Up @@ -450,6 +456,8 @@ async def test_method_preview_with_all_params(self, async_client: AsyncRunloop)
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/test_devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down Expand Up @@ -938,6 +940,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
"on_idle": "shutdown",
},
"available_ports": [0],
"custom_cpu_cores": 0,
"custom_gb_memory": 0,
"keep_alive_time_seconds": 0,
"launch_commands": ["string"],
"resource_size_request": "SMALL",
Expand Down
Loading