PredictionsResource
Resource class for interacting with predictions.
Class: PredictionsResource
Resource class for interacting with predictions.
Extends
Constructors
Constructor
new PredictionsResource(
api,files):PredictionsResource
Initializes the Predictions resource.
Parameters
api
API
An instance of the API class.
files
An instance of the Files class.
Returns
PredictionsResource
Overrides
Methods
cancel()
cancel(
id,options?):Promise<void>
Cancel a prediction by its ID.
Parameters
id
string
The ID of the prediction to cancel.
options?
Options for the call.
Returns
Promise<void>
create()
create(
params):Promise<PredictionWithDetails>
Create a prediction. This method creates a prediction using either the latest version of a model or a specific model version. Files in the input are uploaded concurrently before the prediction is created.
Parameters
params
Parameters for prediction creation.
If wait is set, the prediction is awaited until it finishes; true
uses DEFAULT_CREATE_WAIT_OPTIONS and an object overrides
individual values. Otherwise it is returned immediately.
Returns
Promise<PredictionWithDetails>
The new prediction.
get()
get(
id,options?):Promise<PredictionWithDetails>
Get a prediction by its ID.
Parameters
id
string
The ID of the prediction to fetch.
options?
Options for the call.
Returns
Promise<PredictionWithDetails>
The prediction object.
list()
list(
options?):Promise<PaginatedResponse<Prediction>>
List predictions.
Parameters
options?
Options for listing predictions.
Returns
Promise<PaginatedResponse<Prediction>>
Paginated response containing predictions and navigation metadata.
wait()
wait(
predictionID,options?):Promise<PredictionWithDetails>
Waits for a prediction to complete. This method uses short polling to check the prediction status at regular intervals until it reaches a terminal state.
Parameters
predictionID
string
The ID of the prediction.
options?
Partial<PredictionWaitOptions> & CallOptions
Options for waiting. Any omitted values use DEFAULT_WAIT_OPTIONS.
Returns
Promise<PredictionWithDetails>
Prediction after completion.