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

Method InstallModel

core/services/galleryop/managers_local.go:47–69  ·  view source on GitHub ↗
(ctx context.Context, op *ManagementOp[gallery.GalleryModel, gallery.ModelConfig], progressCb ProgressCallback)

Source from the content-addressed store, hash-verified

45}
46
47func (m *LocalModelManager) InstallModel(ctx context.Context, op *ManagementOp[gallery.GalleryModel, gallery.ModelConfig], progressCb ProgressCallback) error {
48 switch {
49 case op.GalleryElement != nil:
50 installedModel, err := gallery.InstallModel(ctx, m.systemState, op.GalleryElement.Name,
51 op.GalleryElement, op.Req.Overrides, progressCb, m.enforcePredownloadScans)
52 if err != nil {
53 return err
54 }
55 if m.automaticallyInstallBackend && installedModel.Backend != "" {
56 xlog.Debug("Installing backend", "backend", installedModel.Backend)
57 return gallery.InstallBackendFromGallery(ctx, op.BackendGalleries, m.systemState,
58 m.modelLoader, installedModel.Backend, progressCb, false, m.requireBackendIntegrity)
59 }
60 return nil
61 case op.GalleryElementName != "":
62 return gallery.InstallModelFromGallery(ctx, op.Galleries, op.BackendGalleries,
63 m.systemState, m.modelLoader, op.GalleryElementName, op.Req, progressCb,
64 m.enforcePredownloadScans, m.automaticallyInstallBackend, m.requireBackendIntegrity)
65 default:
66 return installModelFromRemoteConfig(ctx, m.systemState, m.modelLoader, op.Req,
67 progressCb, m.enforcePredownloadScans, m.automaticallyInstallBackend, op.BackendGalleries, m.requireBackendIntegrity)
68 }
69}
70
71// LocalBackendManager handles backend install/delete on the local instance.
72type LocalBackendManager struct {

Callers

nothing calls this directly

Calls 4

InstallModelFunction · 0.92
InstallModelFromGalleryFunction · 0.92

Tested by

no test coverage detected