Documentation ¶
Index ¶
- func CosineSimilarity(a []float64, b []float64) (float64, error)
- type EmbeddingSearchResult
- type VectorDB
- func (v *VectorDB) Add(identifier, content string) error
- func (v *VectorDB) AddEmbedding(identifier, content string, embedding []float64) error
- func (v *VectorDB) CheckEmbeddingExists(identifier string) (bool, error)
- func (v *VectorDB) CheckEmbeddingMatches(identifier, content string) (bool, error)
- func (v *VectorDB) DeleteEmbeddingByID(id uint) error
- func (v *VectorDB) DeleteEmbeddingByIdentifier(identifier string) error
- func (v *VectorDB) GetEmbeddingByID(id uint) (db.Embedding, error)
- func (v *VectorDB) GetEmbeddingByIdentifier(identifier string) (db.Embedding, error)
- func (v *VectorDB) Search(query string, limit uint) ([]EmbeddingSearchResult, error)
- func (v *VectorDB) SearchByEmbedding(query []float64, limit uint) ([]EmbeddingSearchResult, error)
- type VectorDBConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EmbeddingSearchResult ¶
type VectorDB ¶
type VectorDB struct {
// contains filtered or unexported fields
}
VectorDB is a wrapper around a gorm.DB instance for supporting vector operations
func NewVectorDB ¶
func NewVectorDB(config *VectorDBConfig) (*VectorDB, error)
NewVectorDB creates a new VectorDB instance
func (*VectorDB) AddEmbedding ¶
func (*VectorDB) CheckEmbeddingExists ¶
func (*VectorDB) CheckEmbeddingMatches ¶
Given an identifier and content, check if the embedding's content matches
func (*VectorDB) DeleteEmbeddingByID ¶
Deletes the embedding. Also clears the embedding values
func (*VectorDB) DeleteEmbeddingByIdentifier ¶
func (*VectorDB) GetEmbeddingByID ¶
func (*VectorDB) GetEmbeddingByIdentifier ¶
func (*VectorDB) Search ¶
func (v *VectorDB) Search(query string, limit uint) ([]EmbeddingSearchResult, error)
Searches for an embedding in plain text
func (*VectorDB) SearchByEmbedding ¶
func (v *VectorDB) SearchByEmbedding(query []float64, limit uint) ([]EmbeddingSearchResult, error)
type VectorDBConfig ¶
Config for VectorDB
Click to show internal directories.
Click to hide internal directories.