Skip to content

Commit 33e82c8

Browse files
feat(api): manual updates (#20)
1 parent fdd9b17 commit 33e82c8

File tree

10 files changed

+81
-77
lines changed

10 files changed

+81
-77
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 27
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate-mpatankar%2Freplicate-client-b45f922f6a041550870a96f5acec02aa6d8830046fc98b95a275c6486f7586fc.yml
33
openapi_spec_hash: ef7fddfb49b4d9c440b0635d2c86f341
4-
config_hash: 0927aba56566832d6080b89e0dc97d6a
4+
config_hash: 5691e71e792eb8d38c4c91fa7efff22c

api.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Types:
1010

1111
```python
1212
from replicate.types import (
13-
PredictionRequest,
14-
PredictionResponse,
1513
DeploymentCreateResponse,
1614
DeploymentRetrieveResponse,
1715
DeploymentUpdateResponse,
@@ -32,7 +30,7 @@ Methods:
3230

3331
Methods:
3432

35-
- <code title="post /deployments/{deployment_owner}/{deployment_name}/predictions">client.deployments.predictions.<a href="./src/replicate/resources/deployments/predictions.py">create</a>(deployment_name, \*, deployment_owner, \*\*<a href="src/replicate/types/deployments/prediction_create_params.py">params</a>) -> <a href="./src/replicate/types/prediction_response.py">PredictionResponse</a></code>
33+
- <code title="post /deployments/{deployment_owner}/{deployment_name}/predictions">client.deployments.predictions.<a href="./src/replicate/resources/deployments/predictions.py">create</a>(deployment_name, \*, deployment_owner, \*\*<a href="src/replicate/types/deployments/prediction_create_params.py">params</a>) -> <a href="./src/replicate/types/prediction.py">Prediction</a></code>
3634

3735
# Hardware
3836

@@ -67,7 +65,7 @@ Methods:
6765
- <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>
6866
- <code title="get /models">client.models.<a href="./src/replicate/resources/models/models.py">list</a>() -> None</code>
6967
- <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>
70-
- <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_response.py">PredictionResponse</a></code>
68+
- <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>
7169

7270
## Versions
7371

@@ -80,12 +78,18 @@ Methods:
8078

8179
# Predictions
8280

81+
Types:
82+
83+
```python
84+
from replicate.types import Prediction, PredictionRequest
85+
```
86+
8387
Methods:
8488

85-
- <code title="post /predictions">client.predictions.<a href="./src/replicate/resources/predictions.py">create</a>(\*\*<a href="src/replicate/types/prediction_create_params.py">params</a>) -> <a href="./src/replicate/types/prediction_response.py">PredictionResponse</a></code>
86-
- <code title="get /predictions">client.predictions.<a href="./src/replicate/resources/predictions.py">list</a>(\*\*<a href="src/replicate/types/prediction_list_params.py">params</a>) -> <a href="./src/replicate/types/prediction_response.py">SyncCursorURLPage[PredictionResponse]</a></code>
89+
- <code title="post /predictions">client.predictions.<a href="./src/replicate/resources/predictions.py">create</a>(\*\*<a href="src/replicate/types/prediction_create_params.py">params</a>) -> <a href="./src/replicate/types/prediction.py">Prediction</a></code>
90+
- <code title="get /predictions">client.predictions.<a href="./src/replicate/resources/predictions.py">list</a>(\*\*<a href="src/replicate/types/prediction_list_params.py">params</a>) -> <a href="./src/replicate/types/prediction.py">SyncCursorURLPage[Prediction]</a></code>
8791
- <code title="post /predictions/{prediction_id}/cancel">client.predictions.<a href="./src/replicate/resources/predictions.py">cancel</a>(prediction_id) -> None</code>
88-
- <code title="get /predictions/{prediction_id}">client.predictions.<a href="./src/replicate/resources/predictions.py">list_by_id</a>(prediction_id) -> <a href="./src/replicate/types/prediction_response.py">PredictionResponse</a></code>
92+
- <code title="get /predictions/{prediction_id}">client.predictions.<a href="./src/replicate/resources/predictions.py">list_by_id</a>(prediction_id) -> <a href="./src/replicate/types/prediction.py">Prediction</a></code>
8993

9094
# Trainings
9195

src/replicate/resources/deployments/predictions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
async_to_streamed_response_wrapper,
2323
)
2424
from ..._base_client import make_request_options
25+
from ...types.prediction import Prediction
2526
from ...types.deployments import prediction_create_params
26-
from ...types.prediction_response import PredictionResponse
2727

2828
__all__ = ["PredictionsResource", "AsyncPredictionsResource"]
2929

@@ -64,7 +64,7 @@ def create(
6464
extra_query: Query | None = None,
6565
extra_body: Body | None = None,
6666
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
67-
) -> PredictionResponse:
67+
) -> Prediction:
6868
"""
6969
Create a prediction for the deployment and inputs you provide.
7070
@@ -181,7 +181,7 @@ def create(
181181
options=make_request_options(
182182
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
183183
),
184-
cast_to=PredictionResponse,
184+
cast_to=Prediction,
185185
)
186186

187187

@@ -221,7 +221,7 @@ async def create(
221221
extra_query: Query | None = None,
222222
extra_body: Body | None = None,
223223
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
224-
) -> PredictionResponse:
224+
) -> Prediction:
225225
"""
226226
Create a prediction for the deployment and inputs you provide.
227227
@@ -338,7 +338,7 @@ async def create(
338338
options=make_request_options(
339339
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
340340
),
341-
cast_to=PredictionResponse,
341+
cast_to=Prediction,
342342
)
343343

344344

src/replicate/resources/models/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
async_to_streamed_response_wrapper,
3232
)
3333
from ..._base_client import make_request_options
34-
from ...types.prediction_response import PredictionResponse
34+
from ...types.prediction import Prediction
3535

3636
__all__ = ["ModelsResource", "AsyncModelsResource"]
3737

@@ -388,7 +388,7 @@ def create_prediction(
388388
extra_query: Query | None = None,
389389
extra_body: Body | None = None,
390390
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
391-
) -> PredictionResponse:
391+
) -> Prediction:
392392
"""
393393
Create a prediction using an
394394
[official model](https://replicate.com/changelog/2025-01-29-official-models).
@@ -509,7 +509,7 @@ def create_prediction(
509509
options=make_request_options(
510510
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
511511
),
512-
cast_to=PredictionResponse,
512+
cast_to=Prediction,
513513
)
514514

515515

@@ -865,7 +865,7 @@ async def create_prediction(
865865
extra_query: Query | None = None,
866866
extra_body: Body | None = None,
867867
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
868-
) -> PredictionResponse:
868+
) -> Prediction:
869869
"""
870870
Create a prediction using an
871871
[official model](https://replicate.com/changelog/2025-01-29-official-models).
@@ -986,7 +986,7 @@ async def create_prediction(
986986
options=make_request_options(
987987
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
988988
),
989-
cast_to=PredictionResponse,
989+
cast_to=Prediction,
990990
)
991991

992992

src/replicate/resources/predictions.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
from ..pagination import SyncCursorURLPage, AsyncCursorURLPage
2727
from .._base_client import AsyncPaginator, make_request_options
28-
from ..types.prediction_response import PredictionResponse
28+
from ..types.prediction import Prediction
2929

3030
__all__ = ["PredictionsResource", "AsyncPredictionsResource"]
3131

@@ -65,7 +65,7 @@ def create(
6565
extra_query: Query | None = None,
6666
extra_body: Body | None = None,
6767
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
68-
) -> PredictionResponse:
68+
) -> Prediction:
6969
"""
7070
Create a prediction for the model version and inputs you provide.
7171
@@ -186,7 +186,7 @@ def create(
186186
options=make_request_options(
187187
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
188188
),
189-
cast_to=PredictionResponse,
189+
cast_to=Prediction,
190190
)
191191

192192
def list(
@@ -200,7 +200,7 @@ def list(
200200
extra_query: Query | None = None,
201201
extra_body: Body | None = None,
202202
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
203-
) -> SyncCursorURLPage[PredictionResponse]:
203+
) -> SyncCursorURLPage[Prediction]:
204204
"""
205205
Get a paginated list of all predictions created by the user or organization
206206
associated with the provided API token.
@@ -287,7 +287,7 @@ def list(
287287
"""
288288
return self._get_api_list(
289289
"/predictions",
290-
page=SyncCursorURLPage[PredictionResponse],
290+
page=SyncCursorURLPage[Prediction],
291291
options=make_request_options(
292292
extra_headers=extra_headers,
293293
extra_query=extra_query,
@@ -301,7 +301,7 @@ def list(
301301
prediction_list_params.PredictionListParams,
302302
),
303303
),
304-
model=PredictionResponse,
304+
model=Prediction,
305305
)
306306

307307
def cancel(
@@ -348,7 +348,7 @@ def list_by_id(
348348
extra_query: Query | None = None,
349349
extra_body: Body | None = None,
350350
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
351-
) -> PredictionResponse:
351+
) -> Prediction:
352352
"""
353353
Get the current state of a prediction.
354354
@@ -437,7 +437,7 @@ def list_by_id(
437437
options=make_request_options(
438438
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
439439
),
440-
cast_to=PredictionResponse,
440+
cast_to=Prediction,
441441
)
442442

443443

@@ -476,7 +476,7 @@ async def create(
476476
extra_query: Query | None = None,
477477
extra_body: Body | None = None,
478478
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
479-
) -> PredictionResponse:
479+
) -> Prediction:
480480
"""
481481
Create a prediction for the model version and inputs you provide.
482482
@@ -597,7 +597,7 @@ async def create(
597597
options=make_request_options(
598598
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
599599
),
600-
cast_to=PredictionResponse,
600+
cast_to=Prediction,
601601
)
602602

603603
def list(
@@ -611,7 +611,7 @@ def list(
611611
extra_query: Query | None = None,
612612
extra_body: Body | None = None,
613613
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
614-
) -> AsyncPaginator[PredictionResponse, AsyncCursorURLPage[PredictionResponse]]:
614+
) -> AsyncPaginator[Prediction, AsyncCursorURLPage[Prediction]]:
615615
"""
616616
Get a paginated list of all predictions created by the user or organization
617617
associated with the provided API token.
@@ -698,7 +698,7 @@ def list(
698698
"""
699699
return self._get_api_list(
700700
"/predictions",
701-
page=AsyncCursorURLPage[PredictionResponse],
701+
page=AsyncCursorURLPage[Prediction],
702702
options=make_request_options(
703703
extra_headers=extra_headers,
704704
extra_query=extra_query,
@@ -712,7 +712,7 @@ def list(
712712
prediction_list_params.PredictionListParams,
713713
),
714714
),
715-
model=PredictionResponse,
715+
model=Prediction,
716716
)
717717

718718
async def cancel(
@@ -759,7 +759,7 @@ async def list_by_id(
759759
extra_query: Query | None = None,
760760
extra_body: Body | None = None,
761761
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
762-
) -> PredictionResponse:
762+
) -> Prediction:
763763
"""
764764
Get the current state of a prediction.
765765
@@ -848,7 +848,7 @@ async def list_by_id(
848848
options=make_request_options(
849849
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
850850
),
851-
cast_to=PredictionResponse,
851+
cast_to=Prediction,
852852
)
853853

854854

src/replicate/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5+
from .prediction import Prediction as Prediction
56
from .model_create_params import ModelCreateParams as ModelCreateParams
6-
from .prediction_response import PredictionResponse as PredictionResponse
77
from .account_list_response import AccountListResponse as AccountListResponse
88
from .hardware_list_response import HardwareListResponse as HardwareListResponse
99
from .prediction_list_params import PredictionListParams as PredictionListParams

src/replicate/types/prediction_response.py renamed to src/replicate/types/prediction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .._models import BaseModel
88

9-
__all__ = ["PredictionResponse", "URLs"]
9+
__all__ = ["Prediction", "URLs"]
1010

1111

1212
class URLs(BaseModel):
@@ -20,7 +20,7 @@ class URLs(BaseModel):
2020
"""An event source to stream the output of the prediction"""
2121

2222

23-
class PredictionResponse(BaseModel):
23+
class Prediction(BaseModel):
2424
id: str
2525

2626
created_at: datetime

tests/api_resources/deployments/test_predictions.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from replicate import ReplicateClient, AsyncReplicateClient
1111
from tests.utils import assert_matches_type
12-
from replicate.types import PredictionResponse
12+
from replicate.types import Prediction
1313

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

@@ -25,7 +25,7 @@ def test_method_create(self, client: ReplicateClient) -> None:
2525
deployment_owner="deployment_owner",
2626
input={},
2727
)
28-
assert_matches_type(PredictionResponse, prediction, path=["response"])
28+
assert_matches_type(Prediction, prediction, path=["response"])
2929

3030
@pytest.mark.skip()
3131
@parametrize
@@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: ReplicateClient) -> None:
3939
webhook_events_filter=["start"],
4040
prefer="wait=5",
4141
)
42-
assert_matches_type(PredictionResponse, prediction, path=["response"])
42+
assert_matches_type(Prediction, prediction, path=["response"])
4343

4444
@pytest.mark.skip()
4545
@parametrize
@@ -53,7 +53,7 @@ def test_raw_response_create(self, client: ReplicateClient) -> None:
5353
assert response.is_closed is True
5454
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5555
prediction = response.parse()
56-
assert_matches_type(PredictionResponse, prediction, path=["response"])
56+
assert_matches_type(Prediction, prediction, path=["response"])
5757

5858
@pytest.mark.skip()
5959
@parametrize
@@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: ReplicateClient) -> None:
6767
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6868

6969
prediction = response.parse()
70-
assert_matches_type(PredictionResponse, prediction, path=["response"])
70+
assert_matches_type(Prediction, prediction, path=["response"])
7171

7272
assert cast(Any, response.is_closed) is True
7373

@@ -100,7 +100,7 @@ async def test_method_create(self, async_client: AsyncReplicateClient) -> None:
100100
deployment_owner="deployment_owner",
101101
input={},
102102
)
103-
assert_matches_type(PredictionResponse, prediction, path=["response"])
103+
assert_matches_type(Prediction, prediction, path=["response"])
104104

105105
@pytest.mark.skip()
106106
@parametrize
@@ -114,7 +114,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncReplicateC
114114
webhook_events_filter=["start"],
115115
prefer="wait=5",
116116
)
117-
assert_matches_type(PredictionResponse, prediction, path=["response"])
117+
assert_matches_type(Prediction, prediction, path=["response"])
118118

119119
@pytest.mark.skip()
120120
@parametrize
@@ -128,7 +128,7 @@ async def test_raw_response_create(self, async_client: AsyncReplicateClient) ->
128128
assert response.is_closed is True
129129
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
130130
prediction = await response.parse()
131-
assert_matches_type(PredictionResponse, prediction, path=["response"])
131+
assert_matches_type(Prediction, prediction, path=["response"])
132132

133133
@pytest.mark.skip()
134134
@parametrize
@@ -142,7 +142,7 @@ async def test_streaming_response_create(self, async_client: AsyncReplicateClien
142142
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
143143

144144
prediction = await response.parse()
145-
assert_matches_type(PredictionResponse, prediction, path=["response"])
145+
assert_matches_type(Prediction, prediction, path=["response"])
146146

147147
assert cast(Any, response.is_closed) is True
148148

0 commit comments

Comments
 (0)