Documentation ¶
Index ¶
- func InstallModel(basePath, nameOverride string, config *Config, ...) error
- func InstallModelFromGallery(galleries []Gallery, name string, basePath string, req GalleryModel, ...) error
- func InstallModelFromGalleryByName(galleries []Gallery, name string, basePath string, req GalleryModel, ...) error
- type Config
- type File
- type Gallery
- type GalleryModel
- type PromptTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallModel ¶ added in v1.20.0
func InstallModelFromGallery ¶ added in v1.20.0
func InstallModelFromGallery(galleries []Gallery, name string, basePath string, req GalleryModel, downloadStatus func(string, string, string, float64)) error
Installs a model from the gallery (galleryname@modelname)
func InstallModelFromGalleryByName ¶ added in v1.22.0
func InstallModelFromGalleryByName(galleries []Gallery, name string, basePath string, req GalleryModel, downloadStatus func(string, string, string, float64)) error
InstallModelFromGalleryByName loads a model from the gallery by specifying only the name (first match wins)
Types ¶
type Config ¶
type Config struct { Description string `yaml:"description"` License string `yaml:"license"` URLs []string `yaml:"urls"` Name string `yaml:"name"` ConfigFile string `yaml:"config_file"` Files []File `yaml:"files"` PromptTemplates []PromptTemplate `yaml:"prompt_templates"` }
description: |
foo
license: ""
urls: - -
name: "bar"
config_file: |
# Note, name will be injected. or generated by the alias wanted by the user threads: 14
files:
- filename: "" sha: "" uri: ""
prompt_templates:
- name: "" content: ""
Config is the model configuration which contains all the model details This configuration is read from the gallery endpoint and is used to download and install the model
func GetGalleryConfigFromURL ¶ added in v1.20.0
func ReadConfigFile ¶
type GalleryModel ¶ added in v1.20.0
type GalleryModel struct { URL string `json:"url,omitempty" yaml:"url,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` License string `json:"license,omitempty" yaml:"license,omitempty"` URLs []string `json:"urls,omitempty" yaml:"urls,omitempty"` Icon string `json:"icon,omitempty" yaml:"icon,omitempty"` Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` // config_file is read in the situation where URL is blank - and therefore this is a base config. ConfigFile map[string]interface{} `json:"config_file,omitempty" yaml:"config_file,omitempty"` // Overrides are used to override the configuration of the model located at URL Overrides map[string]interface{} `json:"overrides,omitempty" yaml:"overrides,omitempty"` // AdditionalFiles are used to add additional files to the model AdditionalFiles []File `json:"files,omitempty" yaml:"files,omitempty"` // Gallery is a reference to the gallery which contains the model Gallery Gallery `json:"gallery,omitempty" yaml:"gallery,omitempty"` // Installed is used to indicate if the model is installed or not Installed bool `json:"installed,omitempty" yaml:"installed,omitempty"` }
GalleryModel is the struct used to represent a model in the gallery returned by the endpoint. It is used to install the model by resolving the URL and downloading the files. The other fields are used to override the configuration of the model.
func AvailableGalleryModels ¶ added in v1.20.0
func AvailableGalleryModels(galleries []Gallery, basePath string) ([]*GalleryModel, error)
List available models Models galleries are a list of yaml files that are hosted on a remote server (for example github). Each yaml file contains a list of models that can be downloaded and optionally overrides to define a new model setting.
func FindGallery ¶ added in v1.22.0
func FindGallery(models []*GalleryModel, name string) (*GalleryModel, error)