Skip to content

Commit fbabb53

Browse files
feat(api): api update
1 parent 7fa8636 commit fbabb53

File tree

6 files changed

+226
-2
lines changed

6 files changed

+226
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 86
1+
configured_endpoints: 87
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4cd38d2f4180cc9bd949f182a221d6221c44e7e0ec1ddc110dd7677ba822b51a.yml
33
openapi_spec_hash: e186fd7fd5f09ba496f0b7bb87365f3b
4-
config_hash: d39a06c3965a9c5d5e95b12d34e3f3a5
4+
config_hash: 4514558503b7aa6eba8c2941564c247d

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Methods:
2525
- <code title="get /v1/benchmarks/{id}">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/benchmark_view.py">BenchmarkView</a></code>
2626
- <code title="post /v1/benchmarks/{id}">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">update</a>(id, \*\*<a href="src/runloop_api_client/types/benchmark_update_params.py">params</a>) -> <a href="./src/runloop_api_client/types/benchmark_view.py">BenchmarkView</a></code>
2727
- <code title="get /v1/benchmarks">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">list</a>(\*\*<a href="src/runloop_api_client/types/benchmark_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/benchmark_view.py">SyncBenchmarksCursorIDPage[BenchmarkView]</a></code>
28+
- <code title="get /v1/benchmarks/{id}/definitions">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">definitions</a>(id, \*\*<a href="src/runloop_api_client/types/benchmark_definitions_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_definition_list_view.py">ScenarioDefinitionListView</a></code>
2829
- <code title="get /v1/benchmarks/list_public">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">list_public</a>(\*\*<a href="src/runloop_api_client/types/benchmark_list_public_params.py">params</a>) -> <a href="./src/runloop_api_client/types/benchmark_view.py">SyncBenchmarksCursorIDPage[BenchmarkView]</a></code>
2930
- <code title="post /v1/benchmarks/start_run">client.benchmarks.<a href="./src/runloop_api_client/resources/benchmarks/benchmarks.py">start_run</a>(\*\*<a href="src/runloop_api_client/types/benchmark_start_run_params.py">params</a>) -> <a href="./src/runloop_api_client/types/benchmark_run_view.py">BenchmarkRunView</a></code>
3031

src/runloop_api_client/resources/benchmarks/benchmarks.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
benchmark_create_params,
2020
benchmark_update_params,
2121
benchmark_start_run_params,
22+
benchmark_definitions_params,
2223
benchmark_list_public_params,
2324
)
2425
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
@@ -35,6 +36,7 @@
3536
from ..._base_client import AsyncPaginator, make_request_options
3637
from ...types.benchmark_view import BenchmarkView
3738
from ...types.benchmark_run_view import BenchmarkRunView
39+
from ...types.scenario_definition_list_view import ScenarioDefinitionListView
3840

3941
__all__ = ["BenchmarksResource", "AsyncBenchmarksResource"]
4042

@@ -262,6 +264,55 @@ def list(
262264
model=BenchmarkView,
263265
)
264266

267+
def definitions(
268+
self,
269+
id: str,
270+
*,
271+
limit: int | NotGiven = NOT_GIVEN,
272+
starting_after: str | NotGiven = NOT_GIVEN,
273+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
274+
# The extra values given here take precedence over values defined on the client or passed to this method.
275+
extra_headers: Headers | None = None,
276+
extra_query: Query | None = None,
277+
extra_body: Body | None = None,
278+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
279+
) -> ScenarioDefinitionListView:
280+
"""
281+
Get scenario definitions for a previously created Benchmark.
282+
283+
Args:
284+
limit: The limit of items to return. Default is 20.
285+
286+
starting_after: Load the next page of data starting after the item with the given ID.
287+
288+
extra_headers: Send extra headers
289+
290+
extra_query: Add additional query parameters to the request
291+
292+
extra_body: Add additional JSON properties to the request
293+
294+
timeout: Override the client-level default timeout for this request, in seconds
295+
"""
296+
if not id:
297+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
298+
return self._get(
299+
f"/v1/benchmarks/{id}/definitions",
300+
options=make_request_options(
301+
extra_headers=extra_headers,
302+
extra_query=extra_query,
303+
extra_body=extra_body,
304+
timeout=timeout,
305+
query=maybe_transform(
306+
{
307+
"limit": limit,
308+
"starting_after": starting_after,
309+
},
310+
benchmark_definitions_params.BenchmarkDefinitionsParams,
311+
),
312+
),
313+
cast_to=ScenarioDefinitionListView,
314+
)
315+
265316
def list_public(
266317
self,
267318
*,
@@ -587,6 +638,55 @@ def list(
587638
model=BenchmarkView,
588639
)
589640

641+
async def definitions(
642+
self,
643+
id: str,
644+
*,
645+
limit: int | NotGiven = NOT_GIVEN,
646+
starting_after: str | NotGiven = NOT_GIVEN,
647+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
648+
# The extra values given here take precedence over values defined on the client or passed to this method.
649+
extra_headers: Headers | None = None,
650+
extra_query: Query | None = None,
651+
extra_body: Body | None = None,
652+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
653+
) -> ScenarioDefinitionListView:
654+
"""
655+
Get scenario definitions for a previously created Benchmark.
656+
657+
Args:
658+
limit: The limit of items to return. Default is 20.
659+
660+
starting_after: Load the next page of data starting after the item with the given ID.
661+
662+
extra_headers: Send extra headers
663+
664+
extra_query: Add additional query parameters to the request
665+
666+
extra_body: Add additional JSON properties to the request
667+
668+
timeout: Override the client-level default timeout for this request, in seconds
669+
"""
670+
if not id:
671+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
672+
return await self._get(
673+
f"/v1/benchmarks/{id}/definitions",
674+
options=make_request_options(
675+
extra_headers=extra_headers,
676+
extra_query=extra_query,
677+
extra_body=extra_body,
678+
timeout=timeout,
679+
query=await async_maybe_transform(
680+
{
681+
"limit": limit,
682+
"starting_after": starting_after,
683+
},
684+
benchmark_definitions_params.BenchmarkDefinitionsParams,
685+
),
686+
),
687+
cast_to=ScenarioDefinitionListView,
688+
)
689+
590690
def list_public(
591691
self,
592692
*,
@@ -705,6 +805,9 @@ def __init__(self, benchmarks: BenchmarksResource) -> None:
705805
self.list = to_raw_response_wrapper(
706806
benchmarks.list,
707807
)
808+
self.definitions = to_raw_response_wrapper(
809+
benchmarks.definitions,
810+
)
708811
self.list_public = to_raw_response_wrapper(
709812
benchmarks.list_public,
710813
)
@@ -733,6 +836,9 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None:
733836
self.list = async_to_raw_response_wrapper(
734837
benchmarks.list,
735838
)
839+
self.definitions = async_to_raw_response_wrapper(
840+
benchmarks.definitions,
841+
)
736842
self.list_public = async_to_raw_response_wrapper(
737843
benchmarks.list_public,
738844
)
@@ -761,6 +867,9 @@ def __init__(self, benchmarks: BenchmarksResource) -> None:
761867
self.list = to_streamed_response_wrapper(
762868
benchmarks.list,
763869
)
870+
self.definitions = to_streamed_response_wrapper(
871+
benchmarks.definitions,
872+
)
764873
self.list_public = to_streamed_response_wrapper(
765874
benchmarks.list_public,
766875
)
@@ -789,6 +898,9 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None:
789898
self.list = async_to_streamed_response_wrapper(
790899
benchmarks.list,
791900
)
901+
self.definitions = async_to_streamed_response_wrapper(
902+
benchmarks.definitions,
903+
)
792904
self.list_public = async_to_streamed_response_wrapper(
793905
benchmarks.list_public,
794906
)

src/runloop_api_client/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from .devbox_remove_tunnel_params import DevboxRemoveTunnelParams as DevboxRemoveTunnelParams
5858
from .devbox_snapshot_disk_params import DevboxSnapshotDiskParams as DevboxSnapshotDiskParams
5959
from .scenario_list_public_params import ScenarioListPublicParams as ScenarioListPublicParams
60+
from .benchmark_definitions_params import BenchmarkDefinitionsParams as BenchmarkDefinitionsParams
6061
from .benchmark_list_public_params import BenchmarkListPublicParams as BenchmarkListPublicParams
6162
from .devbox_execution_detail_view import DevboxExecutionDetailView as DevboxExecutionDetailView
6263
from .scoring_contract_result_view import ScoringContractResultView as ScoringContractResultView
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["BenchmarkDefinitionsParams"]
8+
9+
10+
class BenchmarkDefinitionsParams(TypedDict, total=False):
11+
limit: int
12+
"""The limit of items to return. Default is 20."""
13+
14+
starting_after: str
15+
"""Load the next page of data starting after the item with the given ID."""

tests/api_resources/test_benchmarks.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from runloop_api_client.types import (
1313
BenchmarkView,
1414
BenchmarkRunView,
15+
ScenarioDefinitionListView,
1516
)
1617
from runloop_api_client.pagination import SyncBenchmarksCursorIDPage, AsyncBenchmarksCursorIDPage
1718

@@ -193,6 +194,53 @@ def test_streaming_response_list(self, client: Runloop) -> None:
193194

194195
assert cast(Any, response.is_closed) is True
195196

197+
@parametrize
198+
def test_method_definitions(self, client: Runloop) -> None:
199+
benchmark = client.benchmarks.definitions(
200+
id="id",
201+
)
202+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
203+
204+
@parametrize
205+
def test_method_definitions_with_all_params(self, client: Runloop) -> None:
206+
benchmark = client.benchmarks.definitions(
207+
id="id",
208+
limit=0,
209+
starting_after="starting_after",
210+
)
211+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
212+
213+
@parametrize
214+
def test_raw_response_definitions(self, client: Runloop) -> None:
215+
response = client.benchmarks.with_raw_response.definitions(
216+
id="id",
217+
)
218+
219+
assert response.is_closed is True
220+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
221+
benchmark = response.parse()
222+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
223+
224+
@parametrize
225+
def test_streaming_response_definitions(self, client: Runloop) -> None:
226+
with client.benchmarks.with_streaming_response.definitions(
227+
id="id",
228+
) as response:
229+
assert not response.is_closed
230+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
231+
232+
benchmark = response.parse()
233+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
234+
235+
assert cast(Any, response.is_closed) is True
236+
237+
@parametrize
238+
def test_path_params_definitions(self, client: Runloop) -> None:
239+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
240+
client.benchmarks.with_raw_response.definitions(
241+
id="",
242+
)
243+
196244
@parametrize
197245
def test_method_list_public(self, client: Runloop) -> None:
198246
benchmark = client.benchmarks.list_public()
@@ -442,6 +490,53 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None
442490

443491
assert cast(Any, response.is_closed) is True
444492

493+
@parametrize
494+
async def test_method_definitions(self, async_client: AsyncRunloop) -> None:
495+
benchmark = await async_client.benchmarks.definitions(
496+
id="id",
497+
)
498+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
499+
500+
@parametrize
501+
async def test_method_definitions_with_all_params(self, async_client: AsyncRunloop) -> None:
502+
benchmark = await async_client.benchmarks.definitions(
503+
id="id",
504+
limit=0,
505+
starting_after="starting_after",
506+
)
507+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
508+
509+
@parametrize
510+
async def test_raw_response_definitions(self, async_client: AsyncRunloop) -> None:
511+
response = await async_client.benchmarks.with_raw_response.definitions(
512+
id="id",
513+
)
514+
515+
assert response.is_closed is True
516+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
517+
benchmark = await response.parse()
518+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
519+
520+
@parametrize
521+
async def test_streaming_response_definitions(self, async_client: AsyncRunloop) -> None:
522+
async with async_client.benchmarks.with_streaming_response.definitions(
523+
id="id",
524+
) as response:
525+
assert not response.is_closed
526+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
527+
528+
benchmark = await response.parse()
529+
assert_matches_type(ScenarioDefinitionListView, benchmark, path=["response"])
530+
531+
assert cast(Any, response.is_closed) is True
532+
533+
@parametrize
534+
async def test_path_params_definitions(self, async_client: AsyncRunloop) -> None:
535+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
536+
await async_client.benchmarks.with_raw_response.definitions(
537+
id="",
538+
)
539+
445540
@parametrize
446541
async def test_method_list_public(self, async_client: AsyncRunloop) -> None:
447542
benchmark = await async_client.benchmarks.list_public()

0 commit comments

Comments
 (0)