MCPcopy
hub / github.com/mudler/LocalAI / installModelFromRemoteConfig

Function installModelFromRemoteConfig

core/services/galleryop/models.go:140–160  ·  view source on GitHub ↗
(ctx context.Context, systemState *system.SystemState, modelLoader *model.ModelLoader, req gallery.GalleryModel, downloadStatus func(string, string, string, float64), enforceScan, automaticallyInstallBackend bool, backendGalleries []config.Gallery, requireBackendIntegrity bool)

Source from the content-addressed store, hash-verified

138}
139
140func installModelFromRemoteConfig(ctx context.Context, systemState *system.SystemState, modelLoader *model.ModelLoader, req gallery.GalleryModel, downloadStatus func(string, string, string, float64), enforceScan, automaticallyInstallBackend bool, backendGalleries []config.Gallery, requireBackendIntegrity bool) error {
141 config, err := gallery.GetGalleryConfigFromURLWithContext[gallery.ModelConfig](ctx, req.URL, systemState.Model.ModelsPath)
142 if err != nil {
143 return err
144 }
145
146 config.Files = append(config.Files, req.AdditionalFiles...)
147
148 installedModel, err := gallery.InstallModel(ctx, systemState, req.Name, &config, req.Overrides, downloadStatus, enforceScan)
149 if err != nil {
150 return err
151 }
152
153 if automaticallyInstallBackend && installedModel.Backend != "" {
154 if err := gallery.InstallBackendFromGallery(ctx, backendGalleries, systemState, modelLoader, installedModel.Backend, downloadStatus, false, requireBackendIntegrity); err != nil {
155 return err
156 }
157 }
158
159 return nil
160}
161
162type galleryModel struct {
163 gallery.GalleryModel `yaml:",inline"` // https://github.com/go-yaml/yaml/issues/63

Callers 2

processRequestsFunction · 0.85
InstallModelMethod · 0.85

Calls 3

InstallModelFunction · 0.92

Tested by

no test coverage detected