Files
LocalAI/core/schema/gallery-model.schema.json
Ettore Di Giacinto 84de7a68a8 feat(gallery): drop the redundant variant min_memory field
Variant.MinMemory was an authored override for when the live probe misreads
a variant's footprint. It duplicated an existing field: probeEntryMemory
already passes the entry's declared size: into EstimateModelMultiContext,
whose cascade prefers that declared size over its own guesswork. Correcting
size: on the referenced entry fixes the figure for every consumer rather
than only for variant selection, so min_memory shadowed the right answer.

A variant is now nothing but a name. Its effective size is exactly the probe
result, and an unknown stays unknown: it survives the filter and ranks last.

EffectiveMemory loses its error return along with the field. The authored
string was the only thing that could fail to parse, so the error had no
remaining source and was propagating dead nil-checks through SelectVariant,
DescribeVariants and the pin warning.

Selection behaviour is unchanged. The specs covering probe-derived sizing,
ranking, filtering, the unknown-size path, pin recall, entry/variant
metadata split and deep-copy isolation all survive; the three install specs
that needed a definite size now declare it through the referenced entry's
own size:, which exercises the documented escape hatch directly.

gallery/index.yaml is untouched: no entry ever carried the key.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-07-18 23:18:12 +00:00

96 lines
2.8 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/mudler/LocalAI/main/schemas/gallery.model.schema.json",
"title": "LocalAI Gallery Model Spec",
"description": "Schema for LocalAI gallery model YAML files",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Model name"
},
"description": {
"type": "string",
"description": "Human-readable description of the model"
},
"icon": {
"type": "string",
"description": "Optional icon reference or URL"
},
"license": {
"type": "string",
"description": "Model license identifier or text"
},
"urls": {
"type": "array",
"description": "URLs pointing to remote model configuration",
"items": {
"type": "string",
"format": "uri"
}
},
"config_file": {
"type": "string",
"description": "Inline YAML configuration that will be written to the model config file"
},
"files": {
"type": "array",
"description": "Files to download and install for this model",
"items": {
"type": "object",
"required": ["filename", "uri"],
"properties": {
"filename": {
"type": "string"
},
"sha256": {
"type": "string",
"description": "Optional SHA256 checksum for file verification"
},
"uri": {
"type": "string",
"format": "uri"
}
},
"additionalProperties": false
}
},
"variants": {
"type": "array",
"description": "Other builds of the same model (other backends, other quantizations) the installer may pick instead of this entry's own payload. Order carries no meaning: the installer drops what this host cannot run or does not have the memory for, then takes the largest of what is left, installing it under this entry's own name. If nothing is left this entry installs itself. Clients that predate variants support drop this key and install the entry unchanged.",
"minItems": 1,
"items": {
"type": "object",
"required": ["model"],
"properties": {
"model": {
"type": "string",
"description": "Name of a gallery entry that declares no variants of its own"
}
},
"additionalProperties": false
}
},
"prompt_templates": {
"type": "array",
"description": "Prompt templates written as .tmpl files",
"items": {
"type": "object",
"required": ["name", "content"],
"properties": {
"name": {
"type": "string"
},
"content": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}