Skip to content

Commit 1358f80

Browse files
feat(api): api update
1 parent 5cbb368 commit 1358f80

File tree

6 files changed

+230
-6
lines changed

6 files changed

+230
-6
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 85
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-3484df665f4c2b7cb17ad044b825223fc69ad67b05d967fbb6dfbb6a6ac9ccac.yml
3-
openapi_spec_hash: 58c0860078f5f26c8b517603956700b5
4-
config_hash: 877879fdb00371dafaddf7137e296832
1+
configured_endpoints: 86
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-141cac5a78c04271425090df61bb3f19446c1c065ae66a5b7a6329c53628aafa.yml
3+
openapi_spec_hash: 2380917eddc78d715847c7ef6bfa3b4a
4+
config_hash: 5b50498887b4fdca175b8377a9cb675f

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Methods:
3535
- <code title="get /v1/benchmarks/runs">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">list</a>(\*\*<a href="src/runloop_api_client/types/benchmarks/run_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/benchmark_run_view.py">SyncBenchmarkRunsCursorIDPage[BenchmarkRunView]</a></code>
3636
- <code title="post /v1/benchmarks/runs/{id}/cancel">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">cancel</a>(id) -> <a href="./src/runloop_api_client/types/benchmark_run_view.py">BenchmarkRunView</a></code>
3737
- <code title="post /v1/benchmarks/runs/{id}/complete">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">complete</a>(id) -> <a href="./src/runloop_api_client/types/benchmark_run_view.py">BenchmarkRunView</a></code>
38+
- <code title="get /v1/benchmarks/runs/{id}/scenario_runs">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">list_scenario_runs</a>(id, \*\*<a href="src/runloop_api_client/types/benchmarks/run_list_scenario_runs_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_run_view.py">SyncBenchmarkRunsCursorIDPage[ScenarioRunView]</a></code>
3839

3940
# Blueprints
4041

src/runloop_api_client/resources/benchmarks/runs.py

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
)
1717
from ...pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage
1818
from ..._base_client import AsyncPaginator, make_request_options
19-
from ...types.benchmarks import run_list_params
19+
from ...types.benchmarks import run_list_params, run_list_scenario_runs_params
20+
from ...types.scenario_run_view import ScenarioRunView
2021
from ...types.benchmark_run_view import BenchmarkRunView
2122

2223
__all__ = ["RunsResource", "AsyncRunsResource"]
@@ -206,6 +207,56 @@ def complete(
206207
cast_to=BenchmarkRunView,
207208
)
208209

210+
def list_scenario_runs(
211+
self,
212+
id: str,
213+
*,
214+
limit: int | NotGiven = NOT_GIVEN,
215+
starting_after: str | NotGiven = NOT_GIVEN,
216+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
217+
# The extra values given here take precedence over values defined on the client or passed to this method.
218+
extra_headers: Headers | None = None,
219+
extra_query: Query | None = None,
220+
extra_body: Body | None = None,
221+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
222+
) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView]:
223+
"""
224+
List started scenario runs for a benchmark run.
225+
226+
Args:
227+
limit: The limit of items to return. Default is 20.
228+
229+
starting_after: Load the next page of data starting after the item with the given ID.
230+
231+
extra_headers: Send extra headers
232+
233+
extra_query: Add additional query parameters to the request
234+
235+
extra_body: Add additional JSON properties to the request
236+
237+
timeout: Override the client-level default timeout for this request, in seconds
238+
"""
239+
if not id:
240+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
241+
return self._get_api_list(
242+
f"/v1/benchmarks/runs/{id}/scenario_runs",
243+
page=SyncBenchmarkRunsCursorIDPage[ScenarioRunView],
244+
options=make_request_options(
245+
extra_headers=extra_headers,
246+
extra_query=extra_query,
247+
extra_body=extra_body,
248+
timeout=timeout,
249+
query=maybe_transform(
250+
{
251+
"limit": limit,
252+
"starting_after": starting_after,
253+
},
254+
run_list_scenario_runs_params.RunListScenarioRunsParams,
255+
),
256+
),
257+
model=ScenarioRunView,
258+
)
259+
209260

210261
class AsyncRunsResource(AsyncAPIResource):
211262
@cached_property
@@ -391,6 +442,56 @@ async def complete(
391442
cast_to=BenchmarkRunView,
392443
)
393444

445+
def list_scenario_runs(
446+
self,
447+
id: str,
448+
*,
449+
limit: int | NotGiven = NOT_GIVEN,
450+
starting_after: str | NotGiven = NOT_GIVEN,
451+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
452+
# The extra values given here take precedence over values defined on the client or passed to this method.
453+
extra_headers: Headers | None = None,
454+
extra_query: Query | None = None,
455+
extra_body: Body | None = None,
456+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
457+
) -> AsyncPaginator[ScenarioRunView, AsyncBenchmarkRunsCursorIDPage[ScenarioRunView]]:
458+
"""
459+
List started scenario runs for a benchmark run.
460+
461+
Args:
462+
limit: The limit of items to return. Default is 20.
463+
464+
starting_after: Load the next page of data starting after the item with the given ID.
465+
466+
extra_headers: Send extra headers
467+
468+
extra_query: Add additional query parameters to the request
469+
470+
extra_body: Add additional JSON properties to the request
471+
472+
timeout: Override the client-level default timeout for this request, in seconds
473+
"""
474+
if not id:
475+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
476+
return self._get_api_list(
477+
f"/v1/benchmarks/runs/{id}/scenario_runs",
478+
page=AsyncBenchmarkRunsCursorIDPage[ScenarioRunView],
479+
options=make_request_options(
480+
extra_headers=extra_headers,
481+
extra_query=extra_query,
482+
extra_body=extra_body,
483+
timeout=timeout,
484+
query=maybe_transform(
485+
{
486+
"limit": limit,
487+
"starting_after": starting_after,
488+
},
489+
run_list_scenario_runs_params.RunListScenarioRunsParams,
490+
),
491+
),
492+
model=ScenarioRunView,
493+
)
494+
394495

395496
class RunsResourceWithRawResponse:
396497
def __init__(self, runs: RunsResource) -> None:
@@ -408,6 +509,9 @@ def __init__(self, runs: RunsResource) -> None:
408509
self.complete = to_raw_response_wrapper(
409510
runs.complete,
410511
)
512+
self.list_scenario_runs = to_raw_response_wrapper(
513+
runs.list_scenario_runs,
514+
)
411515

412516

413517
class AsyncRunsResourceWithRawResponse:
@@ -426,6 +530,9 @@ def __init__(self, runs: AsyncRunsResource) -> None:
426530
self.complete = async_to_raw_response_wrapper(
427531
runs.complete,
428532
)
533+
self.list_scenario_runs = async_to_raw_response_wrapper(
534+
runs.list_scenario_runs,
535+
)
429536

430537

431538
class RunsResourceWithStreamingResponse:
@@ -444,6 +551,9 @@ def __init__(self, runs: RunsResource) -> None:
444551
self.complete = to_streamed_response_wrapper(
445552
runs.complete,
446553
)
554+
self.list_scenario_runs = to_streamed_response_wrapper(
555+
runs.list_scenario_runs,
556+
)
447557

448558

449559
class AsyncRunsResourceWithStreamingResponse:
@@ -462,3 +572,6 @@ def __init__(self, runs: AsyncRunsResource) -> None:
462572
self.complete = async_to_streamed_response_wrapper(
463573
runs.complete,
464574
)
575+
self.list_scenario_runs = async_to_streamed_response_wrapper(
576+
runs.list_scenario_runs,
577+
)

src/runloop_api_client/types/benchmarks/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
from __future__ import annotations
44

55
from .run_list_params import RunListParams as RunListParams
6+
from .run_list_scenario_runs_params import RunListScenarioRunsParams as RunListScenarioRunsParams
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__ = ["RunListScenarioRunsParams"]
8+
9+
10+
class RunListScenarioRunsParams(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/benchmarks/test_runs.py

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from tests.utils import assert_matches_type
1111
from runloop_api_client import Runloop, AsyncRunloop
12-
from runloop_api_client.types import BenchmarkRunView
12+
from runloop_api_client.types import ScenarioRunView, BenchmarkRunView
1313
from runloop_api_client.pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage
1414

1515
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -166,6 +166,53 @@ def test_path_params_complete(self, client: Runloop) -> None:
166166
"",
167167
)
168168

169+
@parametrize
170+
def test_method_list_scenario_runs(self, client: Runloop) -> None:
171+
run = client.benchmarks.runs.list_scenario_runs(
172+
id="id",
173+
)
174+
assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
175+
176+
@parametrize
177+
def test_method_list_scenario_runs_with_all_params(self, client: Runloop) -> None:
178+
run = client.benchmarks.runs.list_scenario_runs(
179+
id="id",
180+
limit=0,
181+
starting_after="starting_after",
182+
)
183+
assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
184+
185+
@parametrize
186+
def test_raw_response_list_scenario_runs(self, client: Runloop) -> None:
187+
response = client.benchmarks.runs.with_raw_response.list_scenario_runs(
188+
id="id",
189+
)
190+
191+
assert response.is_closed is True
192+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
193+
run = response.parse()
194+
assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
195+
196+
@parametrize
197+
def test_streaming_response_list_scenario_runs(self, client: Runloop) -> None:
198+
with client.benchmarks.runs.with_streaming_response.list_scenario_runs(
199+
id="id",
200+
) as response:
201+
assert not response.is_closed
202+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
203+
204+
run = response.parse()
205+
assert_matches_type(SyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
206+
207+
assert cast(Any, response.is_closed) is True
208+
209+
@parametrize
210+
def test_path_params_list_scenario_runs(self, client: Runloop) -> None:
211+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
212+
client.benchmarks.runs.with_raw_response.list_scenario_runs(
213+
id="",
214+
)
215+
169216

170217
class TestAsyncRuns:
171218
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -317,3 +364,50 @@ async def test_path_params_complete(self, async_client: AsyncRunloop) -> None:
317364
await async_client.benchmarks.runs.with_raw_response.complete(
318365
"",
319366
)
367+
368+
@parametrize
369+
async def test_method_list_scenario_runs(self, async_client: AsyncRunloop) -> None:
370+
run = await async_client.benchmarks.runs.list_scenario_runs(
371+
id="id",
372+
)
373+
assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
374+
375+
@parametrize
376+
async def test_method_list_scenario_runs_with_all_params(self, async_client: AsyncRunloop) -> None:
377+
run = await async_client.benchmarks.runs.list_scenario_runs(
378+
id="id",
379+
limit=0,
380+
starting_after="starting_after",
381+
)
382+
assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
383+
384+
@parametrize
385+
async def test_raw_response_list_scenario_runs(self, async_client: AsyncRunloop) -> None:
386+
response = await async_client.benchmarks.runs.with_raw_response.list_scenario_runs(
387+
id="id",
388+
)
389+
390+
assert response.is_closed is True
391+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
392+
run = await response.parse()
393+
assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
394+
395+
@parametrize
396+
async def test_streaming_response_list_scenario_runs(self, async_client: AsyncRunloop) -> None:
397+
async with async_client.benchmarks.runs.with_streaming_response.list_scenario_runs(
398+
id="id",
399+
) as response:
400+
assert not response.is_closed
401+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
402+
403+
run = await response.parse()
404+
assert_matches_type(AsyncBenchmarkRunsCursorIDPage[ScenarioRunView], run, path=["response"])
405+
406+
assert cast(Any, response.is_closed) is True
407+
408+
@parametrize
409+
async def test_path_params_list_scenario_runs(self, async_client: AsyncRunloop) -> None:
410+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
411+
await async_client.benchmarks.runs.with_raw_response.list_scenario_runs(
412+
id="",
413+
)

0 commit comments

Comments
 (0)