Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-b45f922f6a041550870a96f5acec02aa6d8830046fc98b95a275c6486f7586fc.yml
openapi_spec_hash: ef7fddfb49b4d9c440b0635d2c86f341
config_hash: 919042036f115da833f492aa6f7e3ada
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-37bb31ed76da599d3bded543a3765f745c8575d105c13554df7f8361c3641482.yml
openapi_spec_hash: 15bdec12ca84042768bfb28cc48dfce3
config_hash: 810de4c2eee1a7649263cff01f00da7c
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.1.0-alpha.2 (2025-04-16)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/replicate/replicate-python-stainless/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** api update ([79f022a](https://github.com/replicate/replicate-python-stainless/commit/79f022aa879e6c0688197557795e04ffecd93f52))


### Chores

* update SDK settings ([ee5fd8b](https://github.com/replicate/replicate-python-stainless/commit/ee5fd8b119cb4a53467e71a5c52dac4fc1779385))

## 0.1.0-alpha.1 (2025-04-15)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/replicate/replicate-python-stainless/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
8 changes: 7 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ Methods:

# Models

Types:

```python
from replicate.types import ModelListResponse
```

Methods:

- <code title="post /models">client.models.<a href="./src/replicate/resources/models/models.py">create</a>(\*\*<a href="src/replicate/types/model_create_params.py">params</a>) -> None</code>
- <code title="get /models/{model_owner}/{model_name}">client.models.<a href="./src/replicate/resources/models/models.py">retrieve</a>(model_name, \*, model_owner) -> None</code>
- <code title="get /models">client.models.<a href="./src/replicate/resources/models/models.py">list</a>() -> None</code>
- <code title="get /models">client.models.<a href="./src/replicate/resources/models/models.py">list</a>() -> <a href="./src/replicate/types/model_list_response.py">SyncCursorURLPage[ModelListResponse]</a></code>
- <code title="delete /models/{model_owner}/{model_name}">client.models.<a href="./src/replicate/resources/models/models.py">delete</a>(model_name, \*, model_owner) -> None</code>
- <code title="post /models/{model_owner}/{model_name}/predictions">client.models.<a href="./src/replicate/resources/models/models.py">create_prediction</a>(model_name, \*, model_owner, \*\*<a href="src/replicate/types/model_create_prediction_params.py">params</a>) -> <a href="./src/replicate/types/prediction.py">Prediction</a></code>

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "replicate-stainless"
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
description = "The official Python library for the replicate-client API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "replicate"
__version__ = "0.1.0-alpha.1" # x-release-please-version
__version__ = "0.1.0-alpha.2" # x-release-please-version
22 changes: 12 additions & 10 deletions src/replicate/resources/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options
from ...pagination import SyncCursorURLPage, AsyncCursorURLPage
from ..._base_client import AsyncPaginator, make_request_options
from ...types.prediction import Prediction
from ...types.model_list_response import ModelListResponse

__all__ = ["ModelsResource", "AsyncModelsResource"]

Expand Down Expand Up @@ -290,7 +292,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> SyncCursorURLPage[ModelListResponse]:
"""
Get a paginated list of public models.

Expand All @@ -307,13 +309,13 @@ def list(
See the [`models.get`](#models.get) docs for more details about the model
object.
"""
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._get(
return self._get_api_list(
"/models",
page=SyncCursorURLPage[ModelListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
model=ModelListResponse,
)

def delete(
Expand Down Expand Up @@ -758,7 +760,7 @@ async def retrieve(
cast_to=NoneType,
)

async def list(
def list(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -767,7 +769,7 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
) -> AsyncPaginator[ModelListResponse, AsyncCursorURLPage[ModelListResponse]]:
"""
Get a paginated list of public models.

Expand All @@ -784,13 +786,13 @@ async def list(
See the [`models.get`](#models.get) docs for more details about the model
object.
"""
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._get(
return self._get_api_list(
"/models",
page=AsyncCursorURLPage[ModelListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
model=ModelListResponse,
)

async def delete(
Expand Down
1 change: 1 addition & 0 deletions src/replicate/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .prediction import Prediction as Prediction
from .prediction_output import PredictionOutput as PredictionOutput
from .model_create_params import ModelCreateParams as ModelCreateParams
from .model_list_response import ModelListResponse as ModelListResponse
from .account_list_response import AccountListResponse as AccountListResponse
from .hardware_list_response import HardwareListResponse as HardwareListResponse
from .prediction_list_params import PredictionListParams as PredictionListParams
Expand Down
46 changes: 46 additions & 0 deletions src/replicate/types/model_list_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

from .._models import BaseModel

__all__ = ["ModelListResponse"]


class ModelListResponse(BaseModel):
cover_image_url: Optional[str] = None
"""A URL for the model's cover image"""

default_example: Optional[object] = None
"""The model's default example prediction"""

description: Optional[str] = None
"""A description of the model"""

github_url: Optional[str] = None
"""A URL for the model's source code on GitHub"""

latest_version: Optional[object] = None
"""The model's latest version"""

license_url: Optional[str] = None
"""A URL for the model's license"""

name: Optional[str] = None
"""The name of the model"""

owner: Optional[str] = None
"""The name of the user or organization that owns the model"""

paper_url: Optional[str] = None
"""A URL for the model's paper"""

run_count: Optional[int] = None
"""The number of times the model has been run"""

url: Optional[str] = None
"""The URL of the model on Replicate"""

visibility: Optional[Literal["public", "private"]] = None
"""Whether the model is public or private"""
15 changes: 8 additions & 7 deletions tests/api_resources/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

from replicate import ReplicateClient, AsyncReplicateClient
from tests.utils import assert_matches_type
from replicate.types import Prediction
from replicate.types import Prediction, ModelListResponse
from replicate.pagination import SyncCursorURLPage, AsyncCursorURLPage

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand Down Expand Up @@ -132,7 +133,7 @@ def test_path_params_retrieve(self, client: ReplicateClient) -> None:
@parametrize
def test_method_list(self, client: ReplicateClient) -> None:
model = client.models.list()
assert model is None
assert_matches_type(SyncCursorURLPage[ModelListResponse], model, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -142,7 +143,7 @@ def test_raw_response_list(self, client: ReplicateClient) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
model = response.parse()
assert model is None
assert_matches_type(SyncCursorURLPage[ModelListResponse], model, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -152,7 +153,7 @@ def test_streaming_response_list(self, client: ReplicateClient) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

model = response.parse()
assert model is None
assert_matches_type(SyncCursorURLPage[ModelListResponse], model, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -398,7 +399,7 @@ async def test_path_params_retrieve(self, async_client: AsyncReplicateClient) ->
@parametrize
async def test_method_list(self, async_client: AsyncReplicateClient) -> None:
model = await async_client.models.list()
assert model is None
assert_matches_type(AsyncCursorURLPage[ModelListResponse], model, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -408,7 +409,7 @@ async def test_raw_response_list(self, async_client: AsyncReplicateClient) -> No
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
model = await response.parse()
assert model is None
assert_matches_type(AsyncCursorURLPage[ModelListResponse], model, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -418,7 +419,7 @@ async def test_streaming_response_list(self, async_client: AsyncReplicateClient)
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

model = await response.parse()
assert model is None
assert_matches_type(AsyncCursorURLPage[ModelListResponse], model, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down