ann

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index is a simple in-memory approximate nearest neighbor index using a brute-force approach with optimizations for small-medium datasets

func New

func New(dim int) *Index

New creates a new ANN index with the given embedding dimension

func (*Index) Add

func (i *Index) Add(key string, vector []float32)

Add adds a vector to the index

func (*Index) Remove

func (i *Index) Remove(key string)

Remove removes a vector from the index

func (*Index) Search

func (i *Index) Search(vector []float32, k int) ([]string, []float32)

Search finds the k nearest neighbors to the query vector Returns keys and distances (lower distance = more similar)

func (*Index) Size

func (i *Index) Size() int

Size returns the number of vectors in the index

Jump to

Keyboard shortcuts

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