downloader

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package downloader provides functionality for downloading embedding models from remote sources. It supports progress tracking, caching, and multi-file downloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Downloader

type Downloader struct {
	// contains filtered or unexported fields
}

Downloader handles the downloading and caching of embedding models.

func NewDownloader

func NewDownloader(cacheDir string) *Downloader

NewDownloader creates a new downloader with the specified cache directory.

Parameters: - cacheDir: Directory to cache downloaded models (empty for default)

Returns: - *Downloader: A new downloader instance

func (*Downloader) DownloadModel

func (d *Downloader) DownloadModel(modelName string, callback ProgressCallback) (string, error)

DownloadModel downloads a model by name

func (*Downloader) GetModelInfo

func (d *Downloader) GetModelInfo() []ModelInfo

GetModelInfo returns information about available models

type ModelInfo

type ModelInfo struct {
	Name        string   // Model name
	Type        string   // Model type (e.g., "bge", "sentence-bert")
	URLs        []string // URLs of files to download
	Size        string   // Approximate total size
	Description string   // Model description
}

ModelInfo contains information about a model available for download.

type ProgressCallback

type ProgressCallback func(modelName, fileName string, downloaded, total int64)

ProgressCallback is a callback function for tracking download progress.

Parameters: - modelName: Name of the model being downloaded - fileName: Name of the file being downloaded - downloaded: Number of bytes downloaded so far - total: Total number of bytes to download (0 if unknown)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL