Documentation
¶
Overview ¶
Package llamacpp adapts a supervised llama-server subprocess to the runtime.Runtime interface (SPEC §A1.3: subprocess, never cgo).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
Fetcher *Fetcher
Accel string // preferred accelerator backend from hardware detection
// VRAMMB is the detected GPU memory (system RAM on Apple Silicon);
// with budget.max_vram_percent it bounds GPU offload. 0 = unknown.
VRAMMB uint64
Log *slog.Logger
// ContextLength override (0 = model/catalog default).
ContextLength int
// MaxContext caps the window passed as --ctx-size (0 = no cap); see
// config.Runtime.MaxContext.
MaxContext int
}
Adapter implements runtime.Runtime by supervising llama-server and translating CompletionRequests to its OpenAI-compatible HTTP API.
type ArtifactManifest ¶
type ArtifactManifest struct {
RuntimeBuildID string `json:"runtime_build_id"`
Artifacts []Artifact `json:"artifacts"`
}
ArtifactManifest mirrors teraflock/runtimes manifests/schema.json: one manifest per runtime_build_id, published alongside the tarballs. The build id participates in the fingerprint trust tuple (model_sha, quant, runtime_build_id) — SPEC §2.2. Fields the daemon does not act on (upstream_tag, created_at, …) are ignored rather than modelled, so a manifest format addition never requires a daemon release.
type Fetcher ¶
type Fetcher struct {
// ManifestURL points at the ArtifactManifest JSON. Required unless
// BinaryPath overrides fetching entirely.
ManifestURL string
// BinaryPath, when set, skips download and uses an existing binary
// (config runtime.llama_server_path).
BinaryPath string
CacheDir string // e.g. <data_dir>/runtimes
HTTPClient *http.Client
}
Fetcher downloads, SHA-verifies and unpacks the pinned llama-server build.
func (*Fetcher) Ensure ¶
Ensure returns the path to a verified llama-server binary and its build id.
func (*Fetcher) Preflight ¶ added in v0.1.1
Preflight checks that a runtime binary is *resolvable* for this (GOOS, GOARCH, accel) without actually downloading the tarball. Used by `tera up` to refuse installing a service unit that would crash-loop on first start when the pinned catalog has no build for this machine. Returns nil when either f.BinaryPath is present on disk or f.ManifestURL advertises a matching artifact (cpu fallback included, same rule as Ensure).