vdb

package
v0.0.0-...-20e2264 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	ID     string    `json:"id"`
	Query  string    `json:"query"`
	Answer string    `json:"answer"`
	Score  float64   `json:"score"`
	Vector []float64 `json:"vector"`
}

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, string, []float64) error

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

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

VDB ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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