Skip to content

Commit 1adc754

Browse files
chore: update OpenAPI spec and rebuild SDKs
1 parent 5203577 commit 1adc754

8 files changed

Lines changed: 48 additions & 9 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 36
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-a7e12a7c7df8c6596c7ca7d1ee26992bf3dcca90b553a66e15118fcd892e27f6.yml
3-
openapi_spec_hash: 33ca30d22504063d2248459550f9cb3b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-a6a1d53117b661ccba3fa9893e4598b8b21448cda3edbc907c4b8085d352203a.yml
3+
openapi_spec_hash: c1d5f3fe94e8f93f3d4247a5df7e3e7b
44
config_hash: 407acf62c906ee301314f2d23cdb58b1

‎src/replicate/resources/predictions.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ def get(
448448
Terminated predictions (with a status of `succeeded`, `failed`, or `canceled`)
449449
will include a `metrics` object with a `predict_time` property showing the
450450
amount of CPU or GPU time, in seconds, that the prediction used while running.
451-
It won't include time waiting for the prediction to start.
451+
It won't include time waiting for the prediction to start. The `metrics` object
452+
will also include a `total_time` property showing the total time, in seconds,
453+
that the prediction took to complete.
452454
453455
All input parameters, output values, and logs are automatically removed after an
454456
hour, by default, for predictions created through the API.
@@ -901,7 +903,9 @@ async def get(
901903
Terminated predictions (with a status of `succeeded`, `failed`, or `canceled`)
902904
will include a `metrics` object with a `predict_time` property showing the
903905
amount of CPU or GPU time, in seconds, that the prediction used while running.
904-
It won't include time waiting for the prediction to start.
906+
It won't include time waiting for the prediction to start. The `metrics` object
907+
will also include a `total_time` property showing the total time, in seconds,
908+
that the prediction took to complete.
905909
906910
All input parameters, output values, and logs are automatically removed after an
907911
hour, by default, for predictions created through the API.

‎src/replicate/resources/trainings.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ def get(
390390
Terminated trainings (with a status of `succeeded`, `failed`, or `canceled`)
391391
will include a `metrics` object with a `predict_time` property showing the
392392
amount of CPU or GPU time, in seconds, that the training used while running. It
393-
won't include time waiting for the training to start.
393+
won't include time waiting for the training to start. The `metrics` object will
394+
also include a `total_time` property showing the total time, in seconds, that
395+
the training took to complete.
394396
395397
Args:
396398
extra_headers: Send extra headers
@@ -774,7 +776,9 @@ async def get(
774776
Terminated trainings (with a status of `succeeded`, `failed`, or `canceled`)
775777
will include a `metrics` object with a `predict_time` property showing the
776778
amount of CPU or GPU time, in seconds, that the training used while running. It
777-
won't include time waiting for the training to start.
779+
won't include time waiting for the training to start. The `metrics` object will
780+
also include a `total_time` property showing the total time, in seconds, that
781+
the training took to complete.
778782
779783
Args:
780784
extra_headers: Send extra headers

‎src/replicate/types/prediction.py‎

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

3-
from typing import Dict, Union, Optional
3+
from typing import TYPE_CHECKING, Dict, Union, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

7+
from pydantic import Field as FieldInfo
8+
79
from .._models import BaseModel
810

9-
__all__ = ["Prediction", "URLs"]
11+
__all__ = ["Prediction", "URLs", "Metrics"]
1012

1113

1214
class URLs(BaseModel):
@@ -23,6 +25,23 @@ class URLs(BaseModel):
2325
"""An event source to stream the output of the prediction via API"""
2426

2527

28+
class Metrics(BaseModel):
29+
total_time: Optional[float] = None
30+
"""The total time, in seconds, that the prediction took to complete"""
31+
32+
if TYPE_CHECKING:
33+
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
34+
# value to this field, so for compatibility we avoid doing it at runtime.
35+
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
36+
37+
# Stub to indicate that arbitrary properties are accepted.
38+
# To access properties that are not valid identifiers you can use `getattr`, e.g.
39+
# `getattr(obj, '$type')`
40+
def __getattr__(self, attr: str) -> object: ...
41+
else:
42+
__pydantic_extra__: Dict[str, object]
43+
44+
2645
class Prediction(BaseModel):
2746
id: str
2847

@@ -64,7 +83,7 @@ class Prediction(BaseModel):
6483
logs: Optional[str] = None
6584
"""The log output from the model"""
6685

67-
metrics: Optional[Dict[str, object]] = None
86+
metrics: Optional[Metrics] = None
6887
"""Additional metrics associated with the prediction"""
6988

7089
started_at: Optional[datetime] = None

‎src/replicate/types/training_cancel_response.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class Metrics(BaseModel):
1313
predict_time: Optional[float] = None
1414
"""The amount of CPU or GPU time, in seconds, that the training used while running"""
1515

16+
total_time: Optional[float] = None
17+
"""The total time, in seconds, that the training took to complete"""
18+
1619

1720
class Output(BaseModel):
1821
version: Optional[str] = None

‎src/replicate/types/training_create_response.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class Metrics(BaseModel):
1313
predict_time: Optional[float] = None
1414
"""The amount of CPU or GPU time, in seconds, that the training used while running"""
1515

16+
total_time: Optional[float] = None
17+
"""The total time, in seconds, that the training took to complete"""
18+
1619

1720
class Output(BaseModel):
1821
version: Optional[str] = None

‎src/replicate/types/training_get_response.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class Metrics(BaseModel):
1313
predict_time: Optional[float] = None
1414
"""The amount of CPU or GPU time, in seconds, that the training used while running"""
1515

16+
total_time: Optional[float] = None
17+
"""The total time, in seconds, that the training took to complete"""
18+
1619

1720
class Output(BaseModel):
1821
version: Optional[str] = None

‎src/replicate/types/training_list_response.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class Metrics(BaseModel):
1313
predict_time: Optional[float] = None
1414
"""The amount of CPU or GPU time, in seconds, that the training used while running"""
1515

16+
total_time: Optional[float] = None
17+
"""The total time, in seconds, that the training took to complete"""
18+
1619

1720
class Output(BaseModel):
1821
version: Optional[str] = None

0 commit comments

Comments
 (0)