vdb

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v0.0.8

func Register(name string, constructor func(config any) (VDB, error))

Register ...

Types

type Document

type Document struct {
	ID       string         `json:"id"`
	Title    string         `json:"title"`
	Content  string         `json:"content"`
	Metadata map[string]any `json:"metadata"`
}

Document 文档

type SearchOption

type SearchOption func(*SearchOptions)

SearchOption 搜索选项

func WithThreshold

func WithThreshold(threshold float64) SearchOption

WithThreshold 设置相似度阈值

func WithTopk

func WithTopk(topk int) SearchOption

WithTopk 设置返回结果数量

type SearchOptions

type SearchOptions struct {
	Topk      int     // 返回结果数量限制
	Threshold float64 // 相似度阈值
}

SearchOptions 搜索配置

type VDB

type VDB interface {
	Store(context.Context, []*Document) error

	Search(context.Context, []float64, ...SearchOption) ([]Document, error)
	SearchQuery(context.Context, string, ...SearchOption) ([]Document, error)

	Delete(context.Context, string) error
	Close() error
}

VDB ...

func NewVDB added in v0.0.8

func NewVDB(name string, config any) (VDB, error)

NewVDB ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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