Versions in this module Expand all Collapse all v0 v0.0.2 Dec 5, 2023 Changes in this version + const SSETypeDone + const SSETypeError + const SSETypeLogs + const SSETypeOutput + var ErrInvalidIdentifier = errors.New(...) + var ErrInvalidUTF8Data = errors.New("invalid UTF-8 data") + var ErrNoAuth = errors.New(...) + var WebhookEventAll = []WebhookEventType + func Paginate[T any](ctx context.Context, client *Client, initialPage *Page[T]) (<-chan []T, <-chan error) + type APIError struct + Detail string + Instance string + Status int + Title string + Type string + func (e *APIError) WriteHTTPResponse(w http.ResponseWriter) + func (e APIError) Error() string + type Backoff interface + NextDelay func(retries int) time.Duration + type Client struct + func NewClient(opts ...ClientOption) (*Client, error) + func (r *Client) CancelPrediction(ctx context.Context, id string) (*Prediction, error) + func (r *Client) CancelTraining(ctx context.Context, trainingID string) (*Training, error) + func (r *Client) CreateModel(ctx context.Context, modelOwner string, modelName string, ...) (*Model, error) + func (r *Client) CreatePrediction(ctx context.Context, version string, input PredictionInput, webhook *Webhook, ...) (*Prediction, error) + func (r *Client) CreatePredictionWithDeployment(ctx context.Context, deployment_owner string, deployment_name string, ...) (*Prediction, error) + func (r *Client) CreatePredictionWithModel(ctx context.Context, modelOwner string, modelName string, ...) (*Prediction, error) + func (r *Client) CreateTraining(ctx context.Context, model_owner string, model_name string, version string, ...) (*Training, error) + func (r *Client) GetCollection(ctx context.Context, slug string) (*Collection, error) + func (r *Client) GetModel(ctx context.Context, modelOwner string, modelName string) (*Model, error) + func (r *Client) GetModelVersion(ctx context.Context, modelOwner string, modelName string, versionID string) (*ModelVersion, error) + func (r *Client) GetPrediction(ctx context.Context, id string) (*Prediction, error) + func (r *Client) GetTraining(ctx context.Context, trainingID string) (*Training, error) + func (r *Client) ListCollections(ctx context.Context) (*Page[Collection], error) + func (r *Client) ListHardware(ctx context.Context) (*[]Hardware, error) + func (r *Client) ListModelVersions(ctx context.Context, modelOwner string, modelName string) (*Page[ModelVersion], error) + func (r *Client) ListModels(ctx context.Context) (*Page[Model], error) + func (r *Client) ListPredictions(ctx context.Context) (*Page[Prediction], error) + func (r *Client) ListTrainings(ctx context.Context) (*Page[Training], error) + func (r *Client) Run(ctx context.Context, identifier string, input PredictionInput, ...) (PredictionOutput, error) + func (r *Client) Stream(ctx context.Context, identifier string, input PredictionInput, ...) (<-chan SSEEvent, <-chan error) + func (r *Client) StreamPrediction(ctx context.Context, prediction *Prediction) (<-chan SSEEvent, <-chan error) + func (r *Client) Wait(ctx context.Context, prediction *Prediction, opts ...WaitOption) error + func (r *Client) WaitAsync(ctx context.Context, prediction *Prediction, opts ...WaitOption) (<-chan *Prediction, <-chan error) + type ClientOption func(*clientOptions) error + func WithBaseURL(baseURL string) ClientOption + func WithHTTPClient(httpClient *http.Client) ClientOption + func WithRetryPolicy(maxRetries int, backoff Backoff) ClientOption + func WithToken(token string) ClientOption + func WithTokenFromEnv() ClientOption + func WithUserAgent(userAgent string) ClientOption + type Collection struct + Description string + Models *[]Model + Name string + Slug string + func (c *Collection) UnmarshalJSON(data []byte) error + func (c Collection) MarshalJSON() ([]byte, error) + type ConstantBackoff struct + Base time.Duration + Jitter time.Duration + func (b *ConstantBackoff) NextDelay(retries int) time.Duration + type CreateModelOptions struct + CoverImageURL *string + Description *string + GithubURL *string + Hardware string + LicenseURL *string + PaperURL *string + Visibility string + type ExponentialBackoff struct + Base time.Duration + Jitter time.Duration + Multiplier float64 + func (b *ExponentialBackoff) NextDelay(retries int) time.Duration + type Hardware struct + Name string + SKU string + func (h *Hardware) UnmarshalJSON(data []byte) error + func (h Hardware) MarshalJSON() ([]byte, error) + type Identifier struct + Name string + Owner string + Version *string + func ParseIdentifier(identifier string) (*Identifier, error) + func (i *Identifier) String() string + type Model struct + CoverImageURL string + DefaultExample *Prediction + Description string + GithubURL string + LatestVersion *ModelVersion + LicenseURL string + Name string + Owner string + PaperURL string + RunCount int + URL string + Visibility string + func (m *Model) UnmarshalJSON(data []byte) error + func (m Model) MarshalJSON() ([]byte, error) + type ModelVersion struct + CogVersion string + CreatedAt string + ID string + OpenAPISchema interface{} + func (m *ModelVersion) UnmarshalJSON(data []byte) error + func (m ModelVersion) MarshalJSON() ([]byte, error) + type Page struct + Next *string + Previous *string + Results []T + func (p *Page[T]) UnmarshalJSON(data []byte) error + func (p Page[T]) MarshalJSON() ([]byte, error) + type Prediction struct + CompletedAt *string + CreatedAt string + Error interface{} + ID string + Input PredictionInput + Logs *string + Metrics ... + Model string + Output PredictionOutput + Source Source + StartedAt *string + Status Status + URLs map[string]string + Version string + Webhook *string + WebhookEventsFilter []WebhookEventType + func (p *Prediction) UnmarshalJSON(data []byte) error + func (p Prediction) MarshalJSON() ([]byte, error) + func (p Prediction) Progress() *PredictionProgress + type PredictionInput map[string]interface + type PredictionOutput interface + type PredictionProgress struct + Current int + Percentage float64 + Total int + type SSEEvent struct + Data string + ID string + Type string + func (e *SSEEvent) String() string + type Source string + const SourceAPI + const SourceWeb + type Status string + const Canceled + const Failed + const Processing + const Starting + const Succeeded + func (s Status) String() string + func (s Status) Terminated() bool + type Training Prediction + type TrainingInput PredictionInput + type WaitOption func(*waitOptions) error + func WithPollingInterval(interval time.Duration) WaitOption + type Webhook struct + Events []WebhookEventType + URL string + type WebhookEventType string + const WebhookEventCompleted + const WebhookEventLogs + const WebhookEventOutput + const WebhookEventStart + func (w WebhookEventType) String() string