api

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckHandler

type CheckHandler func(int) error

type Client

type Client interface {
	QueueTask(context.Context, QueueRequest) (QueueResponse, error)

	QueueTaskResult(context.Context, string) (QueueResult, error)

	ListQueuedTasks(context.Context) ([]QueueResult, error)

	QueueState(context.Context, string) (bool, error)
}

func NewClient

func NewClient(http *http.Client, cfg ClientConfig) Client

type ClientConfig

type ClientConfig struct {
	Endpoint string `json:"endpoint"`
	Token    string `json:"token,omitempty"`
	Model    string `json:"model,omitempty"`
}

type DoHandler

type DoHandler func([]byte) error

type QueueRequest

type QueueRequest struct {
	Prompt string `json:"prompt"`
	Model  string `json:"model,omitempty"`
	Style  string `json:"style,omitempty"`
}

type QueueResponse

type QueueResponse struct {
	Task   string      `json:"task"`
	State  string      `json:"state"`
	Pool   string      `json:"pool"`
	Result QueueResult `json:"result,omitempty"`
}

type QueueResult

type QueueResult struct {
	Text     string  `json:"text"`
	Model    string  `json:"model,omitempty"`
	Style    string  `json:"style,omitempty"`
	Duration float64 `json:"duration,omitempty"`
}

type Task

type Task interface {
	Queue(context.Context, string) error

	Wait(context.Context) error

	Result(context.Context) (string, error)
}

func NewTask

func NewTask(http *http.Client, cfg TaskConfig) Task

type TaskConfig

type TaskConfig struct {
	Endpoint string `json:"endpoint"`
	Token    string `json:"token,omitempty"`
	Model    string `json:"model,omitempty"`
	Style    string `json:"style,omitempty"`
}

Jump to

Keyboard shortcuts

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