Search Results for

    Show / Hide Table of Contents

    Class PredictionService

    Handles the full lifecycle of a Replicate prediction: create ??poll ??download image bytes.

    Inheritance
    object
    CrudServiceBase<ReplicateClient>
    PredictionService
    Implements
    ICrudService
    Inherited Members
    CrudServiceBase<ReplicateClient>.client
    CrudServiceBase<ReplicateClient>.ApiKey
    CrudServiceBase<ReplicateClient>.GetUrl(params string[])
    CrudServiceBase<ReplicateClient>.GetChildUrl(string, params string[])
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Replicate
    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
    Type Name Description
    ReplicateClient client

    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
    Type Name Description
    string predictionId
    RequestOptions options
    Returns
    Type Description
    UniTask<ReplicatePrediction>
    | 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
    Type Name Description
    ImageGenerationRequest request
    CancellationToken cancellationToken
    Returns
    Type Description
    UniTask<ReplicatePrediction>
    | 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
    Type Name Description
    string ownerModelPath
    Dictionary<string, object> input
    RequestOptions options
    Returns
    Type Description
    UniTask<ReplicatePrediction>
    | 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
    Type Name Description
    string versionHash
    Dictionary<string, object> input
    RequestOptions options
    Returns
    Type Description
    UniTask<ReplicatePrediction>
    | 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
    Type Name Description
    string predictionId
    RequestOptions options
    Returns
    Type Description
    UniTask<ReplicatePrediction>

    Implements

    ICrudService

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation