Skip to content

Commit 9ad6951

Browse files
feat(api): api update
1 parent 29a5e89 commit 9ad6951

34 files changed

+1969
-66
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: 93
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-5bf266bfc4635f690b764f54cbbcd71ff347622e3bfd8540a7d2a4d7d2d78be8.yml
3-
openapi_spec_hash: 3769820d0ac76caf6a1950802c73a382
4-
config_hash: 7d940dc50b19e75e3719c4d41fd0e8dd
1+
configured_endpoints: 100
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-feb1c5fb18adf1bfc11f6fc7ee95f08a319ce4a504c34c68dee66f090f69a70c.yml
3+
openapi_spec_hash: 758379882a3c4bf49f3ded6ac065a604
4+
config_hash: b97411af91b8ec0b8b066358c29091b4

api.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Shared Types
22

33
```python
4-
from runloop_api_client.types import AfterIdle, CodeMountParameters, LaunchParameters
4+
from runloop_api_client.types import AfterIdle, CodeMountParameters, LaunchParameters, RunProfile
55
```
66

77
# Benchmarks
@@ -326,6 +326,29 @@ Methods:
326326
- <code title="get /v1/scenarios/scorers">client.scenarios.scorers.<a href="./src/runloop_api_client/resources/scenarios/scorers.py">list</a>(\*\*<a href="src/runloop_api_client/types/scenarios/scorer_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenarios/scorer_list_response.py">SyncScenarioScorersCursorIDPage[ScorerListResponse]</a></code>
327327
- <code title="post /v1/scenarios/scorers/{id}/validate">client.scenarios.scorers.<a href="./src/runloop_api_client/resources/scenarios/scorers.py">validate</a>(id, \*\*<a href="src/runloop_api_client/types/scenarios/scorer_validate_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenarios/scorer_validate_response.py">ScorerValidateResponse</a></code>
328328

329+
# Objects
330+
331+
Types:
332+
333+
```python
334+
from runloop_api_client.types import (
335+
ObjectCreateParameters,
336+
ObjectDownloadURLView,
337+
ObjectListView,
338+
ObjectView,
339+
)
340+
```
341+
342+
Methods:
343+
344+
- <code title="post /v1/objects">client.objects.<a href="./src/runloop_api_client/resources/objects.py">create</a>(\*\*<a href="src/runloop_api_client/types/object_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/object_view.py">ObjectView</a></code>
345+
- <code title="get /v1/objects/{id}">client.objects.<a href="./src/runloop_api_client/resources/objects.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/object_view.py">ObjectView</a></code>
346+
- <code title="get /v1/objects">client.objects.<a href="./src/runloop_api_client/resources/objects.py">list</a>(\*\*<a href="src/runloop_api_client/types/object_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/object_view.py">SyncObjectsCursorIDPage[ObjectView]</a></code>
347+
- <code title="post /v1/objects/{id}/delete">client.objects.<a href="./src/runloop_api_client/resources/objects.py">delete</a>(id) -> <a href="./src/runloop_api_client/types/object_view.py">ObjectView</a></code>
348+
- <code title="post /v1/objects/{id}/complete">client.objects.<a href="./src/runloop_api_client/resources/objects.py">complete</a>(id) -> <a href="./src/runloop_api_client/types/object_view.py">ObjectView</a></code>
349+
- <code title="get /v1/objects/{id}/download">client.objects.<a href="./src/runloop_api_client/resources/objects.py">download</a>(id, \*\*<a href="src/runloop_api_client/types/object_download_params.py">params</a>) -> <a href="./src/runloop_api_client/types/object_download_url_view.py">ObjectDownloadURLView</a></code>
350+
- <code title="get /v1/objects/list_public">client.objects.<a href="./src/runloop_api_client/resources/objects.py">list_public</a>(\*\*<a href="src/runloop_api_client/types/object_list_public_params.py">params</a>) -> <a href="./src/runloop_api_client/types/object_view.py">SyncObjectsCursorIDPage[ObjectView]</a></code>
351+
329352
# Repositories
330353

331354
Types:

src/runloop_api_client/_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import secrets, blueprints, repositories
24+
from .resources import objects, secrets, blueprints, repositories
2525
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2626
from ._exceptions import RunloopError, APIStatusError
2727
from ._base_client import (
@@ -41,6 +41,7 @@ class Runloop(SyncAPIClient):
4141
blueprints: blueprints.BlueprintsResource
4242
devboxes: devboxes.DevboxesResource
4343
scenarios: scenarios.ScenariosResource
44+
objects: objects.ObjectsResource
4445
repositories: repositories.RepositoriesResource
4546
secrets: secrets.SecretsResource
4647
with_raw_response: RunloopWithRawResponse
@@ -106,6 +107,7 @@ def __init__(
106107
self.blueprints = blueprints.BlueprintsResource(self)
107108
self.devboxes = devboxes.DevboxesResource(self)
108109
self.scenarios = scenarios.ScenariosResource(self)
110+
self.objects = objects.ObjectsResource(self)
109111
self.repositories = repositories.RepositoriesResource(self)
110112
self.secrets = secrets.SecretsResource(self)
111113
self.with_raw_response = RunloopWithRawResponse(self)
@@ -221,6 +223,7 @@ class AsyncRunloop(AsyncAPIClient):
221223
blueprints: blueprints.AsyncBlueprintsResource
222224
devboxes: devboxes.AsyncDevboxesResource
223225
scenarios: scenarios.AsyncScenariosResource
226+
objects: objects.AsyncObjectsResource
224227
repositories: repositories.AsyncRepositoriesResource
225228
secrets: secrets.AsyncSecretsResource
226229
with_raw_response: AsyncRunloopWithRawResponse
@@ -286,6 +289,7 @@ def __init__(
286289
self.blueprints = blueprints.AsyncBlueprintsResource(self)
287290
self.devboxes = devboxes.AsyncDevboxesResource(self)
288291
self.scenarios = scenarios.AsyncScenariosResource(self)
292+
self.objects = objects.AsyncObjectsResource(self)
289293
self.repositories = repositories.AsyncRepositoriesResource(self)
290294
self.secrets = secrets.AsyncSecretsResource(self)
291295
self.with_raw_response = AsyncRunloopWithRawResponse(self)
@@ -402,6 +406,7 @@ def __init__(self, client: Runloop) -> None:
402406
self.blueprints = blueprints.BlueprintsResourceWithRawResponse(client.blueprints)
403407
self.devboxes = devboxes.DevboxesResourceWithRawResponse(client.devboxes)
404408
self.scenarios = scenarios.ScenariosResourceWithRawResponse(client.scenarios)
409+
self.objects = objects.ObjectsResourceWithRawResponse(client.objects)
405410
self.repositories = repositories.RepositoriesResourceWithRawResponse(client.repositories)
406411
self.secrets = secrets.SecretsResourceWithRawResponse(client.secrets)
407412

@@ -412,6 +417,7 @@ def __init__(self, client: AsyncRunloop) -> None:
412417
self.blueprints = blueprints.AsyncBlueprintsResourceWithRawResponse(client.blueprints)
413418
self.devboxes = devboxes.AsyncDevboxesResourceWithRawResponse(client.devboxes)
414419
self.scenarios = scenarios.AsyncScenariosResourceWithRawResponse(client.scenarios)
420+
self.objects = objects.AsyncObjectsResourceWithRawResponse(client.objects)
415421
self.repositories = repositories.AsyncRepositoriesResourceWithRawResponse(client.repositories)
416422
self.secrets = secrets.AsyncSecretsResourceWithRawResponse(client.secrets)
417423

@@ -422,6 +428,7 @@ def __init__(self, client: Runloop) -> None:
422428
self.blueprints = blueprints.BlueprintsResourceWithStreamingResponse(client.blueprints)
423429
self.devboxes = devboxes.DevboxesResourceWithStreamingResponse(client.devboxes)
424430
self.scenarios = scenarios.ScenariosResourceWithStreamingResponse(client.scenarios)
431+
self.objects = objects.ObjectsResourceWithStreamingResponse(client.objects)
425432
self.repositories = repositories.RepositoriesResourceWithStreamingResponse(client.repositories)
426433
self.secrets = secrets.SecretsResourceWithStreamingResponse(client.secrets)
427434

@@ -432,6 +439,7 @@ def __init__(self, client: AsyncRunloop) -> None:
432439
self.blueprints = blueprints.AsyncBlueprintsResourceWithStreamingResponse(client.blueprints)
433440
self.devboxes = devboxes.AsyncDevboxesResourceWithStreamingResponse(client.devboxes)
434441
self.scenarios = scenarios.AsyncScenariosResourceWithStreamingResponse(client.scenarios)
442+
self.objects = objects.AsyncObjectsResourceWithStreamingResponse(client.objects)
435443
self.repositories = repositories.AsyncRepositoriesResourceWithStreamingResponse(client.repositories)
436444
self.secrets = secrets.AsyncSecretsResourceWithStreamingResponse(client.secrets)
437445

src/runloop_api_client/pagination.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"AsyncScenarioRunsCursorIDPage",
2525
"SyncScenarioScorersCursorIDPage",
2626
"AsyncScenarioScorersCursorIDPage",
27+
"SyncObjectsCursorIDPage",
28+
"AsyncObjectsCursorIDPage",
2729
]
2830

2931
_T = TypeVar("_T")
@@ -74,6 +76,11 @@ class ScenarioScorersCursorIDPageItem(Protocol):
7476
id: str
7577

7678

79+
@runtime_checkable
80+
class ObjectsCursorIDPageItem(Protocol):
81+
id: str
82+
83+
7784
class SyncBlueprintsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
7885
blueprints: List[_T]
7986
has_more: Optional[bool] = None
@@ -684,3 +691,71 @@ def next_page_info(self) -> Optional[PageInfo]:
684691
return None
685692

686693
return PageInfo(params={"starting_after": item.id})
694+
695+
696+
class SyncObjectsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
697+
objects: List[_T]
698+
has_more: Optional[bool] = None
699+
total_count: Optional[int] = None
700+
701+
@override
702+
def _get_page_items(self) -> List[_T]:
703+
objects = self.objects
704+
if not objects:
705+
return []
706+
return objects
707+
708+
@override
709+
def has_next_page(self) -> bool:
710+
has_more = self.has_more
711+
if has_more is not None and has_more is False:
712+
return False
713+
714+
return super().has_next_page()
715+
716+
@override
717+
def next_page_info(self) -> Optional[PageInfo]:
718+
objects = self.objects
719+
if not objects:
720+
return None
721+
722+
item = cast(Any, objects[-1])
723+
if not isinstance(item, ObjectsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison]
724+
# TODO emit warning log
725+
return None
726+
727+
return PageInfo(params={"starting_after": item.id})
728+
729+
730+
class AsyncObjectsCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
731+
objects: List[_T]
732+
has_more: Optional[bool] = None
733+
total_count: Optional[int] = None
734+
735+
@override
736+
def _get_page_items(self) -> List[_T]:
737+
objects = self.objects
738+
if not objects:
739+
return []
740+
return objects
741+
742+
@override
743+
def has_next_page(self) -> bool:
744+
has_more = self.has_more
745+
if has_more is not None and has_more is False:
746+
return False
747+
748+
return super().has_next_page()
749+
750+
@override
751+
def next_page_info(self) -> Optional[PageInfo]:
752+
objects = self.objects
753+
if not objects:
754+
return None
755+
756+
item = cast(Any, objects[-1])
757+
if not isinstance(item, ObjectsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison]
758+
# TODO emit warning log
759+
return None
760+
761+
return PageInfo(params={"starting_after": item.id})

src/runloop_api_client/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .objects import (
4+
ObjectsResource,
5+
AsyncObjectsResource,
6+
ObjectsResourceWithRawResponse,
7+
AsyncObjectsResourceWithRawResponse,
8+
ObjectsResourceWithStreamingResponse,
9+
AsyncObjectsResourceWithStreamingResponse,
10+
)
311
from .secrets import (
412
SecretsResource,
513
AsyncSecretsResource,
@@ -74,6 +82,12 @@
7482
"AsyncScenariosResourceWithRawResponse",
7583
"ScenariosResourceWithStreamingResponse",
7684
"AsyncScenariosResourceWithStreamingResponse",
85+
"ObjectsResource",
86+
"AsyncObjectsResource",
87+
"ObjectsResourceWithRawResponse",
88+
"AsyncObjectsResourceWithRawResponse",
89+
"ObjectsResourceWithStreamingResponse",
90+
"AsyncObjectsResourceWithStreamingResponse",
7791
"RepositoriesResource",
7892
"AsyncRepositoriesResource",
7993
"RepositoriesResourceWithRawResponse",

src/runloop_api_client/resources/benchmarks/benchmarks.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from ..._base_client import AsyncPaginator, make_request_options
3737
from ...types.benchmark_view import BenchmarkView
3838
from ...types.benchmark_run_view import BenchmarkRunView
39+
from ...types.shared_params.run_profile import RunProfile
3940
from ...types.scenario_definition_list_view import ScenarioDefinitionListView
4041

4142
__all__ = ["BenchmarksResource", "AsyncBenchmarksResource"]
@@ -69,6 +70,8 @@ def create(
6970
self,
7071
*,
7172
name: str,
73+
attribution: Optional[str] | NotGiven = NOT_GIVEN,
74+
description: Optional[str] | NotGiven = NOT_GIVEN,
7275
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
7376
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
7477
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
@@ -87,6 +90,10 @@ def create(
8790
Args:
8891
name: The name of the Benchmark. This must be unique.
8992
93+
attribution: Attribution information for the benchmark.
94+
95+
description: Detailed description of the benchmark.
96+
9097
metadata: User defined metadata to attach to the benchmark for organization.
9198
9299
required_environment_variables: Environment variables required to run the benchmark. If any required variables
@@ -113,6 +120,8 @@ def create(
113120
body=maybe_transform(
114121
{
115122
"name": name,
123+
"attribution": attribution,
124+
"description": description,
116125
"metadata": metadata,
117126
"required_environment_variables": required_environment_variables,
118127
"required_secret_names": required_secret_names,
@@ -168,6 +177,8 @@ def update(
168177
id: str,
169178
*,
170179
name: str,
180+
attribution: Optional[str] | NotGiven = NOT_GIVEN,
181+
description: Optional[str] | NotGiven = NOT_GIVEN,
171182
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
172183
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
173184
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
@@ -186,6 +197,10 @@ def update(
186197
Args:
187198
name: The name of the Benchmark. This must be unique.
188199
200+
attribution: Attribution information for the benchmark.
201+
202+
description: Detailed description of the benchmark.
203+
189204
metadata: User defined metadata to attach to the benchmark for organization.
190205
191206
required_environment_variables: Environment variables required to run the benchmark. If any required variables
@@ -214,6 +229,8 @@ def update(
214229
body=maybe_transform(
215230
{
216231
"name": name,
232+
"attribution": attribution,
233+
"description": description,
217234
"metadata": metadata,
218235
"required_environment_variables": required_environment_variables,
219236
"required_secret_names": required_secret_names,
@@ -380,7 +397,7 @@ def start_run(
380397
benchmark_id: str,
381398
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
382399
run_name: Optional[str] | NotGiven = NOT_GIVEN,
383-
run_profile: Optional[benchmark_start_run_params.RunProfile] | NotGiven = NOT_GIVEN,
400+
run_profile: Optional[RunProfile] | NotGiven = NOT_GIVEN,
384401
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
385402
# The extra values given here take precedence over values defined on the client or passed to this method.
386403
extra_headers: Headers | None = None,
@@ -461,6 +478,8 @@ async def create(
461478
self,
462479
*,
463480
name: str,
481+
attribution: Optional[str] | NotGiven = NOT_GIVEN,
482+
description: Optional[str] | NotGiven = NOT_GIVEN,
464483
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
465484
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
466485
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
@@ -479,6 +498,10 @@ async def create(
479498
Args:
480499
name: The name of the Benchmark. This must be unique.
481500
501+
attribution: Attribution information for the benchmark.
502+
503+
description: Detailed description of the benchmark.
504+
482505
metadata: User defined metadata to attach to the benchmark for organization.
483506
484507
required_environment_variables: Environment variables required to run the benchmark. If any required variables
@@ -505,6 +528,8 @@ async def create(
505528
body=await async_maybe_transform(
506529
{
507530
"name": name,
531+
"attribution": attribution,
532+
"description": description,
508533
"metadata": metadata,
509534
"required_environment_variables": required_environment_variables,
510535
"required_secret_names": required_secret_names,
@@ -560,6 +585,8 @@ async def update(
560585
id: str,
561586
*,
562587
name: str,
588+
attribution: Optional[str] | NotGiven = NOT_GIVEN,
589+
description: Optional[str] | NotGiven = NOT_GIVEN,
563590
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
564591
required_environment_variables: Optional[List[str]] | NotGiven = NOT_GIVEN,
565592
required_secret_names: List[str] | NotGiven = NOT_GIVEN,
@@ -578,6 +605,10 @@ async def update(
578605
Args:
579606
name: The name of the Benchmark. This must be unique.
580607
608+
attribution: Attribution information for the benchmark.
609+
610+
description: Detailed description of the benchmark.
611+
581612
metadata: User defined metadata to attach to the benchmark for organization.
582613
583614
required_environment_variables: Environment variables required to run the benchmark. If any required variables
@@ -606,6 +637,8 @@ async def update(
606637
body=await async_maybe_transform(
607638
{
608639
"name": name,
640+
"attribution": attribution,
641+
"description": description,
609642
"metadata": metadata,
610643
"required_environment_variables": required_environment_variables,
611644
"required_secret_names": required_secret_names,
@@ -772,7 +805,7 @@ async def start_run(
772805
benchmark_id: str,
773806
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
774807
run_name: Optional[str] | NotGiven = NOT_GIVEN,
775-
run_profile: Optional[benchmark_start_run_params.RunProfile] | NotGiven = NOT_GIVEN,
808+
run_profile: Optional[RunProfile] | NotGiven = NOT_GIVEN,
776809
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
777810
# The extra values given here take precedence over values defined on the client or passed to this method.
778811
extra_headers: Headers | None = None,

0 commit comments

Comments
 (0)