replicate

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package replicate implements engine.Engine for the Replicate API.

Replicate is a multi-model platform. Predictions are async: POST /v1/predictions creates a prediction, GET /v1/predictions/{id} polls for completion. Auth: Authorization: Bearer {key}, env REPLICATE_API_TOKEN.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingModel  = errors.New("replicate: missing model version")
	ErrMissingPrompt = errors.New("replicate: missing prompt in workflow graph")
)

Functions

func ConfigSchema

func ConfigSchema() []engine.ConfigField

ConfigSchema returns the configuration fields required by the Replicate engine.

func DefaultProvider added in v0.15.0

func DefaultProvider() engine.Provider

DefaultProvider returns preset engine configurations for replicate.

func ModelInfos added in v0.16.0

func ModelInfos() []engine.ModelInfo

ModelInfos returns i18n metadata for the Replicate platform. Replicate hosts a wide range of open-source models; this registers a platform-level entry for discovery purposes.

func ModelsByCapability

func ModelsByCapability() map[string][]string

ModelsByCapability returns a placeholder — Replicate supports many models but the user specifies the exact version at configuration time.

Types

type Config

type Config struct {
	APIKey            string
	BaseURL           string
	Model             string // Full model version, e.g. "stability-ai/sdxl:abc123..."
	HTTPClient        *http.Client
	WaitForCompletion bool
	PollInterval      time.Duration
	OnProgress        epoll.OnProgress
}

Config configures the Replicate engine.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine implements engine.Engine for Replicate.

func New

func New(cfg Config) *Engine

New creates a Replicate engine instance.

func (*Engine) Capabilities

func (e *Engine) Capabilities() engine.Capability

Capabilities implements engine.Describer.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, g workflow.Graph) (engine.Result, error)

Execute runs a prediction on the Replicate API.

func (*Engine) Resume

func (e *Engine) Resume(ctx context.Context, remoteID string) (engine.Result, error)

Resume implements engine.Resumer — resumes polling a previously submitted task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL