Skip to content

Commit 13313f8

Browse files
committed
Added placeholder run method
1 parent fdf1072 commit 13313f8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/replicate_client/_client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,24 @@ def _make_status_error(
227227
if response.status_code >= 500:
228228
return _exceptions.InternalServerError(err_msg, response=response, body=body)
229229
return APIStatusError(err_msg, response=response, body=body)
230+
231+
def run(
232+
self,
233+
ref: str,
234+
input: dict[str, Any] | None = None,
235+
*,
236+
use_file_output: bool = True,
237+
) -> Any:
238+
"""
239+
Example custom method
240+
241+
"""
242+
243+
# there is some custom logic like run you can embed
244+
# e.g. version, owner, name, version_id = identifier._resolve(ref)
245+
prediction = self.predictions.create(version = "placeholder", input=input)
246+
247+
return prediction.output
230248

231249

232250
class AsyncReplicateClient(AsyncAPIClient):
@@ -411,6 +429,7 @@ def _make_status_error(
411429
return APIStatusError(err_msg, response=response, body=body)
412430

413431

432+
414433
class ReplicateClientWithRawResponse:
415434
def __init__(self, client: ReplicateClient) -> None:
416435
self.collections = collections.CollectionsResourceWithRawResponse(client.collections)

0 commit comments

Comments
 (0)