desktop

package
v0.1.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = errors.New("model not found")
	ErrServiceUnavailable = errors.New("service unavailable")
)
View Source
var Version = "dev"

Functions

func URL

func URL(path string, dmrHost string) string

Types

type Client

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

func New

func New(dockerClient DockerHttpClient, dmrHost string) *Client

func (*Client) Chat

func (c *Client) Chat(model, prompt string) error

func (*Client) Inspect

func (c *Client) Inspect(model string) (Model, error)

func (*Client) InspectOpenAI

func (c *Client) InspectOpenAI(model string) (OpenAIModel, error)

func (*Client) List

func (c *Client) List() ([]Model, error)

func (*Client) ListOpenAI

func (c *Client) ListOpenAI() (OpenAIModelList, error)

func (*Client) Pull

func (c *Client) Pull(model string, progress func(string)) (string, bool, error)

func (*Client) Push

func (c *Client) Push(model string, progress func(string)) (string, bool, error)

func (*Client) Remove

func (c *Client) Remove(models []string, force bool) (string, error)

func (*Client) Status

func (c *Client) Status() Status

func (*Client) Tag

func (c *Client) Tag(source, targetRepo, targetTag string) (string, error)

type Config

type Config struct {
	Format       Format `json:"format,omitempty"`
	Quantization string `json:"quantization,omitempty"`
	Parameters   string `json:"parameters,omitempty"`
	Architecture string `json:"architecture,omitempty"`
	Size         string `json:"size,omitempty"`
}

type DockerHttpClient

type DockerHttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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 OpenAIChatMessage

type OpenAIChatMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

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 OpenAIModel struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Created int64  `json:"created"`
	OwnedBy string `json:"owned_by"`
}

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 Status

type Status struct {
	Running bool   `json:"running"`
	Status  []byte `json:"status"`
	Error   error  `json:"error"`
}

Jump to

Keyboard shortcuts

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