Class PredictionService
Handles the full lifecycle of a Replicate prediction:
create ??poll ??download image bytes.
Inheritance
PredictionService
Assembly: Glitch9.AIDevKit.Provider.Replicate.dll
Syntax
public class PredictionService : CrudServiceBase<ReplicateClient>, ICrudService
Constructors
|
Edit this page
View Source
PredictionService(ReplicateClient)
Declaration
public PredictionService(ReplicateClient client)
Parameters
Methods
|
Edit this page
View Source
CancelAsync(string, RequestOptions)
Cancels an in-progress prediction.
POST /v1/predictions/{id}/cancel
Declaration
public UniTask<ReplicatePrediction> CancelAsync(string predictionId, RequestOptions options = null)
Parameters
Returns
|
Edit this page
View Source
CreateAndPollAsync(ImageGenerationRequest, CancellationToken)
Submits an image generation request to Replicate and polls until the prediction completes.
The caller is responsible for downloading any output URLs.
Declaration
public UniTask<ReplicatePrediction> CreateAndPollAsync(ImageGenerationRequest request, CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
CreateAsync(string, Dictionary<string, object>, RequestOptions)
Creates a prediction using the model-based endpoint:
POST /v1/models/{owner}/{model}/predictions
Declaration
public UniTask<ReplicatePrediction> CreateAsync(string ownerModelPath, Dictionary<string, object> input, RequestOptions options = null)
Parameters
Returns
|
Edit this page
View Source
CreateVersionedAsync(string, Dictionary<string, object>, RequestOptions)
Creates a prediction using the versioned endpoint:
POST /v1/predictions (requires explicit version hash in the body)
Declaration
public UniTask<ReplicatePrediction> CreateVersionedAsync(string versionHash, Dictionary<string, object> input, RequestOptions options = null)
Parameters
Returns
|
Edit this page
View Source
GetAsync(string, RequestOptions)
Retrieves the current state of a prediction.
GET /v1/predictions/{id}
Declaration
public UniTask<ReplicatePrediction> GetAsync(string predictionId, RequestOptions options = null)
Parameters
Returns
Implements
Extension Methods