model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetModel(token, owner, name string) (*api.Model, error)
	CreateVersion(token, modelOwner, modelName, containerImageDigest, releaseNotes string,
		schemas map[string]any) (*api.Version, error)
}

API defines the interface for interacting with WriftAI's API v1.

type Console

type Console interface {
	Infof(format string, a ...interface{})
	Info(message string)
	Warning(message string)
	Warningf(format string, a ...interface{})
	Debugf(format string, a ...interface{})
}

Console defines the interface to output formatted messages

type Docker

type Docker interface {
	Build(dockerfileContent, imageName, platform, buildContext string) error
	Push(imageName string) (string, error)
	Run(imageName, platform, containerName string, rm,
		detach bool, gpus string, envVars, ports, volumes,
		command []string) (string, error)
}

Docker defines the interface for interacting with the Docker CLI.

If the required GPU driver is not available, implementations of model.Docker.Run must return docker.ErrMissingGPUDriver.

type Model

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

Model represents the struct used to handle model related operations.

func NewModel

func NewModel(api API, project Project, docker Docker,
	console Console, config *config.Config,
	wriftAIModelWheelName string, wriftAIModelWheelContent []byte) *Model

NewModel creates and returns a new Model struct instance.

func (*Model) Build

func (m *Model) Build() error

Build builds the model.

Returns an error if build fails.

func (*Model) Push

func (m *Model) Push(token, releaseNotes string) error

Push pushes the model by building and pushing it to WriftAI's registry and creating a new version of it by calling WriftAI's API.

token is the user's authorization token to make calls to WriftAI's API. releaseNotes is a string containing release notes for the new version.

Returns an error if push fails.

func (*Model) Serve

func (m *Model) Serve(envVars []string, port string, reload bool) error

Serve runs the model server by building it running its container.

Returns an error if serving fails.

type Project

type Project interface {
	ProjectDir() string
	WriteTmpFile(relativeFilePath string, content []byte) (string, error)
	CleanupTmpDir() error
}

Project defines the interface to handle project related operations

Jump to

Keyboard shortcuts

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