vectordb

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	Vector
	Score float32
	Doc   []byte
}

Match 匹配结果

type Upsert

type Upsert struct {
	Vector
	Doc []byte
}

Upsert 插入/更新

type Vector

type Vector struct {
	ID                   string            `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Values               []float32         `protobuf:"fixed32,2,rep,packed,name=Values,proto3" json:"Values,omitempty"`
	MD5                  []byte            `protobuf:"bytes,3,opt,name=MD5,proto3" json:"MD5,omitempty"`
	Meta                 map[string]string `` /* 149-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

Vector 向量

func (*Vector) Descriptor

func (*Vector) Descriptor() ([]byte, []int)

func (*Vector) GetID

func (m *Vector) GetID() string

func (*Vector) GetMD5

func (m *Vector) GetMD5() []byte

func (*Vector) GetMeta

func (m *Vector) GetMeta() map[string]string

func (*Vector) GetValues

func (m *Vector) GetValues() []float32

func (*Vector) ProtoMessage

func (*Vector) ProtoMessage()

func (*Vector) Reset

func (m *Vector) Reset()

func (*Vector) String

func (m *Vector) String() string

func (*Vector) XXX_DiscardUnknown

func (m *Vector) XXX_DiscardUnknown()

func (*Vector) XXX_Marshal

func (m *Vector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vector) XXX_Merge

func (m *Vector) XXX_Merge(src proto.Message)

func (*Vector) XXX_Size

func (m *Vector) XXX_Size() int

func (*Vector) XXX_Unmarshal

func (m *Vector) XXX_Unmarshal(b []byte) error

type VectorDB

type VectorDB interface {
	// ListRepos list repos
	ListRepos(ctx context.Context) ([]string, error)

	// DeleteRepo delete repo
	DeleteRepo(ctx context.Context, repos string) error

	// Upsert 插入or更新
	Upsert(ctx context.Context, repo string, v *Upsert) error

	// Delete 删除
	Delete(ctx context.Context, repo string, id ...string) error

	// Range 遍历所有
	Range(ctx context.Context, repo string, f func(*Vector)) error

	// Search 搜索向量相似度最高的topk
	Search(ctx context.Context, repo string, v []float32, topK int) ([]*Match, error)
}

VectorDB 向量数据库

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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