embedder

package
v2.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrModelUnavailable = errors.New("ONNX embedding model is unavailable")

ErrModelUnavailable identifies an unavailable local ONNX embedding model. Callers can use errors.Is to distinguish this condition from other embedder initialization failures.

Functions

func CheckModelAvailability added in v2.13.1

func CheckModelAvailability() error

CheckModelAvailability verifies that the local MiniLM artifacts are ready before Chroma's ONNX constructor can attempt a download.

Types

type AvailabilityReason added in v2.13.1

type AvailabilityReason string

AvailabilityReason identifies why the local ONNX model cannot be used.

const (
	AvailabilityConfiguration    AvailabilityReason = "configuration"
	AvailabilityMissingArtifacts AvailabilityReason = "missing_artifacts"
	AvailabilityDownloadActive   AvailabilityReason = "download_active"
	AvailabilityDownloadStale    AvailabilityReason = "download_stale"
	AvailabilityInvalidLock      AvailabilityReason = "invalid_lock"
)

type DownloadLock added in v2.13.1

type DownloadLock struct {
	Path    string
	PID     int
	Active  bool
	Invalid bool
	Age     time.Duration
	Detail  string
}

DownloadLock describes the ONNX model download lock, when one exists.

type LocalEmbedder

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

func NewLocalEmbedder

func NewLocalEmbedder() (*LocalEmbedder, error)

func (*LocalEmbedder) Close

func (e *LocalEmbedder) Close() error

func (*LocalEmbedder) Embed

func (e *LocalEmbedder) Embed(ctx context.Context, text string) ([]float32, error)

func (*LocalEmbedder) EmbedBatch

func (e *LocalEmbedder) EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)

func (*LocalEmbedder) Model added in v2.11.0

func (e *LocalEmbedder) Model() string

Model returns the identifier of the embedding model, used to invalidate previously stored content hashes when the model changes.

type ModelAvailabilityError added in v2.13.1

type ModelAvailabilityError struct {
	Reason        AvailabilityReason
	ModelPath     string
	TokenizerPath string
	LockPath      string
	Missing       []string
	Lock          *DownloadLock
	Detail        string
}

ModelAvailabilityError reports a model cache state that must be repaired or allowed to finish before the local embedder can be initialized.

func (*ModelAvailabilityError) Error added in v2.13.1

func (e *ModelAvailabilityError) Error() string

func (*ModelAvailabilityError) Unwrap added in v2.13.1

func (e *ModelAvailabilityError) Unwrap() error

Jump to

Keyboard shortcuts

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