diff --git a/.stats.yml b/.stats.yml index 08c183bf..4dd4711f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/README.md b/README.md index 1446a6a4..ec6ee93f 100644 --- a/README.md +++ b/README.md @@ -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", diff --git a/src/runloop_api_client/resources/scenarios/runs.py b/src/runloop_api_client/resources/scenarios/runs.py index 94b450a3..d140ecdb 100644 --- a/src/runloop_api_client/resources/scenarios/runs.py +++ b/src/runloop_api_client/resources/scenarios/runs.py @@ -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 @@ -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 diff --git a/src/runloop_api_client/types/benchmark_list_view.py b/src/runloop_api_client/types/benchmark_list_view.py index 40ebd65d..22500284 100644 --- a/src/runloop_api_client/types/benchmark_list_view.py +++ b/src/runloop_api_client/types/benchmark_list_view.py @@ -14,4 +14,6 @@ class BenchmarkListView(BaseModel): has_more: bool + remaining_count: int + total_count: int diff --git a/src/runloop_api_client/types/benchmark_run_list_view.py b/src/runloop_api_client/types/benchmark_run_list_view.py index 4a8a1fda..0d0ca11e 100644 --- a/src/runloop_api_client/types/benchmark_run_list_view.py +++ b/src/runloop_api_client/types/benchmark_run_list_view.py @@ -11,6 +11,8 @@ class BenchmarkRunListView(BaseModel): has_more: bool + remaining_count: int + runs: List[BenchmarkRunView] """List of BenchmarkRuns matching filter.""" diff --git a/src/runloop_api_client/types/blueprint_list_view.py b/src/runloop_api_client/types/blueprint_list_view.py index 57f845c9..ba7c6066 100644 --- a/src/runloop_api_client/types/blueprint_list_view.py +++ b/src/runloop_api_client/types/blueprint_list_view.py @@ -14,4 +14,6 @@ class BlueprintListView(BaseModel): has_more: bool + remaining_count: int + total_count: int diff --git a/src/runloop_api_client/types/devbox_list_view.py b/src/runloop_api_client/types/devbox_list_view.py index 332b737f..f4f26624 100644 --- a/src/runloop_api_client/types/devbox_list_view.py +++ b/src/runloop_api_client/types/devbox_list_view.py @@ -14,4 +14,6 @@ class DevboxListView(BaseModel): has_more: bool + remaining_count: int + total_count: int diff --git a/src/runloop_api_client/types/devbox_snapshot_list_view.py b/src/runloop_api_client/types/devbox_snapshot_list_view.py index 6bb1eb53..3e687f0c 100644 --- a/src/runloop_api_client/types/devbox_snapshot_list_view.py +++ b/src/runloop_api_client/types/devbox_snapshot_list_view.py @@ -11,6 +11,8 @@ class DevboxSnapshotListView(BaseModel): has_more: bool + remaining_count: int + snapshots: List[DevboxSnapshotView] """List of snapshots matching filter.""" diff --git a/src/runloop_api_client/types/repository_connection_list_view.py b/src/runloop_api_client/types/repository_connection_list_view.py index 4ad5a10e..8085c471 100644 --- a/src/runloop_api_client/types/repository_connection_list_view.py +++ b/src/runloop_api_client/types/repository_connection_list_view.py @@ -11,6 +11,8 @@ class RepositoryConnectionListView(BaseModel): has_more: bool + remaining_count: int + repositories: List[RepositoryConnectionView] """List of repositories matching filter.""" diff --git a/src/runloop_api_client/types/scenario_list_view.py b/src/runloop_api_client/types/scenario_list_view.py index 9afe534c..b1127264 100644 --- a/src/runloop_api_client/types/scenario_list_view.py +++ b/src/runloop_api_client/types/scenario_list_view.py @@ -11,6 +11,8 @@ class ScenarioListView(BaseModel): has_more: bool + remaining_count: int + scenarios: List[ScenarioView] """List of Scenarios matching filter.""" diff --git a/src/runloop_api_client/types/scenario_run_list_view.py b/src/runloop_api_client/types/scenario_run_list_view.py index 73494f84..db0d16d3 100644 --- a/src/runloop_api_client/types/scenario_run_list_view.py +++ b/src/runloop_api_client/types/scenario_run_list_view.py @@ -11,6 +11,8 @@ class ScenarioRunListView(BaseModel): has_more: bool + remaining_count: int + runs: List[ScenarioRunView] """List of ScenarioRuns matching filter.""" diff --git a/src/runloop_api_client/types/scoring_function.py b/src/runloop_api_client/types/scoring_function.py index f7a2a6e0..e3eddf55 100644 --- a/src/runloop_api_client/types/scoring_function.py +++ b/src/runloop_api_client/types/scoring_function.py @@ -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 @@ -11,12 +10,10 @@ 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 @@ -24,16 +21,3 @@ class ScoringFunction(BaseModel): 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. - """ diff --git a/src/runloop_api_client/types/scoring_function_param.py b/src/runloop_api_client/types/scoring_function_param.py index 5bcbacc5..264bf612 100644 --- a/src/runloop_api_client/types/scoring_function_param.py +++ b/src/runloop_api_client/types/scoring_function_param.py @@ -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. """ diff --git a/src/runloop_api_client/types/shared/launch_parameters.py b/src/runloop_api_client/types/shared/launch_parameters.py index 5113a18a..6a93c7ef 100644 --- a/src/runloop_api_client/types/shared/launch_parameters.py +++ b/src/runloop_api_client/types/shared/launch_parameters.py @@ -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. diff --git a/src/runloop_api_client/types/shared_params/launch_parameters.py b/src/runloop_api_client/types/shared_params/launch_parameters.py index 320fa92d..549b3dba 100644 --- a/src/runloop_api_client/types/shared_params/launch_parameters.py +++ b/src/runloop_api_client/types/shared_params/launch_parameters.py @@ -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. diff --git a/tests/api_resources/scenarios/test_scorers.py b/tests/api_resources/scenarios/test_scorers.py index 4c04211d..f848d879 100644 --- a/tests/api_resources/scenarios/test_scorers.py +++ b/tests/api_resources/scenarios/test_scorers.py @@ -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", @@ -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", diff --git a/tests/api_resources/test_blueprints.py b/tests/api_resources/test_blueprints.py index 0fc433db..5a9fc89e 100644 --- a/tests/api_resources/test_blueprints.py +++ b/tests/api_resources/test_blueprints.py @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index e3faa298..ce6638c0 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -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", @@ -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", diff --git a/tests/api_resources/test_scenarios.py b/tests/api_resources/test_scenarios.py index 218ebb54..8977f886 100644 --- a/tests/api_resources/test_scenarios.py +++ b/tests/api_resources/test_scenarios.py @@ -30,7 +30,11 @@ def test_method_create(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -50,10 +54,13 @@ def test_method_create_with_all_params(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + "lang": "lang", + }, "weight": 0, - "bash_script": "bash_script", - "scorer_params": {}, } ] }, @@ -65,6 +72,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", @@ -87,7 +96,11 @@ def test_raw_response_create(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -108,7 +121,11 @@ def test_streaming_response_create(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -170,7 +187,11 @@ def test_method_update(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -191,10 +212,13 @@ def test_method_update_with_all_params(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + "lang": "lang", + }, "weight": 0, - "bash_script": "bash_script", - "scorer_params": {}, } ] }, @@ -206,6 +230,8 @@ def test_method_update_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", @@ -229,7 +255,11 @@ def test_raw_response_update(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -251,7 +281,11 @@ def test_streaming_response_update(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -276,7 +310,11 @@ def test_path_params_update(self, client: Runloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -405,7 +443,11 @@ async def test_method_create(self, async_client: AsyncRunloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -425,10 +467,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) - "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + "lang": "lang", + }, "weight": 0, - "bash_script": "bash_script", - "scorer_params": {}, } ] }, @@ -440,6 +485,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", @@ -462,7 +509,11 @@ async def test_raw_response_create(self, async_client: AsyncRunloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -483,7 +534,11 @@ async def test_streaming_response_create(self, async_client: AsyncRunloop) -> No "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -545,7 +600,11 @@ async def test_method_update(self, async_client: AsyncRunloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -566,10 +625,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncRunloop) - "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + "lang": "lang", + }, "weight": 0, - "bash_script": "bash_script", - "scorer_params": {}, } ] }, @@ -581,6 +643,8 @@ async def test_method_update_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", @@ -604,7 +668,11 @@ async def test_raw_response_update(self, async_client: AsyncRunloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -626,7 +694,11 @@ async def test_streaming_response_update(self, async_client: AsyncRunloop) -> No "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ] @@ -651,7 +723,11 @@ async def test_path_params_update(self, async_client: AsyncRunloop) -> None: "scoring_function_parameters": [ { "name": "name", - "type": "type", + "scoring_function": { + "pattern": "pattern", + "search_directory": "search_directory", + "type": "ast_grep_scorer", + }, "weight": 0, } ]