Documentation ¶
Overview ¶
Package vecgo provides functionalities for an embedded vector store database.
Index ¶
- Variables
- type BruteSearchOptions
- type FilterFunc
- type KNNSearchOptions
- type SearchResult
- type Vecgo
- func (vg *Vecgo[T]) BruteSearch(query []float32, k int, optFns ...func(o *BruteSearchOptions)) ([]SearchResult[T], error)
- func (vg *Vecgo[T]) Get(id uint32) (T, error)
- func (vg *Vecgo[T]) Insert(item VectorWithData[T]) (uint32, error)
- func (vg *Vecgo[T]) KNNSearch(query []float32, k int, optFns ...func(o *KNNSearchOptions)) ([]SearchResult[T], error)
- func (vg *Vecgo[T]) PrintStats()
- func (vg *Vecgo[T]) SaveToFile(filename string) error
- func (vg *Vecgo[T]) SaveToWriter(w io.Writer) error
- type VectorWithData
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when an item is not found. ErrNotFound = errors.New("not found") // ErrInvalidEFValue is returned when the explore factor (ef) is less than the value of k. ErrInvalidEFValue = errors.New("explore factor (ef) must be at least the value of k") )
Functions ¶
This section is empty.
Types ¶
type BruteSearchOptions ¶ added in v0.0.5
type BruteSearchOptions struct { // FilterFunc is a function used to filter search results. FilterFunc FilterFunc }
BruteSearchOptions contains options for brute-force search.
type FilterFunc ¶ added in v0.0.5
FilterFunc is a function type used for filtering search results.
type KNNSearchOptions ¶
type KNNSearchOptions struct { // EF (Explore Factor) specifies the size of the dynamic list for the nearest neighbors during the search. // Higher EF leads to more accurate but slower search. // EF cannot be set lower than the number of queried nearest neighbors (k). // The value of EF can be anything between k and the size of the dataset. EF int // FilterFunc is a function used to filter search results. FilterFunc FilterFunc }
KNNSearchOptions contains options for KNN search.
type SearchResult ¶
type SearchResult[T any] struct { index.SearchResult // Data is the associated data of the search result. Data T }
SearchResult represents a search result.
type Vecgo ¶
type Vecgo[T any] struct { // contains filtered or unexported fields }
Vecgo is a vector store database.
func NewFromFilename ¶
NewFromFilename creates a new Vecgo instance from a file.
func NewFromReader ¶
NewFromReader creates a new Vecgo instance from an io.Reader.
func (*Vecgo[T]) BruteSearch ¶
func (vg *Vecgo[T]) BruteSearch(query []float32, k int, optFns ...func(o *BruteSearchOptions)) ([]SearchResult[T], error)
BruteSearch performs a brute-force search.
func (*Vecgo[T]) Insert ¶
func (vg *Vecgo[T]) Insert(item VectorWithData[T]) (uint32, error)
Insert inserts a vector along with associated data into the database.
func (*Vecgo[T]) KNNSearch ¶
func (vg *Vecgo[T]) KNNSearch(query []float32, k int, optFns ...func(o *KNNSearchOptions)) ([]SearchResult[T], error)
KNNSearch performs a K-nearest neighbor search.
func (*Vecgo[T]) PrintStats ¶
func (vg *Vecgo[T]) PrintStats()
PrintStats prints statistics about the database.
func (*Vecgo[T]) SaveToFile ¶
SaveToFile saves the Vecgo database to a file.
type VectorWithData ¶
VectorWithData represents a vector along with associated data.
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
Package index provides interfaces and types for vector search indexes.
|
Package index provides interfaces and types for vector search indexes. |
flat
Package flat provides an implementation of a flat index for vector storage and search.
|
Package flat provides an implementation of a flat index for vector storage and search. |
hnsw
Package hnsw implements the Hierarchical Navigable Small World (HNSW) graph for approximate nearest neighbor search.
|
Package hnsw implements the Hierarchical Navigable Small World (HNSW) graph for approximate nearest neighbor search. |
internal
|
|