embeddings

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureModel

func EnsureModel(modelPath, modelURL, sha256Hex string) error

func EnsureModelDir

func EnsureModelDir(modelDir, repoBaseURL string, files []ModelFile) error

EnsureModelDir downloads all files into modelDir, skipping already-present files whose hash matches (or have no hash). Returns combined errors for any files that failed; partially downloaded files are left in place.

Types

type Embedder

type Embedder interface {
	Embed(text string) ([]float32, error)
	CountTokens(text string) int
}

func NewEmbedder

func NewEmbedder(ctx context.Context, modelDir string, dimensions int) (Embedder, error)

type ModelFile

type ModelFile struct {
	LocalName  string // filename inside modelDir
	RemotePath string // path relative to repo root
	SHA256     string // empty = skip hash check
}

ModelFile describes one file to download into the model directory.

Jump to

Keyboard shortcuts

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