From 1c68520b90822af7d035acbf8b366a0c6492ec87 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 01:07:09 +0000 Subject: [PATCH 1/2] feat(api): api update (#515) --- .stats.yml | 2 +- api.md | 8 +- src/runloop_api_client/pagination.py | 236 ++++++++++++++++++ .../resources/benchmarks/benchmarks.py | 22 +- .../resources/benchmarks/runs.py | 27 +- .../resources/scenarios/runs.py | 27 +- .../resources/scenarios/scenarios.py | 30 ++- .../types/scenario_list_params.py | 3 + tests/api_resources/benchmarks/test_runs.py | 19 +- tests/api_resources/scenarios/test_runs.py | 19 +- tests/api_resources/test_benchmarks.py | 18 +- tests/api_resources/test_scenarios.py | 20 +- 12 files changed, 342 insertions(+), 89 deletions(-) diff --git a/.stats.yml b/.stats.yml index c25634d0b..c015e59e5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 66 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-bf4f1f241c2a3a425dc7d12b7b7e415133bb696682d1a285836d1a36b7bd6160.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8030b5a782144e97b4c813649da362416bd258f9a0bdd5d43b507c474d7f0bc0.yml diff --git a/api.md b/api.md index 8967b08eb..07c9163b5 100644 --- a/api.md +++ b/api.md @@ -23,7 +23,7 @@ Methods: - client.benchmarks.create(\*\*params) -> BenchmarkView - client.benchmarks.retrieve(id) -> BenchmarkView -- client.benchmarks.list(\*\*params) -> BenchmarkListView +- client.benchmarks.list(\*\*params) -> SyncBenchmarksCursorIDPage[BenchmarkView] - client.benchmarks.start_run(\*\*params) -> BenchmarkRunView ## Runs @@ -31,7 +31,7 @@ Methods: Methods: - client.benchmarks.runs.retrieve(id) -> BenchmarkRunView -- client.benchmarks.runs.list(\*\*params) -> BenchmarkRunListView +- client.benchmarks.runs.list(\*\*params) -> SyncBenchmarkRunsCursorIDPage[BenchmarkRunView] - client.benchmarks.runs.complete(id) -> BenchmarkRunView # Blueprints @@ -260,7 +260,7 @@ Methods: - client.scenarios.create(\*\*params) -> ScenarioView - client.scenarios.retrieve(id) -> ScenarioView -- client.scenarios.list(\*\*params) -> ScenarioListView +- client.scenarios.list(\*\*params) -> SyncScenariosCursorIDPage[ScenarioView] - client.scenarios.start_run(\*\*params) -> ScenarioRunView ## Runs @@ -268,7 +268,7 @@ Methods: Methods: - client.scenarios.runs.retrieve(id) -> ScenarioRunView -- client.scenarios.runs.list(\*\*params) -> ScenarioRunListView +- client.scenarios.runs.list(\*\*params) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView] - client.scenarios.runs.complete(id) -> ScenarioRunView - client.scenarios.runs.score(id) -> ScenarioRunView diff --git a/src/runloop_api_client/pagination.py b/src/runloop_api_client/pagination.py index 00f73e6a1..355e8e364 100644 --- a/src/runloop_api_client/pagination.py +++ b/src/runloop_api_client/pagination.py @@ -14,6 +14,14 @@ "AsyncRepositoriesCursorIDPage", "SyncDiskSnapshotsCursorIDPage", "AsyncDiskSnapshotsCursorIDPage", + "SyncBenchmarksCursorIDPage", + "AsyncBenchmarksCursorIDPage", + "SyncBenchmarkRunsCursorIDPage", + "AsyncBenchmarkRunsCursorIDPage", + "SyncScenariosCursorIDPage", + "AsyncScenariosCursorIDPage", + "SyncScenarioRunsCursorIDPage", + "AsyncScenarioRunsCursorIDPage", ] _T = TypeVar("_T") @@ -39,6 +47,26 @@ class DiskSnapshotsCursorIDPageItem(Protocol): id: str +@runtime_checkable +class BenchmarksCursorIDPageItem(Protocol): + id: str + + +@runtime_checkable +class BenchmarkRunsCursorIDPageItem(Protocol): + id: str + + +@runtime_checkable +class ScenariosCursorIDPageItem(Protocol): + id: str + + +@runtime_checkable +class ScenarioRunsCursorIDPageItem(Protocol): + id: str + + class SyncBlueprintsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): blueprints: List[_T] has_more: Optional[bool] = None @@ -245,3 +273,211 @@ def next_page_info(self) -> Optional[PageInfo]: return None return PageInfo(params={"starting_after": item.id}) + + +class SyncBenchmarksCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + benchmarks: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + benchmarks = self.benchmarks + if not benchmarks: + return [] + return benchmarks + + @override + def next_page_info(self) -> Optional[PageInfo]: + benchmarks = self.benchmarks + if not benchmarks: + return None + + item = cast(Any, benchmarks[-1]) + if not isinstance(item, BenchmarksCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class AsyncBenchmarksCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + benchmarks: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + benchmarks = self.benchmarks + if not benchmarks: + return [] + return benchmarks + + @override + def next_page_info(self) -> Optional[PageInfo]: + benchmarks = self.benchmarks + if not benchmarks: + return None + + item = cast(Any, benchmarks[-1]) + if not isinstance(item, BenchmarksCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class SyncBenchmarkRunsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + runs: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + runs = self.runs + if not runs: + return [] + return runs + + @override + def next_page_info(self) -> Optional[PageInfo]: + runs = self.runs + if not runs: + return None + + item = cast(Any, runs[-1]) + if not isinstance(item, BenchmarkRunsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class AsyncBenchmarkRunsCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + runs: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + runs = self.runs + if not runs: + return [] + return runs + + @override + def next_page_info(self) -> Optional[PageInfo]: + runs = self.runs + if not runs: + return None + + item = cast(Any, runs[-1]) + if not isinstance(item, BenchmarkRunsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class SyncScenariosCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + scenarios: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + scenarios = self.scenarios + if not scenarios: + return [] + return scenarios + + @override + def next_page_info(self) -> Optional[PageInfo]: + scenarios = self.scenarios + if not scenarios: + return None + + item = cast(Any, scenarios[-1]) + if not isinstance(item, ScenariosCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class AsyncScenariosCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + scenarios: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + scenarios = self.scenarios + if not scenarios: + return [] + return scenarios + + @override + def next_page_info(self) -> Optional[PageInfo]: + scenarios = self.scenarios + if not scenarios: + return None + + item = cast(Any, scenarios[-1]) + if not isinstance(item, ScenariosCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class SyncScenarioRunsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + runs: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + runs = self.runs + if not runs: + return [] + return runs + + @override + def next_page_info(self) -> Optional[PageInfo]: + runs = self.runs + if not runs: + return None + + item = cast(Any, runs[-1]) + if not isinstance(item, ScenarioRunsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) + + +class AsyncScenarioRunsCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + runs: List[_T] + has_more: Optional[bool] = None + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + runs = self.runs + if not runs: + return [] + return runs + + @override + def next_page_info(self) -> Optional[PageInfo]: + runs = self.runs + if not runs: + return None + + item = cast(Any, runs[-1]) + if not isinstance(item, ScenarioRunsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison] + # TODO emit warning log + return None + + return PageInfo(params={"starting_after": item.id}) diff --git a/src/runloop_api_client/resources/benchmarks/benchmarks.py b/src/runloop_api_client/resources/benchmarks/benchmarks.py index 650494753..b35432509 100644 --- a/src/runloop_api_client/resources/benchmarks/benchmarks.py +++ b/src/runloop_api_client/resources/benchmarks/benchmarks.py @@ -28,10 +28,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncBenchmarksCursorIDPage, AsyncBenchmarksCursorIDPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.benchmark_view import BenchmarkView from ...types.benchmark_run_view import BenchmarkRunView -from ...types.benchmark_list_view import BenchmarkListView __all__ = ["BenchmarksResource", "AsyncBenchmarksResource"] @@ -155,7 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BenchmarkListView: + ) -> SyncBenchmarksCursorIDPage[BenchmarkView]: """ List all Benchmarks matching filter. @@ -175,8 +175,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/benchmarks", + page=SyncBenchmarksCursorIDPage[BenchmarkView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -191,7 +192,7 @@ def list( benchmark_list_params.BenchmarkListParams, ), ), - cast_to=BenchmarkListView, + model=BenchmarkView, ) def start_run( @@ -352,7 +353,7 @@ async def retrieve( cast_to=BenchmarkView, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -364,7 +365,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BenchmarkListView: + ) -> AsyncPaginator[BenchmarkView, AsyncBenchmarksCursorIDPage[BenchmarkView]]: """ List all Benchmarks matching filter. @@ -384,14 +385,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/benchmarks", + page=AsyncBenchmarksCursorIDPage[BenchmarkView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "public": public, @@ -400,7 +402,7 @@ async def list( benchmark_list_params.BenchmarkListParams, ), ), - cast_to=BenchmarkListView, + model=BenchmarkView, ) async def start_run( diff --git a/src/runloop_api_client/resources/benchmarks/runs.py b/src/runloop_api_client/resources/benchmarks/runs.py index 3866eb99a..7f84c5da5 100644 --- a/src/runloop_api_client/resources/benchmarks/runs.py +++ b/src/runloop_api_client/resources/benchmarks/runs.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -17,10 +14,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.benchmarks import run_list_params from ...types.benchmark_run_view import BenchmarkRunView -from ...types.benchmark_run_list_view import BenchmarkRunListView __all__ = ["RunsResource", "AsyncRunsResource"] @@ -90,7 +87,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BenchmarkRunListView: + ) -> SyncBenchmarkRunsCursorIDPage[BenchmarkRunView]: """ List all BenchmarkRuns matching filter. @@ -109,8 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/benchmarks/runs", + page=SyncBenchmarkRunsCursorIDPage[BenchmarkRunView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -125,7 +123,7 @@ def list( run_list_params.RunListParams, ), ), - cast_to=BenchmarkRunListView, + model=BenchmarkRunView, ) def complete( @@ -222,7 +220,7 @@ async def retrieve( cast_to=BenchmarkRunView, ) - async def list( + def list( self, *, benchmark_id: str | NotGiven = NOT_GIVEN, @@ -234,7 +232,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BenchmarkRunListView: + ) -> AsyncPaginator[BenchmarkRunView, AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView]]: """ List all BenchmarkRuns matching filter. @@ -253,14 +251,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/benchmarks/runs", + page=AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "benchmark_id": benchmark_id, "limit": limit, @@ -269,7 +268,7 @@ async def list( run_list_params.RunListParams, ), ), - cast_to=BenchmarkRunListView, + model=BenchmarkRunView, ) async def complete( diff --git a/src/runloop_api_client/resources/scenarios/runs.py b/src/runloop_api_client/resources/scenarios/runs.py index 53549a00a..94b450a36 100644 --- a/src/runloop_api_client/resources/scenarios/runs.py +++ b/src/runloop_api_client/resources/scenarios/runs.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -17,10 +14,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.scenarios import run_list_params from ...types.scenario_run_view import ScenarioRunView -from ...types.scenario_run_list_view import ScenarioRunListView __all__ = ["RunsResource", "AsyncRunsResource"] @@ -90,7 +87,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScenarioRunListView: + ) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView]: """ List all ScenarioRuns matching filter. @@ -109,8 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/scenarios/runs", + page=SyncBenchmarkRunsCursorIDPage[ScenarioRunView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -125,7 +123,7 @@ def list( run_list_params.RunListParams, ), ), - cast_to=ScenarioRunListView, + model=ScenarioRunView, ) def complete( @@ -262,7 +260,7 @@ async def retrieve( cast_to=ScenarioRunView, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -274,7 +272,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScenarioRunListView: + ) -> AsyncPaginator[ScenarioRunView, AsyncBenchmarkRunsCursorIDPage[ScenarioRunView]]: """ List all ScenarioRuns matching filter. @@ -293,14 +291,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/scenarios/runs", + page=AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "scenario_id": scenario_id, @@ -309,7 +308,7 @@ async def list( run_list_params.RunListParams, ), ), - cast_to=ScenarioRunListView, + model=ScenarioRunView, ) async def complete( diff --git a/src/runloop_api_client/resources/scenarios/scenarios.py b/src/runloop_api_client/resources/scenarios/scenarios.py index bd698f6c9..af64a4b0e 100644 --- a/src/runloop_api_client/resources/scenarios/scenarios.py +++ b/src/runloop_api_client/resources/scenarios/scenarios.py @@ -32,10 +32,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncScenariosCursorIDPage, AsyncScenariosCursorIDPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.scenario_view import ScenarioView from ...types.scenario_run_view import ScenarioRunView -from ...types.scenario_list_view import ScenarioListView from ...types.input_context_param import InputContextParam from ...types.scoring_contract_param import ScoringContractParam from ...types.scenario_environment_param import ScenarioEnvironmentParam @@ -163,6 +163,7 @@ def list( self, *, limit: int | NotGiven = NOT_GIVEN, + name: int | NotGiven = NOT_GIVEN, starting_after: 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. @@ -170,7 +171,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScenarioListView: + ) -> SyncScenariosCursorIDPage[ScenarioView]: """List all Scenarios matching filter. Args: @@ -178,6 +179,8 @@ def list( Default is 20. + name: Query for Scenarios with a given name. + starting_after: Load the next page of data starting after the item with the given ID. extra_headers: Send extra headers @@ -188,8 +191,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/scenarios", + page=SyncScenariosCursorIDPage[ScenarioView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -198,12 +202,13 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "starting_after": starting_after, }, scenario_list_params.ScenarioListParams, ), ), - cast_to=ScenarioListView, + model=ScenarioView, ) def start_run( @@ -377,10 +382,11 @@ async def retrieve( cast_to=ScenarioView, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, + name: int | NotGiven = NOT_GIVEN, starting_after: 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. @@ -388,7 +394,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScenarioListView: + ) -> AsyncPaginator[ScenarioView, AsyncScenariosCursorIDPage[ScenarioView]]: """List all Scenarios matching filter. Args: @@ -396,6 +402,8 @@ async def list( Default is 20. + name: Query for Scenarios with a given name. + starting_after: Load the next page of data starting after the item with the given ID. extra_headers: Send extra headers @@ -406,22 +414,24 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/scenarios", + page=AsyncScenariosCursorIDPage[ScenarioView], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, + "name": name, "starting_after": starting_after, }, scenario_list_params.ScenarioListParams, ), ), - cast_to=ScenarioListView, + model=ScenarioView, ) async def start_run( diff --git a/src/runloop_api_client/types/scenario_list_params.py b/src/runloop_api_client/types/scenario_list_params.py index 01dac999b..76ad9bd10 100644 --- a/src/runloop_api_client/types/scenario_list_params.py +++ b/src/runloop_api_client/types/scenario_list_params.py @@ -11,5 +11,8 @@ class ScenarioListParams(TypedDict, total=False): limit: int """The limit of items to return. Default is 20.""" + name: int + """Query for Scenarios with a given name.""" + starting_after: str """Load the next page of data starting after the item with the given ID.""" diff --git a/tests/api_resources/benchmarks/test_runs.py b/tests/api_resources/benchmarks/test_runs.py index 31ca76fed..e6acbebad 100644 --- a/tests/api_resources/benchmarks/test_runs.py +++ b/tests/api_resources/benchmarks/test_runs.py @@ -9,7 +9,8 @@ from tests.utils import assert_matches_type from runloop_api_client import Runloop, AsyncRunloop -from runloop_api_client.types import BenchmarkRunView, BenchmarkRunListView +from runloop_api_client.types import BenchmarkRunView +from runloop_api_client.pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -58,7 +59,7 @@ def test_path_params_retrieve(self, client: Runloop) -> None: @parametrize def test_method_list(self, client: Runloop) -> None: run = client.benchmarks.runs.list() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Runloop) -> None: @@ -67,7 +68,7 @@ def test_method_list_with_all_params(self, client: Runloop) -> None: limit=0, starting_after="starting_after", ) - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize def test_raw_response_list(self, client: Runloop) -> None: @@ -76,7 +77,7 @@ def test_raw_response_list(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = response.parse() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize def test_streaming_response_list(self, client: Runloop) -> None: @@ -85,7 +86,7 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = response.parse() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) assert cast(Any, response.is_closed) is True @@ -172,7 +173,7 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: run = await async_client.benchmarks.runs.list() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: @@ -181,7 +182,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> limit=0, starting_after="starting_after", ) - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: @@ -190,7 +191,7 @@ async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = await response.parse() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: @@ -199,7 +200,7 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = await response.parse() - assert_matches_type(BenchmarkRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView], run, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/scenarios/test_runs.py b/tests/api_resources/scenarios/test_runs.py index d375cb45e..35b2e5141 100644 --- a/tests/api_resources/scenarios/test_runs.py +++ b/tests/api_resources/scenarios/test_runs.py @@ -9,7 +9,8 @@ from tests.utils import assert_matches_type from runloop_api_client import Runloop, AsyncRunloop -from runloop_api_client.types import ScenarioRunView, ScenarioRunListView +from runloop_api_client.types import ScenarioRunView +from runloop_api_client.pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -58,7 +59,7 @@ def test_path_params_retrieve(self, client: Runloop) -> None: @parametrize def test_method_list(self, client: Runloop) -> None: run = client.scenarios.runs.list() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Runloop) -> None: @@ -67,7 +68,7 @@ def test_method_list_with_all_params(self, client: Runloop) -> None: scenario_id="scenario_id", starting_after="starting_after", ) - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize def test_raw_response_list(self, client: Runloop) -> None: @@ -76,7 +77,7 @@ def test_raw_response_list(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = response.parse() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize def test_streaming_response_list(self, client: Runloop) -> None: @@ -85,7 +86,7 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = response.parse() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) assert cast(Any, response.is_closed) is True @@ -210,7 +211,7 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: run = await async_client.scenarios.runs.list() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: @@ -219,7 +220,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> scenario_id="scenario_id", starting_after="starting_after", ) - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: @@ -228,7 +229,7 @@ async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = await response.parse() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: @@ -237,7 +238,7 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" run = await response.parse() - assert_matches_type(ScenarioRunListView, run, path=["response"]) + assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_benchmarks.py b/tests/api_resources/test_benchmarks.py index b3ac18fc7..17b592147 100644 --- a/tests/api_resources/test_benchmarks.py +++ b/tests/api_resources/test_benchmarks.py @@ -12,8 +12,8 @@ from runloop_api_client.types import ( BenchmarkView, BenchmarkRunView, - BenchmarkListView, ) +from runloop_api_client.pagination import SyncBenchmarksCursorIDPage, AsyncBenchmarksCursorIDPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -101,7 +101,7 @@ def test_path_params_retrieve(self, client: Runloop) -> None: @parametrize def test_method_list(self, client: Runloop) -> None: benchmark = client.benchmarks.list() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(SyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Runloop) -> None: @@ -110,7 +110,7 @@ def test_method_list_with_all_params(self, client: Runloop) -> None: public=True, starting_after="starting_after", ) - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(SyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize def test_raw_response_list(self, client: Runloop) -> None: @@ -119,7 +119,7 @@ def test_raw_response_list(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" benchmark = response.parse() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(SyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize def test_streaming_response_list(self, client: Runloop) -> None: @@ -128,7 +128,7 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" benchmark = response.parse() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(SyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -255,7 +255,7 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: benchmark = await async_client.benchmarks.list() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(AsyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: @@ -264,7 +264,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> public=True, starting_after="starting_after", ) - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(AsyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: @@ -273,7 +273,7 @@ async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" benchmark = await response.parse() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(AsyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: @@ -282,7 +282,7 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" benchmark = await response.parse() - assert_matches_type(BenchmarkListView, benchmark, path=["response"]) + assert_matches_type(AsyncBenchmarksCursorIDPage[BenchmarkView], benchmark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_scenarios.py b/tests/api_resources/test_scenarios.py index 509542559..71ba64dfd 100644 --- a/tests/api_resources/test_scenarios.py +++ b/tests/api_resources/test_scenarios.py @@ -12,8 +12,8 @@ from runloop_api_client.types import ( ScenarioView, ScenarioRunView, - ScenarioListView, ) +from runloop_api_client.pagination import SyncScenariosCursorIDPage, AsyncScenariosCursorIDPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -142,15 +142,16 @@ def test_path_params_retrieve(self, client: Runloop) -> None: @parametrize def test_method_list(self, client: Runloop) -> None: scenario = client.scenarios.list() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(SyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Runloop) -> None: scenario = client.scenarios.list( limit=0, + name=0, starting_after="starting_after", ) - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(SyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize def test_raw_response_list(self, client: Runloop) -> None: @@ -159,7 +160,7 @@ def test_raw_response_list(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" scenario = response.parse() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(SyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize def test_streaming_response_list(self, client: Runloop) -> None: @@ -168,7 +169,7 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" scenario = response.parse() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(SyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) assert cast(Any, response.is_closed) is True @@ -337,15 +338,16 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: scenario = await async_client.scenarios.list() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(AsyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: scenario = await async_client.scenarios.list( limit=0, + name=0, starting_after="starting_after", ) - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(AsyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: @@ -354,7 +356,7 @@ async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" scenario = await response.parse() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(AsyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: @@ -363,7 +365,7 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" scenario = await response.parse() - assert_matches_type(ScenarioListView, scenario, path=["response"]) + assert_matches_type(AsyncScenariosCursorIDPage[ScenarioView], scenario, path=["response"]) assert cast(Any, response.is_closed) is True From 407a4e26ad7d2544a668ec439b769d5ca7ff6de3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 01:07:28 +0000 Subject: [PATCH 2/2] release: 0.18.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/runloop_api_client/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6db19b956..4ad3fef33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.17.0" + ".": "0.18.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b6aff999a..4dc078fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.18.0 (2025-02-01) + +Full Changelog: [v0.17.0...v0.18.0](https://github.com/runloopai/api-client-python/compare/v0.17.0...v0.18.0) + +### Features + +* **api:** api update ([#515](https://github.com/runloopai/api-client-python/issues/515)) ([1c68520](https://github.com/runloopai/api-client-python/commit/1c68520b90822af7d035acbf8b366a0c6492ec87)) + ## 0.17.0 (2025-01-31) Full Changelog: [v0.16.0...v0.17.0](https://github.com/runloopai/api-client-python/compare/v0.16.0...v0.17.0) diff --git a/pyproject.toml b/pyproject.toml index 5e7d26ec3..b384ff7ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runloop_api_client" -version = "0.17.0" +version = "0.18.0" description = "The official Python library for the runloop API" dynamic = ["readme"] license = "MIT" diff --git a/src/runloop_api_client/_version.py b/src/runloop_api_client/_version.py index d2dd301f2..3c71c53af 100644 --- a/src/runloop_api_client/_version.py +++ b/src/runloop_api_client/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "runloop_api_client" -__version__ = "0.17.0" # x-release-please-version +__version__ = "0.18.0" # x-release-please-version