vecdb

package
v0.1.0-devel.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDim  = errors.New("invalid dim: must be > 0")
	ErrDimMismatch = errors.New("vector dim mismatch")
)

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Content string
	Vec     Vector
	Meta    any
}

type Meta

type Meta struct {
	Source string `json:"path,omitempty"`
	Index  int    `json:"index,omitempty"`
}

func DecodeMeta

func DecodeMeta(raw json.RawMessage) (Meta, error)

type Opt

type Opt func(*VectorDB)

func WithPath

func WithPath(p string) Opt

type SearchResult

type SearchResult struct {
	ID       rid
	Distance float64
	Content  string
	Meta     json.RawMessage
}

type Vector

type Vector []float32

type VectorDB

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

func New

func New(dim int, opts ...Opt) (*VectorDB, error)

func (*VectorDB) Close

func (v *VectorDB) Close() error

func (*VectorDB) Insert

func (v *VectorDB) Insert(chunks []Chunk) (retErr error)

func (*VectorDB) SearchKNN

func (v *VectorDB) SearchKNN(q Vector, k int) ([]SearchResult, error)

Jump to

Keyboard shortcuts

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