Documentation
¶
Index ¶
- type Vector
- type VectorDatabase
- func (vectordb *VectorDatabase) Close() error
- func (vectordb *VectorDatabase) CreateTableIdempotent(dim int) error
- func (vectordb *VectorDatabase) Get(id string) *Vector
- func (vectordb *VectorDatabase) Insert(id string, embedding *Vector) error
- func (vectordb *VectorDatabase) TableName() string
- func (vectordb *VectorDatabase) Update(id string, input string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Vector ¶
type Vector struct {
Values []float32 // len(values) is the dimensions
}
Vector is a wrapper around a slice of float64s, this enables vector addition with methods like v1.Add(v2)
type VectorDatabase ¶
VectorDatabase represents a file-backed SQLite db with sqlite-vec extension that will store all the embeddings for the git repo. The modelname is stored because it is necessary know since it is necessary to work with the vectors later. Different models have a vectors of different dimension.
func Open ¶
func Open(filename string, modelname string) (*VectorDatabase, error)
Open will attempt to find the SQLite db at filename, and if that fails, then create it, and if the creation fails, it will return an error
func (*VectorDatabase) Close ¶
func (vectordb *VectorDatabase) Close() error
func (*VectorDatabase) CreateTableIdempotent ¶
func (vectordb *VectorDatabase) CreateTableIdempotent(dim int) error
CreateTableIdempotent takes the dimension, this was to decouple the vdb from the ollm package
func (*VectorDatabase) Get ¶
func (vectordb *VectorDatabase) Get(id string) *Vector
func (*VectorDatabase) Insert ¶
func (vectordb *VectorDatabase) Insert(id string, embedding *Vector) error
func (*VectorDatabase) TableName ¶
func (vectordb *VectorDatabase) TableName() string