1616)
1717from ...pagination import SyncBenchmarkRunsCursorIDPage , AsyncBenchmarkRunsCursorIDPage
1818from ..._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
2021from ...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
210261class 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
395496class 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
413517class 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
431538class 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
449559class 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+ )
0 commit comments