db

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QuantizationParams added in v1.0.5

type QuantizationParams struct {
	Min  float64
	Max  float64
	Bits int
}

func (QuantizationParams) Dequantize added in v1.0.5

func (p QuantizationParams) Dequantize(value float64) float64

func (QuantizationParams) Quantize added in v1.0.5

func (p QuantizationParams) Quantize(value float64) float64

type Storage

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

func NewStorage

func NewStorage(dbPath string) (*Storage, error)

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) Delete

func (s *Storage) Delete(id string) error

func (*Storage) Get

func (s *Storage) Get(id string) (*Vector, error)

func (*Storage) GetAll

func (s *Storage) GetAll() ([]*Vector, error)

func (*Storage) Insert

func (s *Storage) Insert(vector *Vector) error

type Vector

type Vector struct {
	ID                 string
	Embedding          []float64
	Metadata           map[string]string
	Compressed         bool
	QuantizationParams *QuantizationParams
	PruningMask        []bool
	SparseIndices      []int
}

func (*Vector) Add

func (v *Vector) Add(other Vector) error

func (Vector) Distance

func (v Vector) Distance(other Vector) (float64, error)

func (*Vector) Normalize

func (v *Vector) Normalize()

func (*Vector) Prune added in v1.0.5

func (v *Vector) Prune(threshold float64)

func (*Vector) Quantize added in v1.0.5

func (v *Vector) Quantize(params QuantizationParams)

func (*Vector) Subtract

func (v *Vector) Subtract(other Vector) error

func (*Vector) ToSparse added in v1.0.5

func (v *Vector) ToSparse()

Jump to

Keyboard shortcuts

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