replicate

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 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 (
	ErrMissingAPIKey = errors.New("replicate: missing API key (set Config.APIKey or REPLICATE_API_TOKEN)")
	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 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
}

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