Skip to content

Commit 0a187a9

Browse files
feat(api): api update
1 parent edb14b6 commit 0a187a9

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 35
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-661f1eceefb9f933f9834ee8fc503ed35473904eceb2467852157fae379b3641.yml
3-
openapi_spec_hash: 73a5fc50881bce84daef22ba4620c499
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-49078e632f99a7f21fdcd7763517de7118c680b2ff2b90bee601eb3d49ace321.yml
3+
openapi_spec_hash: baf550db5880018d99637a11dee48380
44
config_hash: 12536d2bf978a995771d076a4647c17d

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Methods:
7070
- <code title="get /models">replicate.models.<a href="./src/replicate/resources/models/models.py">list</a>() -> <a href="./src/replicate/types/model_list_response.py">SyncCursorURLPage[ModelListResponse]</a></code>
7171
- <code title="delete /models/{model_owner}/{model_name}">replicate.models.<a href="./src/replicate/resources/models/models.py">delete</a>(\*, model_owner, model_name) -> None</code>
7272
- <code title="get /models/{model_owner}/{model_name}">replicate.models.<a href="./src/replicate/resources/models/models.py">get</a>(\*, model_owner, model_name) -> <a href="./src/replicate/types/model_get_response.py">ModelGetResponse</a></code>
73-
- <code title="query /models">replicate.models.<a href="./src/replicate/resources/models/models.py">search</a>(\*\*<a href="src/replicate/types/model_search_params.py">params</a>) -> object</code>
73+
- <code title="query /models">replicate.models.<a href="./src/replicate/resources/models/models.py">search</a>(\*\*<a href="src/replicate/types/model_search_params.py">params</a>) -> SyncCursorURLPage[object]</code>
7474

7575
## Examples
7676

src/replicate/resources/models/models.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def search(
414414
extra_query: Query | None = None,
415415
extra_body: Body | None = None,
416416
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
417-
) -> object:
417+
) -> SyncCursorURLPage[object]:
418418
"""
419419
Get a list of public models matching a search query.
420420
@@ -445,13 +445,15 @@ def search(
445445
446446
timeout: Override the client-level default timeout for this request, in seconds
447447
"""
448-
return self._query(
448+
return self._get_api_list(
449449
"/models",
450+
page=SyncCursorURLPage[object],
450451
body=maybe_transform(body, model_search_params.ModelSearchParams),
451452
options=make_request_options(
452453
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
453454
),
454-
cast_to=object,
455+
model=object,
456+
method="query",
455457
)
456458

457459

@@ -802,7 +804,7 @@ async def get(
802804
cast_to=ModelGetResponse,
803805
)
804806

805-
async def search(
807+
def search(
806808
self,
807809
*,
808810
body: str,
@@ -812,7 +814,7 @@ async def search(
812814
extra_query: Query | None = None,
813815
extra_body: Body | None = None,
814816
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
815-
) -> object:
817+
) -> AsyncPaginator[object, AsyncCursorURLPage[object]]:
816818
"""
817819
Get a list of public models matching a search query.
818820
@@ -843,13 +845,15 @@ async def search(
843845
844846
timeout: Override the client-level default timeout for this request, in seconds
845847
"""
846-
return await self._query(
848+
return self._get_api_list(
847849
"/models",
848-
body=await async_maybe_transform(body, model_search_params.ModelSearchParams),
850+
page=AsyncCursorURLPage[object],
851+
body=maybe_transform(body, model_search_params.ModelSearchParams),
849852
options=make_request_options(
850853
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
851854
),
852-
cast_to=object,
855+
model=object,
856+
method="query",
853857
)
854858

855859

tests/api_resources/test_models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_method_search(self, client: Replicate) -> None:
215215
model = client.models.search(
216216
body="body",
217217
)
218-
assert_matches_type(object, model, path=["response"])
218+
assert_matches_type(SyncCursorURLPage[object], model, path=["response"])
219219

220220
@pytest.mark.skip(reason="Prism doesn't support query methods yet")
221221
@parametrize
@@ -227,7 +227,7 @@ def test_raw_response_search(self, client: Replicate) -> None:
227227
assert response.is_closed is True
228228
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
229229
model = response.parse()
230-
assert_matches_type(object, model, path=["response"])
230+
assert_matches_type(SyncCursorURLPage[object], model, path=["response"])
231231

232232
@pytest.mark.skip(reason="Prism doesn't support query methods yet")
233233
@parametrize
@@ -239,7 +239,7 @@ def test_streaming_response_search(self, client: Replicate) -> None:
239239
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
240240

241241
model = response.parse()
242-
assert_matches_type(object, model, path=["response"])
242+
assert_matches_type(SyncCursorURLPage[object], model, path=["response"])
243243

244244
assert cast(Any, response.is_closed) is True
245245

@@ -446,7 +446,7 @@ async def test_method_search(self, async_client: AsyncReplicate) -> None:
446446
model = await async_client.models.search(
447447
body="body",
448448
)
449-
assert_matches_type(object, model, path=["response"])
449+
assert_matches_type(AsyncCursorURLPage[object], model, path=["response"])
450450

451451
@pytest.mark.skip(reason="Prism doesn't support query methods yet")
452452
@parametrize
@@ -458,7 +458,7 @@ async def test_raw_response_search(self, async_client: AsyncReplicate) -> None:
458458
assert response.is_closed is True
459459
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
460460
model = await response.parse()
461-
assert_matches_type(object, model, path=["response"])
461+
assert_matches_type(AsyncCursorURLPage[object], model, path=["response"])
462462

463463
@pytest.mark.skip(reason="Prism doesn't support query methods yet")
464464
@parametrize
@@ -470,6 +470,6 @@ async def test_streaming_response_search(self, async_client: AsyncReplicate) ->
470470
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
471471

472472
model = await response.parse()
473-
assert_matches_type(object, model, path=["response"])
473+
assert_matches_type(AsyncCursorURLPage[object], model, path=["response"])
474474

475475
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)