Skip to main content

Classes

SyncClient

Constructor Parameters

Class Variables

Properties

Methods

cancel

Returns: NoneType

get_handle

Returns: SyncRequestHandle

realtime

Returns: Iterator[RealtimeConnection]

result

Returns: dict[str, Any]

run

Run an application with the given arguments (which will be JSON serialized).Returns: dict[str, Any]

status

Returns: Status

stream

Stream the output of an application with the given arguments (which will be JSON serialized). This is only supported at a few select applications at the moment, so be sure to first consult with the documentation of individual applications to see if this is supported.The function will iterate over each event that is streamed from the server.Returns: Iterator[dict[str, Any]]

submit

Submit an application with the given arguments (which will be JSON serialized).Returns: SyncRequestHandle

subscribe

Subscribe to an application and wait for the result.Returns: dict[str, Any]

upload

Upload the given data blob to the CDN and return the access URL. The content type should be specified as the second argument. Use upload_file or upload_image for convenience.Returns: str

upload_file

Upload a file from the local filesystem to the CDN and return the access URL.Returns: str

upload_image

Upload a pillow image object to the CDN and return the access URL.

ws_connect

AsyncClient

Constructor Parameters

Class Variables

Methods

cancel

Returns: NoneType

get_handle

Returns: AsyncRequestHandle

realtime

Returns: AsyncIterator[AsyncRealtimeConnection]

result

Returns: dict[str, Any]

run

Run an application with the given arguments (which will be JSON serialized). The path parameter can be used to specify a subpath when applicable. This method will return the result of the inference call directly.Returns: dict[str, Any]

status

Returns: Status

stream

Stream the output of an application with the given arguments (which will be JSON serialized). This is only supported at a few select applications at the moment, so be sure to first consult with the documentation of individual applications to see if this is supported.The function will iterate over each event that is streamed from the server.Returns: AsyncIterator[dict[str, Any]]

submit

Submit an application with the given arguments (which will be JSON serialized). The path parameter can be used to specify a subpath when applicable. This method will return a handle to the request that can be used to check the status and retrieve the result of the inference call when it is done.Returns: AsyncRequestHandle

subscribe

Subscribe to an application and wait for the result.Returns: dict[str, Any]

upload

Upload the given data blob to the CDN and return the access URL. The content type should be specified as the second argument. Use upload_file or upload_image for convenience.Returns: str

upload_file

Upload a file from the local filesystem to the CDN and return the access URL.Returns: str

upload_image

Upload a pillow image object to the CDN and return the access URL.

ws_connect

RealtimeConnection

Synchronous realtime connection wrapper.

Constructor Parameters

Methods

close

Returns: NoneType

recv

Returns: dict[str, Any] | None

send

Returns: NoneType

AsyncRealtimeConnection

Asynchronous realtime connection wrapper.

Constructor Parameters

Methods

close

Returns: NoneType

recv

Returns: dict[str, Any] | None

send

Returns: NoneType

Status

Queued

Indicates the request is enqueued and waiting to be processed. The position field indicates the relative position in the queue (0-indexed).
Inherits from: Status

Constructor Parameters

Class Variables

InProgress

Indicates the request is currently being processed. If the status operation called with the with_logs parameter set to True, the logs field will be a list of log objects.
Inherits from: Status

Constructor Parameters

Class Variables

Completed

Indicates the request has been completed and the result can be gathered. The logs field will contain the logs if the status operation was called with the with_logs parameter set to True. Metrics might contain the inference time, and other internal metadata (number of tokens processed, etc.).
Inherits from: Status

Constructor Parameters

Class Variables

SyncRequestHandle

Inherits from: _BaseRequestHandle

Constructor Parameters

Class Variables

Methods

cancel

Cancel the request.Returns: NoneType

from_request_id

Returns: SyncRequestHandle

get

Wait till the request is completed and return the result of the inference call.Returns: dict[str, Any]

iter_events

Continuously poll for the status of the request and yield it at each interval till the request is completed. If with_logs is True, logs will be included in the response.Returns: Iterator[Status]

status

Returns the status of the request (which can be one of the following: Queued, InProgress, Completed). If with_logs is True, logs will be included for InProgress and Completed statuses.Returns: Status

AsyncRequestHandle

Inherits from: _BaseRequestHandle

Constructor Parameters

Class Variables

Methods

cancel

Cancel the request.Returns: NoneType

from_request_id

Returns: AsyncRequestHandle

get

Wait till the request is completed and return the result.Returns: dict[str, Any]

iter_events

Continuously poll for the status of the request and yield it at each interval till the request is completed. If with_logs is True, logs will be included in the response.Returns: AsyncIterator[Status]

status

Returns the status of the request (which can be one of the following: Queued, InProgress, Completed). If with_logs is True, logs will be included for InProgress and Completed statuses.Returns: Status

Functions

run

Run an application with the given arguments (which will be JSON serialized). Returns: dict[str, Any]

subscribe_async

Subscribe to an application and wait for the result. Returns: dict[str, Any]

subscribe

Subscribe to an application and wait for the result. Returns: dict[str, Any]

submit

Submit an application with the given arguments (which will be JSON serialized). Returns: SyncRequestHandle

stream

Stream the output of an application with the given arguments (which will be JSON serialized). This is only supported at a few select applications at the moment, so be sure to first consult with the documentation of individual applications to see if this is supported. The function will iterate over each event that is streamed from the server. Returns: Iterator[dict[str, Any]]

run_async

Run an application with the given arguments (which will be JSON serialized). The path parameter can be used to specify a subpath when applicable. This method will return the result of the inference call directly. Returns: dict[str, Any]

submit_async

Submit an application with the given arguments (which will be JSON serialized). The path parameter can be used to specify a subpath when applicable. This method will return a handle to the request that can be used to check the status and retrieve the result of the inference call when it is done. Returns: AsyncRequestHandle

stream_async

Stream the output of an application with the given arguments (which will be JSON serialized). This is only supported at a few select applications at the moment, so be sure to first consult with the documentation of individual applications to see if this is supported. The function will iterate over each event that is streamed from the server. Returns: AsyncIterator[dict[str, Any]]

realtime

Returns: Iterator[RealtimeConnection]

realtime_async

Returns: AsyncIterator[AsyncRealtimeConnection]

cancel

Returns: NoneType

cancel_async

Returns: NoneType

status

Returns: Status

status_async

Returns: Status

result

Returns: dict[str, Any]

result_async

Returns: dict[str, Any]

encode

Encode the given data blob to a data URL with the specified content type. Returns: str

encode_file

Encode a file from the local filesystem to a data URL with the inferred content type. Returns: str

encode_image

Encode a pillow image object to a data URL with the specified format.