runloop_api_client 0.61.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. runloop_api_client/__init__.py +92 -0
  2. runloop_api_client/_base_client.py +1995 -0
  3. runloop_api_client/_client.py +668 -0
  4. runloop_api_client/_compat.py +219 -0
  5. runloop_api_client/_constants.py +14 -0
  6. runloop_api_client/_exceptions.py +108 -0
  7. runloop_api_client/_files.py +123 -0
  8. runloop_api_client/_models.py +835 -0
  9. runloop_api_client/_qs.py +150 -0
  10. runloop_api_client/_resource.py +43 -0
  11. runloop_api_client/_response.py +832 -0
  12. runloop_api_client/_streaming.py +520 -0
  13. runloop_api_client/_types.py +260 -0
  14. runloop_api_client/_utils/__init__.py +64 -0
  15. runloop_api_client/_utils/_compat.py +45 -0
  16. runloop_api_client/_utils/_datetime_parse.py +136 -0
  17. runloop_api_client/_utils/_logs.py +25 -0
  18. runloop_api_client/_utils/_proxy.py +65 -0
  19. runloop_api_client/_utils/_reflection.py +42 -0
  20. runloop_api_client/_utils/_resources_proxy.py +24 -0
  21. runloop_api_client/_utils/_streams.py +12 -0
  22. runloop_api_client/_utils/_sync.py +86 -0
  23. runloop_api_client/_utils/_transform.py +457 -0
  24. runloop_api_client/_utils/_typing.py +156 -0
  25. runloop_api_client/_utils/_utils.py +421 -0
  26. runloop_api_client/_version.py +4 -0
  27. runloop_api_client/lib/.keep +4 -0
  28. runloop_api_client/lib/polling.py +75 -0
  29. runloop_api_client/lib/polling_async.py +60 -0
  30. runloop_api_client/pagination.py +761 -0
  31. runloop_api_client/py.typed +0 -0
  32. runloop_api_client/resources/__init__.py +103 -0
  33. runloop_api_client/resources/benchmarks/__init__.py +33 -0
  34. runloop_api_client/resources/benchmarks/benchmarks.py +982 -0
  35. runloop_api_client/resources/benchmarks/runs.py +587 -0
  36. runloop_api_client/resources/blueprints.py +1206 -0
  37. runloop_api_client/resources/devboxes/__init__.py +89 -0
  38. runloop_api_client/resources/devboxes/browsers.py +267 -0
  39. runloop_api_client/resources/devboxes/computers.py +648 -0
  40. runloop_api_client/resources/devboxes/devboxes.py +3414 -0
  41. runloop_api_client/resources/devboxes/disk_snapshots.py +519 -0
  42. runloop_api_client/resources/devboxes/executions.py +1059 -0
  43. runloop_api_client/resources/devboxes/logs.py +197 -0
  44. runloop_api_client/resources/objects.py +860 -0
  45. runloop_api_client/resources/repositories.py +717 -0
  46. runloop_api_client/resources/scenarios/__init__.py +47 -0
  47. runloop_api_client/resources/scenarios/runs.py +949 -0
  48. runloop_api_client/resources/scenarios/scenarios.py +1079 -0
  49. runloop_api_client/resources/scenarios/scorers.py +629 -0
  50. runloop_api_client/resources/secrets.py +500 -0
  51. runloop_api_client/types/__init__.py +95 -0
  52. runloop_api_client/types/benchmark_create_params.py +40 -0
  53. runloop_api_client/types/benchmark_definitions_params.py +15 -0
  54. runloop_api_client/types/benchmark_list_params.py +15 -0
  55. runloop_api_client/types/benchmark_list_public_params.py +15 -0
  56. runloop_api_client/types/benchmark_run_list_view.py +19 -0
  57. runloop_api_client/types/benchmark_run_view.py +51 -0
  58. runloop_api_client/types/benchmark_start_run_params.py +25 -0
  59. runloop_api_client/types/benchmark_update_params.py +40 -0
  60. runloop_api_client/types/benchmark_view.py +45 -0
  61. runloop_api_client/types/benchmarks/__init__.py +6 -0
  62. runloop_api_client/types/benchmarks/run_list_params.py +18 -0
  63. runloop_api_client/types/benchmarks/run_list_scenario_runs_params.py +18 -0
  64. runloop_api_client/types/blueprint_build_log.py +16 -0
  65. runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
  66. runloop_api_client/types/blueprint_build_parameters.py +87 -0
  67. runloop_api_client/types/blueprint_create_params.py +90 -0
  68. runloop_api_client/types/blueprint_list_params.py +18 -0
  69. runloop_api_client/types/blueprint_list_public_params.py +18 -0
  70. runloop_api_client/types/blueprint_list_view.py +19 -0
  71. runloop_api_client/types/blueprint_preview_params.py +90 -0
  72. runloop_api_client/types/blueprint_preview_view.py +10 -0
  73. runloop_api_client/types/blueprint_view.py +86 -0
  74. runloop_api_client/types/devbox_async_execution_detail_view.py +40 -0
  75. runloop_api_client/types/devbox_create_params.py +70 -0
  76. runloop_api_client/types/devbox_create_ssh_key_response.py +16 -0
  77. runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
  78. runloop_api_client/types/devbox_download_file_params.py +15 -0
  79. runloop_api_client/types/devbox_execute_async_params.py +25 -0
  80. runloop_api_client/types/devbox_execute_params.py +34 -0
  81. runloop_api_client/types/devbox_execute_sync_params.py +25 -0
  82. runloop_api_client/types/devbox_execution_detail_view.py +24 -0
  83. runloop_api_client/types/devbox_list_disk_snapshots_params.py +29 -0
  84. runloop_api_client/types/devbox_list_params.py +20 -0
  85. runloop_api_client/types/devbox_list_view.py +19 -0
  86. runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
  87. runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
  88. runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
  89. runloop_api_client/types/devbox_snapshot_disk_async_params.py +16 -0
  90. runloop_api_client/types/devbox_snapshot_disk_params.py +16 -0
  91. runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
  92. runloop_api_client/types/devbox_snapshot_view.py +24 -0
  93. runloop_api_client/types/devbox_tunnel_view.py +16 -0
  94. runloop_api_client/types/devbox_update_params.py +16 -0
  95. runloop_api_client/types/devbox_upload_file_params.py +19 -0
  96. runloop_api_client/types/devbox_view.py +94 -0
  97. runloop_api_client/types/devbox_wait_for_command_params.py +25 -0
  98. runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
  99. runloop_api_client/types/devboxes/__init__.py +32 -0
  100. runloop_api_client/types/devboxes/browser_create_params.py +13 -0
  101. runloop_api_client/types/devboxes/browser_view.py +25 -0
  102. runloop_api_client/types/devboxes/computer_create_params.py +24 -0
  103. runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
  104. runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
  105. runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +30 -0
  106. runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
  107. runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
  108. runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
  109. runloop_api_client/types/devboxes/computer_view.py +19 -0
  110. runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
  111. runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
  112. runloop_api_client/types/devboxes/disk_snapshot_list_params.py +29 -0
  113. runloop_api_client/types/devboxes/disk_snapshot_update_params.py +16 -0
  114. runloop_api_client/types/devboxes/execution_execute_async_params.py +25 -0
  115. runloop_api_client/types/devboxes/execution_execute_sync_params.py +25 -0
  116. runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
  117. runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
  118. runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +14 -0
  119. runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +14 -0
  120. runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
  121. runloop_api_client/types/devboxes/log_list_params.py +15 -0
  122. runloop_api_client/types/input_context.py +15 -0
  123. runloop_api_client/types/input_context_param.py +16 -0
  124. runloop_api_client/types/input_context_update_param.py +16 -0
  125. runloop_api_client/types/object_create_params.py +19 -0
  126. runloop_api_client/types/object_download_params.py +12 -0
  127. runloop_api_client/types/object_download_url_view.py +10 -0
  128. runloop_api_client/types/object_list_params.py +27 -0
  129. runloop_api_client/types/object_list_public_params.py +27 -0
  130. runloop_api_client/types/object_list_view.py +22 -0
  131. runloop_api_client/types/object_view.py +28 -0
  132. runloop_api_client/types/repository_connection_list_view.py +19 -0
  133. runloop_api_client/types/repository_connection_view.py +16 -0
  134. runloop_api_client/types/repository_create_params.py +22 -0
  135. runloop_api_client/types/repository_inspection_details.py +77 -0
  136. runloop_api_client/types/repository_inspection_list_view.py +13 -0
  137. runloop_api_client/types/repository_list_params.py +21 -0
  138. runloop_api_client/types/repository_manifest_view.py +158 -0
  139. runloop_api_client/types/repository_refresh_params.py +16 -0
  140. runloop_api_client/types/scenario_create_params.py +53 -0
  141. runloop_api_client/types/scenario_definition_list_view.py +19 -0
  142. runloop_api_client/types/scenario_environment.py +25 -0
  143. runloop_api_client/types/scenario_environment_param.py +27 -0
  144. runloop_api_client/types/scenario_list_params.py +21 -0
  145. runloop_api_client/types/scenario_list_public_params.py +18 -0
  146. runloop_api_client/types/scenario_run_list_view.py +19 -0
  147. runloop_api_client/types/scenario_run_view.py +50 -0
  148. runloop_api_client/types/scenario_start_run_params.py +28 -0
  149. runloop_api_client/types/scenario_update_params.py +46 -0
  150. runloop_api_client/types/scenario_view.py +57 -0
  151. runloop_api_client/types/scenarios/__init__.py +14 -0
  152. runloop_api_client/types/scenarios/run_list_params.py +18 -0
  153. runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
  154. runloop_api_client/types/scenarios/scorer_create_response.py +16 -0
  155. runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
  156. runloop_api_client/types/scenarios/scorer_list_response.py +16 -0
  157. runloop_api_client/types/scenarios/scorer_retrieve_response.py +16 -0
  158. runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
  159. runloop_api_client/types/scenarios/scorer_update_response.py +16 -0
  160. runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
  161. runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
  162. runloop_api_client/types/scoring_contract.py +13 -0
  163. runloop_api_client/types/scoring_contract_param.py +15 -0
  164. runloop_api_client/types/scoring_contract_result_view.py +16 -0
  165. runloop_api_client/types/scoring_contract_update_param.py +15 -0
  166. runloop_api_client/types/scoring_function.py +135 -0
  167. runloop_api_client/types/scoring_function_param.py +131 -0
  168. runloop_api_client/types/scoring_function_result_view.py +21 -0
  169. runloop_api_client/types/secret_create_params.py +23 -0
  170. runloop_api_client/types/secret_list_params.py +12 -0
  171. runloop_api_client/types/secret_list_view.py +22 -0
  172. runloop_api_client/types/secret_update_params.py +16 -0
  173. runloop_api_client/types/secret_view.py +22 -0
  174. runloop_api_client/types/shared/__init__.py +6 -0
  175. runloop_api_client/types/shared/after_idle.py +15 -0
  176. runloop_api_client/types/shared/code_mount_parameters.py +24 -0
  177. runloop_api_client/types/shared/launch_parameters.py +79 -0
  178. runloop_api_client/types/shared/run_profile.py +33 -0
  179. runloop_api_client/types/shared_params/__init__.py +6 -0
  180. runloop_api_client/types/shared_params/after_idle.py +15 -0
  181. runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
  182. runloop_api_client/types/shared_params/launch_parameters.py +81 -0
  183. runloop_api_client/types/shared_params/run_profile.py +34 -0
  184. runloop_api_client-0.61.0.dist-info/METADATA +496 -0
  185. runloop_api_client-0.61.0.dist-info/RECORD +187 -0
  186. runloop_api_client-0.61.0.dist-info/WHEEL +4 -0
  187. runloop_api_client-0.61.0.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,587 @@
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 Literal
6
+
7
+ import httpx
8
+
9
+ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10
+ from ..._utils import maybe_transform
11
+ from ..._compat import cached_property
12
+ from ..._resource import SyncAPIResource, AsyncAPIResource
13
+ from ..._response import (
14
+ to_raw_response_wrapper,
15
+ to_streamed_response_wrapper,
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ )
19
+ from ...pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage
20
+ from ..._base_client import AsyncPaginator, make_request_options
21
+ from ...types.benchmarks import run_list_params, run_list_scenario_runs_params
22
+ from ...types.scenario_run_view import ScenarioRunView
23
+ from ...types.benchmark_run_view import BenchmarkRunView
24
+
25
+ __all__ = ["RunsResource", "AsyncRunsResource"]
26
+
27
+
28
+ class RunsResource(SyncAPIResource):
29
+ @cached_property
30
+ def with_raw_response(self) -> RunsResourceWithRawResponse:
31
+ """
32
+ This property can be used as a prefix for any HTTP method call to return
33
+ the raw response object instead of the parsed content.
34
+
35
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
36
+ """
37
+ return RunsResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> RunsResourceWithStreamingResponse:
41
+ """
42
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
+
44
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
45
+ """
46
+ return RunsResourceWithStreamingResponse(self)
47
+
48
+ def retrieve(
49
+ self,
50
+ id: str,
51
+ *,
52
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
53
+ # The extra values given here take precedence over values defined on the client or passed to this method.
54
+ extra_headers: Headers | None = None,
55
+ extra_query: Query | None = None,
56
+ extra_body: Body | None = None,
57
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
58
+ ) -> BenchmarkRunView:
59
+ """
60
+ Get a BenchmarkRun given ID.
61
+
62
+ Args:
63
+ extra_headers: Send extra headers
64
+
65
+ extra_query: Add additional query parameters to the request
66
+
67
+ extra_body: Add additional JSON properties to the request
68
+
69
+ timeout: Override the client-level default timeout for this request, in seconds
70
+ """
71
+ if not id:
72
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
73
+ return self._get(
74
+ f"/v1/benchmarks/runs/{id}",
75
+ options=make_request_options(
76
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
77
+ ),
78
+ cast_to=BenchmarkRunView,
79
+ )
80
+
81
+ def list(
82
+ self,
83
+ *,
84
+ benchmark_id: str | Omit = omit,
85
+ limit: int | Omit = omit,
86
+ starting_after: str | Omit = omit,
87
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
88
+ # The extra values given here take precedence over values defined on the client or passed to this method.
89
+ extra_headers: Headers | None = None,
90
+ extra_query: Query | None = None,
91
+ extra_body: Body | None = None,
92
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
93
+ ) -> SyncBenchmarkRunsCursorIDPage[BenchmarkRunView]:
94
+ """
95
+ List all BenchmarkRuns matching filter.
96
+
97
+ Args:
98
+ benchmark_id: The Benchmark ID to filter by.
99
+
100
+ limit: The limit of items to return. Default is 20.
101
+
102
+ starting_after: Load the next page of data starting after the item with the given ID.
103
+
104
+ extra_headers: Send extra headers
105
+
106
+ extra_query: Add additional query parameters to the request
107
+
108
+ extra_body: Add additional JSON properties to the request
109
+
110
+ timeout: Override the client-level default timeout for this request, in seconds
111
+ """
112
+ return self._get_api_list(
113
+ "/v1/benchmarks/runs",
114
+ page=SyncBenchmarkRunsCursorIDPage[BenchmarkRunView],
115
+ options=make_request_options(
116
+ extra_headers=extra_headers,
117
+ extra_query=extra_query,
118
+ extra_body=extra_body,
119
+ timeout=timeout,
120
+ query=maybe_transform(
121
+ {
122
+ "benchmark_id": benchmark_id,
123
+ "limit": limit,
124
+ "starting_after": starting_after,
125
+ },
126
+ run_list_params.RunListParams,
127
+ ),
128
+ ),
129
+ model=BenchmarkRunView,
130
+ )
131
+
132
+ def cancel(
133
+ self,
134
+ id: str,
135
+ *,
136
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
137
+ # The extra values given here take precedence over values defined on the client or passed to this method.
138
+ extra_headers: Headers | None = None,
139
+ extra_query: Query | None = None,
140
+ extra_body: Body | None = None,
141
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
142
+ idempotency_key: str | None = None,
143
+ ) -> BenchmarkRunView:
144
+ """
145
+ Cancel a currently running Benchmark run.
146
+
147
+ Args:
148
+ extra_headers: Send extra headers
149
+
150
+ extra_query: Add additional query parameters to the request
151
+
152
+ extra_body: Add additional JSON properties to the request
153
+
154
+ timeout: Override the client-level default timeout for this request, in seconds
155
+
156
+ idempotency_key: Specify a custom idempotency key for this request
157
+ """
158
+ if not id:
159
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
160
+ return self._post(
161
+ f"/v1/benchmarks/runs/{id}/cancel",
162
+ options=make_request_options(
163
+ extra_headers=extra_headers,
164
+ extra_query=extra_query,
165
+ extra_body=extra_body,
166
+ timeout=timeout,
167
+ idempotency_key=idempotency_key,
168
+ ),
169
+ cast_to=BenchmarkRunView,
170
+ )
171
+
172
+ def complete(
173
+ self,
174
+ id: str,
175
+ *,
176
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
177
+ # The extra values given here take precedence over values defined on the client or passed to this method.
178
+ extra_headers: Headers | None = None,
179
+ extra_query: Query | None = None,
180
+ extra_body: Body | None = None,
181
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
182
+ idempotency_key: str | None = None,
183
+ ) -> BenchmarkRunView:
184
+ """
185
+ Complete a currently running BenchmarkRun.
186
+
187
+ Args:
188
+ extra_headers: Send extra headers
189
+
190
+ extra_query: Add additional query parameters to the request
191
+
192
+ extra_body: Add additional JSON properties to the request
193
+
194
+ timeout: Override the client-level default timeout for this request, in seconds
195
+
196
+ idempotency_key: Specify a custom idempotency key for this request
197
+ """
198
+ if not id:
199
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
200
+ return self._post(
201
+ f"/v1/benchmarks/runs/{id}/complete",
202
+ options=make_request_options(
203
+ extra_headers=extra_headers,
204
+ extra_query=extra_query,
205
+ extra_body=extra_body,
206
+ timeout=timeout,
207
+ idempotency_key=idempotency_key,
208
+ ),
209
+ cast_to=BenchmarkRunView,
210
+ )
211
+
212
+ def list_scenario_runs(
213
+ self,
214
+ id: str,
215
+ *,
216
+ limit: int | Omit = omit,
217
+ starting_after: str | Omit = omit,
218
+ state: Literal["running", "scoring", "scored", "completed", "canceled", "timeout", "failed"] | Omit = omit,
219
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
220
+ # The extra values given here take precedence over values defined on the client or passed to this method.
221
+ extra_headers: Headers | None = None,
222
+ extra_query: Query | None = None,
223
+ extra_body: Body | None = None,
224
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
225
+ ) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView]:
226
+ """
227
+ List started scenario runs for a benchmark run.
228
+
229
+ Args:
230
+ limit: The limit of items to return. Default is 20.
231
+
232
+ starting_after: Load the next page of data starting after the item with the given ID.
233
+
234
+ state: Filter by Scenario Run state
235
+
236
+ extra_headers: Send extra headers
237
+
238
+ extra_query: Add additional query parameters to the request
239
+
240
+ extra_body: Add additional JSON properties to the request
241
+
242
+ timeout: Override the client-level default timeout for this request, in seconds
243
+ """
244
+ if not id:
245
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
246
+ return self._get_api_list(
247
+ f"/v1/benchmarks/runs/{id}/scenario_runs",
248
+ page=SyncBenchmarkRunsCursorIDPage[ScenarioRunView],
249
+ options=make_request_options(
250
+ extra_headers=extra_headers,
251
+ extra_query=extra_query,
252
+ extra_body=extra_body,
253
+ timeout=timeout,
254
+ query=maybe_transform(
255
+ {
256
+ "limit": limit,
257
+ "starting_after": starting_after,
258
+ "state": state,
259
+ },
260
+ run_list_scenario_runs_params.RunListScenarioRunsParams,
261
+ ),
262
+ ),
263
+ model=ScenarioRunView,
264
+ )
265
+
266
+
267
+ class AsyncRunsResource(AsyncAPIResource):
268
+ @cached_property
269
+ def with_raw_response(self) -> AsyncRunsResourceWithRawResponse:
270
+ """
271
+ This property can be used as a prefix for any HTTP method call to return
272
+ the raw response object instead of the parsed content.
273
+
274
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
275
+ """
276
+ return AsyncRunsResourceWithRawResponse(self)
277
+
278
+ @cached_property
279
+ def with_streaming_response(self) -> AsyncRunsResourceWithStreamingResponse:
280
+ """
281
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
282
+
283
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
284
+ """
285
+ return AsyncRunsResourceWithStreamingResponse(self)
286
+
287
+ async def retrieve(
288
+ self,
289
+ id: str,
290
+ *,
291
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
292
+ # The extra values given here take precedence over values defined on the client or passed to this method.
293
+ extra_headers: Headers | None = None,
294
+ extra_query: Query | None = None,
295
+ extra_body: Body | None = None,
296
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
297
+ ) -> BenchmarkRunView:
298
+ """
299
+ Get a BenchmarkRun given ID.
300
+
301
+ Args:
302
+ extra_headers: Send extra headers
303
+
304
+ extra_query: Add additional query parameters to the request
305
+
306
+ extra_body: Add additional JSON properties to the request
307
+
308
+ timeout: Override the client-level default timeout for this request, in seconds
309
+ """
310
+ if not id:
311
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
312
+ return await self._get(
313
+ f"/v1/benchmarks/runs/{id}",
314
+ options=make_request_options(
315
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
316
+ ),
317
+ cast_to=BenchmarkRunView,
318
+ )
319
+
320
+ def list(
321
+ self,
322
+ *,
323
+ benchmark_id: str | Omit = omit,
324
+ limit: int | Omit = omit,
325
+ starting_after: str | Omit = omit,
326
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
327
+ # The extra values given here take precedence over values defined on the client or passed to this method.
328
+ extra_headers: Headers | None = None,
329
+ extra_query: Query | None = None,
330
+ extra_body: Body | None = None,
331
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
332
+ ) -> AsyncPaginator[BenchmarkRunView, AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView]]:
333
+ """
334
+ List all BenchmarkRuns matching filter.
335
+
336
+ Args:
337
+ benchmark_id: The Benchmark ID to filter by.
338
+
339
+ limit: The limit of items to return. Default is 20.
340
+
341
+ starting_after: Load the next page of data starting after the item with the given ID.
342
+
343
+ extra_headers: Send extra headers
344
+
345
+ extra_query: Add additional query parameters to the request
346
+
347
+ extra_body: Add additional JSON properties to the request
348
+
349
+ timeout: Override the client-level default timeout for this request, in seconds
350
+ """
351
+ return self._get_api_list(
352
+ "/v1/benchmarks/runs",
353
+ page=AsyncBenchmarkRunsCursorIDPage[BenchmarkRunView],
354
+ options=make_request_options(
355
+ extra_headers=extra_headers,
356
+ extra_query=extra_query,
357
+ extra_body=extra_body,
358
+ timeout=timeout,
359
+ query=maybe_transform(
360
+ {
361
+ "benchmark_id": benchmark_id,
362
+ "limit": limit,
363
+ "starting_after": starting_after,
364
+ },
365
+ run_list_params.RunListParams,
366
+ ),
367
+ ),
368
+ model=BenchmarkRunView,
369
+ )
370
+
371
+ async def cancel(
372
+ self,
373
+ id: str,
374
+ *,
375
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
376
+ # The extra values given here take precedence over values defined on the client or passed to this method.
377
+ extra_headers: Headers | None = None,
378
+ extra_query: Query | None = None,
379
+ extra_body: Body | None = None,
380
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
381
+ idempotency_key: str | None = None,
382
+ ) -> BenchmarkRunView:
383
+ """
384
+ Cancel a currently running Benchmark run.
385
+
386
+ Args:
387
+ extra_headers: Send extra headers
388
+
389
+ extra_query: Add additional query parameters to the request
390
+
391
+ extra_body: Add additional JSON properties to the request
392
+
393
+ timeout: Override the client-level default timeout for this request, in seconds
394
+
395
+ idempotency_key: Specify a custom idempotency key for this request
396
+ """
397
+ if not id:
398
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
399
+ return await self._post(
400
+ f"/v1/benchmarks/runs/{id}/cancel",
401
+ options=make_request_options(
402
+ extra_headers=extra_headers,
403
+ extra_query=extra_query,
404
+ extra_body=extra_body,
405
+ timeout=timeout,
406
+ idempotency_key=idempotency_key,
407
+ ),
408
+ cast_to=BenchmarkRunView,
409
+ )
410
+
411
+ async def complete(
412
+ self,
413
+ id: str,
414
+ *,
415
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
416
+ # The extra values given here take precedence over values defined on the client or passed to this method.
417
+ extra_headers: Headers | None = None,
418
+ extra_query: Query | None = None,
419
+ extra_body: Body | None = None,
420
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
421
+ idempotency_key: str | None = None,
422
+ ) -> BenchmarkRunView:
423
+ """
424
+ Complete a currently running BenchmarkRun.
425
+
426
+ Args:
427
+ extra_headers: Send extra headers
428
+
429
+ extra_query: Add additional query parameters to the request
430
+
431
+ extra_body: Add additional JSON properties to the request
432
+
433
+ timeout: Override the client-level default timeout for this request, in seconds
434
+
435
+ idempotency_key: Specify a custom idempotency key for this request
436
+ """
437
+ if not id:
438
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
439
+ return await self._post(
440
+ f"/v1/benchmarks/runs/{id}/complete",
441
+ options=make_request_options(
442
+ extra_headers=extra_headers,
443
+ extra_query=extra_query,
444
+ extra_body=extra_body,
445
+ timeout=timeout,
446
+ idempotency_key=idempotency_key,
447
+ ),
448
+ cast_to=BenchmarkRunView,
449
+ )
450
+
451
+ def list_scenario_runs(
452
+ self,
453
+ id: str,
454
+ *,
455
+ limit: int | Omit = omit,
456
+ starting_after: str | Omit = omit,
457
+ state: Literal["running", "scoring", "scored", "completed", "canceled", "timeout", "failed"] | Omit = omit,
458
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
459
+ # The extra values given here take precedence over values defined on the client or passed to this method.
460
+ extra_headers: Headers | None = None,
461
+ extra_query: Query | None = None,
462
+ extra_body: Body | None = None,
463
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
464
+ ) -> AsyncPaginator[ScenarioRunView, AsyncBenchmarkRunsCursorIDPage[ScenarioRunView]]:
465
+ """
466
+ List started scenario runs for a benchmark run.
467
+
468
+ Args:
469
+ limit: The limit of items to return. Default is 20.
470
+
471
+ starting_after: Load the next page of data starting after the item with the given ID.
472
+
473
+ state: Filter by Scenario Run state
474
+
475
+ extra_headers: Send extra headers
476
+
477
+ extra_query: Add additional query parameters to the request
478
+
479
+ extra_body: Add additional JSON properties to the request
480
+
481
+ timeout: Override the client-level default timeout for this request, in seconds
482
+ """
483
+ if not id:
484
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
485
+ return self._get_api_list(
486
+ f"/v1/benchmarks/runs/{id}/scenario_runs",
487
+ page=AsyncBenchmarkRunsCursorIDPage[ScenarioRunView],
488
+ options=make_request_options(
489
+ extra_headers=extra_headers,
490
+ extra_query=extra_query,
491
+ extra_body=extra_body,
492
+ timeout=timeout,
493
+ query=maybe_transform(
494
+ {
495
+ "limit": limit,
496
+ "starting_after": starting_after,
497
+ "state": state,
498
+ },
499
+ run_list_scenario_runs_params.RunListScenarioRunsParams,
500
+ ),
501
+ ),
502
+ model=ScenarioRunView,
503
+ )
504
+
505
+
506
+ class RunsResourceWithRawResponse:
507
+ def __init__(self, runs: RunsResource) -> None:
508
+ self._runs = runs
509
+
510
+ self.retrieve = to_raw_response_wrapper(
511
+ runs.retrieve,
512
+ )
513
+ self.list = to_raw_response_wrapper(
514
+ runs.list,
515
+ )
516
+ self.cancel = to_raw_response_wrapper(
517
+ runs.cancel,
518
+ )
519
+ self.complete = to_raw_response_wrapper(
520
+ runs.complete,
521
+ )
522
+ self.list_scenario_runs = to_raw_response_wrapper(
523
+ runs.list_scenario_runs,
524
+ )
525
+
526
+
527
+ class AsyncRunsResourceWithRawResponse:
528
+ def __init__(self, runs: AsyncRunsResource) -> None:
529
+ self._runs = runs
530
+
531
+ self.retrieve = async_to_raw_response_wrapper(
532
+ runs.retrieve,
533
+ )
534
+ self.list = async_to_raw_response_wrapper(
535
+ runs.list,
536
+ )
537
+ self.cancel = async_to_raw_response_wrapper(
538
+ runs.cancel,
539
+ )
540
+ self.complete = async_to_raw_response_wrapper(
541
+ runs.complete,
542
+ )
543
+ self.list_scenario_runs = async_to_raw_response_wrapper(
544
+ runs.list_scenario_runs,
545
+ )
546
+
547
+
548
+ class RunsResourceWithStreamingResponse:
549
+ def __init__(self, runs: RunsResource) -> None:
550
+ self._runs = runs
551
+
552
+ self.retrieve = to_streamed_response_wrapper(
553
+ runs.retrieve,
554
+ )
555
+ self.list = to_streamed_response_wrapper(
556
+ runs.list,
557
+ )
558
+ self.cancel = to_streamed_response_wrapper(
559
+ runs.cancel,
560
+ )
561
+ self.complete = to_streamed_response_wrapper(
562
+ runs.complete,
563
+ )
564
+ self.list_scenario_runs = to_streamed_response_wrapper(
565
+ runs.list_scenario_runs,
566
+ )
567
+
568
+
569
+ class AsyncRunsResourceWithStreamingResponse:
570
+ def __init__(self, runs: AsyncRunsResource) -> None:
571
+ self._runs = runs
572
+
573
+ self.retrieve = async_to_streamed_response_wrapper(
574
+ runs.retrieve,
575
+ )
576
+ self.list = async_to_streamed_response_wrapper(
577
+ runs.list,
578
+ )
579
+ self.cancel = async_to_streamed_response_wrapper(
580
+ runs.cancel,
581
+ )
582
+ self.complete = async_to_streamed_response_wrapper(
583
+ runs.complete,
584
+ )
585
+ self.list_scenario_runs = async_to_streamed_response_wrapper(
586
+ runs.list_scenario_runs,
587
+ )