localdb

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cosine

func Cosine[T Float](a []T, b []T) T

Cosine 计算cosine [-1,1],越大越相似

Types

type Float

type Float interface {
	~float32 | ~float64
}

type VectorDatabase

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

VectorDatabase 本地向量数据库 包含3个部分 meta、chunks、repo meta存储version等源信息 chunks 存储md5->chunk的映射 repo 存储的库包含的文档id和向量

func NewVectorSearch

func NewVectorSearch(path string) (*VectorDatabase, error)

func (*VectorDatabase) Close

func (s *VectorDatabase) Close() error

func (*VectorDatabase) CreateIfNotExists

func (s *VectorDatabase) CreateIfNotExists(repo string) error

func (*VectorDatabase) Delete

func (s *VectorDatabase) Delete(ctx context.Context, repo string, ids ...string) error

func (*VectorDatabase) DeleteRepo

func (s *VectorDatabase) DeleteRepo(ctx context.Context, repo string) error

func (*VectorDatabase) ListRepos

func (s *VectorDatabase) ListRepos(ctx context.Context) ([]string, error)

func (*VectorDatabase) Range

func (s *VectorDatabase) Range(ctx context.Context, repo string, f func(vector *vectordb.Vector)) error

func (*VectorDatabase) Search

func (s *VectorDatabase) Search(ctx context.Context, repo string, v []float32, topK int) ([]*vectordb.Match, error)

func (*VectorDatabase) Upsert

func (s *VectorDatabase) Upsert(ctx context.Context, repo string, v *vectordb.Upsert) error

Jump to

Keyboard shortcuts

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