Documentation
¶
Index ¶
- Variables
- func DockerClientForContext(cli *command.DockerCli, name string) (*clientpkg.Client, error)
- type BackendStatus
- type Client
- func (c *Client) Chat(model, prompt string) error
- func (c *Client) DF() (DiskUsage, error)
- func (c *Client) Inspect(model string) (Model, error)
- func (c *Client) InspectOpenAI(model string) (OpenAIModel, error)
- func (c *Client) List() ([]Model, error)
- func (c *Client) ListOpenAI() (OpenAIModelList, error)
- func (c *Client) PS() ([]BackendStatus, error)
- func (c *Client) Pull(model string, progress func(string)) (string, bool, error)
- func (c *Client) Push(model string, progress func(string)) (string, bool, error)
- func (c *Client) Remove(models []string, force bool) (string, error)
- func (c *Client) Status() Status
- func (c *Client) Tag(source, targetRepo, targetTag string) (string, error)
- func (c *Client) Unload(req UnloadRequest) (UnloadResponse, error)
- type Config
- type DiskUsage
- type DockerHttpClient
- type Format
- type Model
- type ModelRunnerContext
- type ModelRunnerEngineKind
- type OpenAIChatMessage
- type OpenAIChatRequest
- type OpenAIChatResponse
- type OpenAIModel
- type OpenAIModelList
- type ProgressMessage
- type Status
- type UnloadRequest
- type UnloadResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("model not found") )
var Version = "dev"
Functions ¶
Types ¶
type BackendStatus ¶ added in v0.1.25
type BackendStatus struct {
// BackendName is the name of the backend
BackendName string `json:"backend_name"`
// ModelName is the name of the model loaded in the backend
ModelName string `json:"model_name"`
// Mode is the mode the backend is operating in
Mode string `json:"mode"`
// LastUsed represents when this backend was last used (if it's idle)
LastUsed time.Time `json:"last_used,omitempty"`
}
BackendStatus to be imported from docker/model-runner when https://github.com/docker/model-runner/pull/42 is merged.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(modelRunner *ModelRunnerContext) *Client
func (*Client) InspectOpenAI ¶
func (c *Client) InspectOpenAI(model string) (OpenAIModel, error)
func (*Client) ListOpenAI ¶
func (c *Client) ListOpenAI() (OpenAIModelList, error)
func (*Client) PS ¶ added in v0.1.25
func (c *Client) PS() ([]BackendStatus, error)
func (*Client) Unload ¶ added in v0.1.25
func (c *Client) Unload(req UnloadRequest) (UnloadResponse, error)
type DiskUsage ¶ added in v0.1.25
type DiskUsage struct {
ModelsDiskUsage float64 `json:"models_disk_usage"`
DefaultBackendDiskUsage float64 `json:"default_backend_disk_usage"`
}
DiskUsage to be imported from docker/model-runner when https://github.com/docker/model-runner/pull/45 is merged.
type DockerHttpClient ¶
type Format ¶
type Format string
TODO: To be replaced by the Model struct from pianta's common/pkg/inference/models/api.go. (https://github.com/docker/pinata/pull/33331)
type Model ¶
type Model struct {
// ID is the globally unique model identifier.
ID string `json:"id"`
// Tags are the list of tags associated with the model.
Tags []string `json:"tags"`
// Created is the Unix epoch timestamp corresponding to the model creation.
Created int64 `json:"created"`
// Config describes the model.
Config Config `json:"config"`
}
type ModelRunnerContext ¶ added in v0.1.20
type ModelRunnerContext struct {
// contains filtered or unexported fields
}
ModelRunnerContext encodes the operational context of a Model CLI command and provides facilities for inspecting and interacting with the Model Runner.
func DetectContext ¶ added in v0.1.20
func DetectContext(cli *command.DockerCli) (*ModelRunnerContext, error)
DetectContext determines the current Docker Model Runner context.
func NewContextForMock ¶ added in v0.1.20
func NewContextForMock(client DockerHttpClient) *ModelRunnerContext
NewContextForMock is a ModelRunnerContext constructor exposed only for the purposes of mock testing.
func (*ModelRunnerContext) Client ¶ added in v0.1.20
func (c *ModelRunnerContext) Client() DockerHttpClient
Client returns an HTTP client appropriate for accessing the model runner.
func (*ModelRunnerContext) EngineKind ¶ added in v0.1.20
func (c *ModelRunnerContext) EngineKind() ModelRunnerEngineKind
EngineKind returns the Docker engine kind associated with the model runner.
func (*ModelRunnerContext) URL ¶ added in v0.1.20
func (c *ModelRunnerContext) URL(path string) string
URL constructs a URL string appropriate for the model runner.
type ModelRunnerEngineKind ¶ added in v0.1.20
type ModelRunnerEngineKind uint8
ModelRunnerEngineKind encodes the kind of Docker engine associated with the model runner context.
const ( // ModelRunnerEngineKindMoby represents a non-Desktop/Cloud engine on which // the Model CLI command is responsible for managing a Model Runner. ModelRunnerEngineKindMoby ModelRunnerEngineKind = iota // ModelRunnerEngineKindMobyManual represents a non-Desktop/Cloud engine // that's explicitly targeted by a MODEL_RUNNER_HOST environment variable on // which the user is responsible for managing a Model Runner. ModelRunnerEngineKindMobyManual // ModelRunnerEngineKindDesktop represents a Docker Desktop engine. It only // refers to a Docker Desktop Linux engine, i.e. not a Windows container // engine in the case of Docker Desktop for Windows. ModelRunnerEngineKindDesktop // ModelRunnerEngineKindCloud represents a Docker Cloud engine. ModelRunnerEngineKindCloud )
func (ModelRunnerEngineKind) String ¶ added in v0.1.20
func (k ModelRunnerEngineKind) String() string
String returns a human-readable engine kind description.
type OpenAIChatMessage ¶
type OpenAIChatRequest ¶
type OpenAIChatRequest struct {
Model string `json:"model"`
Messages []OpenAIChatMessage `json:"messages"`
Stream bool `json:"stream"`
}
type OpenAIChatResponse ¶
type OpenAIChatResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []struct {
Delta struct {
Content string `json:"content"`
Role string `json:"role,omitempty"`
} `json:"delta"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
}
type OpenAIModel ¶
type OpenAIModelList ¶
type OpenAIModelList struct {
Object string `json:"object"`
Data []*OpenAIModel `json:"data"`
}
type ProgressMessage ¶
type ProgressMessage struct {
Type string `json:"type"` // "progress", "success", or "error"
Message string `json:"message"` // Human-readable message
}
ProgressMessage represents a message sent during model pull operations
type UnloadRequest ¶ added in v0.1.25
type UnloadRequest struct {
All bool `json:"all"`
Backend string `json:"backend"`
Model string `json:"model"`
}
UnloadRequest to be imported from docker/model-runner when https://github.com/docker/model-runner/pull/46 is merged.
type UnloadResponse ¶ added in v0.1.25
type UnloadResponse struct {
UnloadedRunners int `json:"unloaded_runners"`
}
UnloadResponse to be imported from docker/model-runner when https://github.com/docker/model-runner/pull/46 is merged.