modelacquisition

package
v1.0.0-rc.16 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modelacquisition owns curated native-model discovery and acquisition.

Index

Constants

This section is empty.

Variables

View Source
var Contract = servicecontract.Contract{
	ID: "model-acquisition", Summary: "List and download local models",
	Description: "List the curated local models with the roles each serves, then download one complete model bundle to this computer or to a selected modeld connection so a role can be assigned to and verified on it.",
	Operations: []servicecontract.Operation{
		{
			ID: "catalog", Summary: "List the downloadable local models",
			Description: "Read the curated local-model catalog with each model's size, the roles it can serve and whether it is already downloaded.",
			Spec:        "List the curated local models this computer can download. Each entry carries the model's name, its size, the roles it can serve and whether its bundle is already on this computer. The names are the identities the download operation accepts.",
			Output: servicecontract.Output{
				Stdout: "One entry per curated model: name, engine, size and description.",
				Format: "text",
			},
			Outcomes: []servicecontract.Outcome{
				{Code: 0, When: "the catalog is read", Meaning: "every listed name can be downloaded"},
			},
			Refusals: []servicecontract.Refusal{
				{When: "the catalog cannot be read", Message: "names the failure"},
			},
		},
		{
			ID: "pull", Summary: "Acquire a complete model bundle",
			Description: "Download one curated model's complete bundle to the chosen host, register the local connection that serves it and rediscover that connection's models. Assigning and verifying the model for a role is a separate step.",
			Spec:        "Download one curated local model, with every file its engine needs, to this computer or to a selected modeld connection. The download reports its progress, can be stopped, and installs nothing until the whole bundle has arrived, so a stopped or failed download leaves no partial model and can simply be run again. Afterwards the connection that serves the model is registered if none exists and its models are rediscovered; a role is assigned to the model with its own command.",
			Usage:       "<name>",
			Inputs: []servicecontract.Input{
				{ID: "model", Summary: "Curated model identity, as the catalog lists it", Type: "string", Required: true, Positional: 1, Placeholder: "name"},
				{ID: "acquisition", Summary: "The host that receives the bundle: target local or connection, with the connection id for a connection; absent installs on this computer", Type: "object"},
			},
			Output: servicecontract.Output{
				Stdout: "The download's progress, then the model's name once it is available.",
				Format: "text",
			},
			Outcomes: []servicecontract.Outcome{
				{Code: 0, When: "the complete bundle is installed", Meaning: "the model is discovered on its connection and can be assigned to a role"},
			},
			Refusals: []servicecontract.Refusal{
				{When: "the name is not in the catalog", Message: "names the unknown model and lists the catalog's names"},
				{When: "the host is not a reachable modeld owner", Message: "names the host and what it answered"},
				{When: "the download is stopped or fails", Message: "reports the cause and leaves nothing installed"},
			},
		},
	},
}

Contract describes model acquisition independently of the selected transport or host.

Functions

This section is empty.

Types

type DownloadProgress

type DownloadProgress = modelstore.DownloadProgress

DownloadProgress is the byte position reported while acquiring a model.

type Installer

Installer acquires curated models through local and remote model-store owners.

type LibraryEntry

type LibraryEntry struct {
	Model      modelregistry.ModelDescriptor
	Roles      []string
	Downloaded bool
}

LibraryEntry is one catalog model with the roles it serves and whether its bundle is already on this computer.

type Progress

type Progress func(modelstore.DownloadProgress) error

Progress receives download byte positions.

type ProviderRefresher

type ProviderRefresher interface {
	RefreshProviderModels(context.Context, ...string) error
}

ProviderRefresher refreshes discovered models for selected connections.

type ProviderSetup

type ProviderSetup interface {
	ConnectProvider(context.Context, inferencesetup.ProviderRequest) (inferencesetup.ProviderResult, error)
}

ProviderSetup registers the local provider used after acquisition.

type Request

type Request struct {
	Target       string `json:"target"`
	ConnectionID string `json:"connectionId"`
	Model        string `json:"model"`
}

Request selects the host that receives the complete model bundle.

type Service

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

Service owns native-model discovery and acquisition.

func New

func New(db libdbexec.DBManager, setup ProviderSetup, state ProviderRefresher, registry modelregistry.Registry, installer Installer, dataRoot string, tracker libtracker.ActivityTracker) (*Service, error)

New constructs model acquisition from required runtime dependencies.

func (*Service) Catalog

Catalog returns the current curated local-model catalog.

func (*Service) Library

func (s *Service) Library(ctx context.Context) ([]LibraryEntry, error)

Library returns the catalog with the roles each model serves and whether its bundle is already in this computer's model store.

func (*Service) Pull

func (s *Service) Pull(ctx context.Context, model string, progress Progress) error

Pull acquires one model, registers the local provider, and refreshes its discovered capabilities.

func (*Service) PullTo

func (s *Service) PullTo(ctx context.Context, request Request, progress Progress) error

PullTo acquires a model on the selected host and refreshes only its connection.

type StoreInstaller

type StoreInstaller struct{}

StoreInstaller acquires models through the runtime model store.

func (StoreInstaller) Ensure

Ensure acquires a model through the shared owner's model store.

func (StoreInstaller) EnsureAt

func (StoreInstaller) EnsureAt(ctx context.Context, registry modelregistry.Registry, model, endpoint string, options modelstore.AutoPullOptions) error

EnsureAt acquires a model through the selected remote owner's model store.

type UnknownModelError

type UnknownModelError struct {
	Model string
	Known []string
}

UnknownModelError reports a model name the catalog does not carry, with the names it does.

func (*UnknownModelError) Error

func (e *UnknownModelError) Error() string

Error implements error.

Jump to

Keyboard shortcuts

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