Help us shape the future of Go! Take the 2026 Go Developer Survey

retriever

package
v0.0.0-...-0f488bb Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bm25Retrieve

func Bm25Retrieve(ctx context.Context, client *elasticsearch.Client, indexName, knowledgeName, query string, excludeIDs []string, topK int) ([]*schema.Document, error)

Bm25Retrieve 使用 ES BM25 对 content 字段做全文检索。 仅在使用 ES 向量存储时调用,复用同一索引中的文档。

func BuildRetriever

func BuildRetriever(ctx context.Context, conf *config.Config) (r compose.Runnable[string, []*schema.Document], err error)

func EsHit2Document

func EsHit2Document(ctx context.Context, hit types.Hit) (doc *schema.Document, err error)

func NewQdrantRetriever

func NewQdrantRetriever(ctx context.Context, config *QdrantRetrieverConfig) (retriever.Retriever, error)

NewQdrantRetriever 创建 Qdrant retriever(自定义实现,支持命名向量)

func RRFFusion

func RRFFusion(inputs [][]*schema.Document) []*schema.Document

RRFFusion 融合按相关性降序排列的召回列表,每个文档在每一路最多贡献一次分数。 同分时保留首次出现顺序,不修改调用方的文档或元数据。

Types

type QdrantRetriever

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

QdrantRetriever Qdrant retriever 实现(支持命名向量和过滤)

func (*QdrantRetriever) GetType

func (r *QdrantRetriever) GetType() string

GetType 返回 retriever 类型

func (*QdrantRetriever) Retrieve

func (r *QdrantRetriever) Retrieve(ctx context.Context, query string, opts ...retriever.Option) ([]*schema.Document, error)

Retrieve 检索文档(支持过滤条件)

type QdrantRetrieverConfig

type QdrantRetrieverConfig struct {
	Client         *qdrant.Client     // Required: Qdrant client
	Collection     string             // Required: Collection name
	Embedding      embedding.Embedder // Required: Query embedding component
	VectorField    string             // Optional: Vector field name (for named vectors)
	ScoreThreshold *float64           // Optional: Score threshold
	TopK           int                // Optional: Number of results (default: 10)
}

QdrantRetrieverConfig Qdrant retriever 配置

Jump to

Keyboard shortcuts

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