Skip to main content

Module hub

Module hub 

Source
Expand description

Model Hub client.

The Hub is the central registry that distributes versioned model artifacts (GGUF / MLX / safetensors models). Clients download to their local environment and run inference locally - only artifact bytes + metadata ever cross the wire, never inference data. This module is the client: a catalog + a streaming downloader into ~/.flow-studio/llms/.

There is no real Hub artifactory service yet, so the catalog is loaded from hub_catalog.json - an { apiVersion, models } envelope checked into the repo that doubles as a proof-of-concept of the future registry API response. It carries everything the UI renders (browse / search / filter / detail) plus per-model hardware requirements that drive the device-compatibility check. Edit the JSON to add/remove models; the same shape will later come over the wire from the real service.

Structs§

DownloadOption
One downloadable artifact variant (format × quantization × offload).
Hardware
Hardware requirements + supported platforms for the model. Drives the device-compatibility check (RAM + disk + platform).
HubModel
A model in the Hub registry. Camel-cased for the frontend; loaded from hub_catalog.json, the real Hub service will serve the same shape.
HubVersion
A single released version with its changelog note.
InstalledModel
An installed model derived by joining local artifacts against the catalog.
LocalLlm
A locally-downloaded LLM.

Enums§

HubFormat
Artifact format. Gguf/Mlx run via the managed inference server; SafeTensors is distributed but not an immediate runtime target.
Offload
GPU-offload class for a download variant, rendered as a hardware hint.

Functions§

catalog
Parse the embedded catalog once. A malformed JSON file panics at first use (loud, deterministic - it ships in the binary, so it’s a build-time error in spirit).
delete_local_llm
Delete a downloaded LLM by file name, confined to llms_dir. The name must be a bare file name (no separators) so a caller can’t escape the directory.
download
Stream-download a model’s variant into dest_dir, emitting stage: "download" progress, then verify sha256 if the option pins one. Streams to a .part file and renames on success.
find
Find a catalog model by id.
list_local_llms
List downloaded LLMs under llms_dir.
resolve_option
Resolve a download variant: the named option_id, else the first option.