retrieval

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RRFK is the damping factor for Reciprocal Rank Fusion
	// A value of 60 is commonly used in information retrieval
	RRFK = 60
)

RRF constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptiveRetriever

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

AdaptiveRetriever 自适应检索器 根据查询复杂度和结果质量动态调整检索策略

func NewAdaptiveRetriever

func NewAdaptiveRetriever(
	st *store.Store,
	embeddingService ai.EmbeddingService,
	rerankerService ai.RerankerService,
) *AdaptiveRetriever

NewAdaptiveRetriever 创建自适应检索器

func (*AdaptiveRetriever) Retrieve

func (r *AdaptiveRetriever) Retrieve(ctx context.Context, opts *RetrievalOptions) ([]*SearchResult, error)

Retrieve 自适应检索主入口

type QualityLevel

type QualityLevel int

QualityLevel 结果质量等级

const (
	LowQuality QualityLevel = iota
	MediumQuality
	HighQuality
)

func (QualityLevel) String

func (q QualityLevel) String() string

String 返回质量等级的字符串表示

type RetrievalOptions

type RetrievalOptions struct {
	Query             string
	UserID            int32
	Strategy          string
	TimeRange         *queryengine.TimeRange
	MinScore          float32
	Limit             int
	RequestID         string                        // 请求追踪 ID
	Logger            *slog.Logger                  // 结构化日志记录器
	ScheduleQueryMode queryengine.ScheduleQueryMode // P1: 日程查询模式
}

RetrievalOptions 检索选项

type SearchResult

type SearchResult struct {
	ID       int64
	Type     string // "memo" or "schedule"
	Score    float32
	Content  string
	Memo     *store.Memo
	Schedule *store.Schedule
}

SearchResult 检索结果

Jump to

Keyboard shortcuts

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