Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CrossEncoder ¶
type CrossEncoder struct {
// contains filtered or unexported fields
}
CrossEncoder uses a CrossEncoder model to rerank results.
func NewCrossEncoder ¶
func NewCrossEncoder(llm chat.Client, opts ...CrossEncoderOption) *CrossEncoder
NewCrossEncoder creates a new cross-encoder reranker.
type CrossEncoderOption ¶
type CrossEncoderOption func(*CrossEncoder)
CrossEncoderOption configures a CrossEncoder instance.
func WithRerankCollector ¶
func WithRerankCollector(collector observability.Collector) CrossEncoderOption
WithRerankCollector sets the collector.
func WithRerankLogger ¶
func WithRerankLogger(logger logging.Logger) CrossEncoderOption
WithRerankLogger sets the logger.
func WithRerankTopK ¶
func WithRerankTopK(k int) CrossEncoderOption
WithRerankTopK sets the number of results to keep.
type Reranker ¶
type Reranker interface {
// Rerank re-scores a list of chunks against the query and returns the topK most relevant chunks.
Rerank(ctx context.Context, query string, chunks []*core.Chunk, topK int) ([]*core.Chunk, []float32, error)
}
Reranker defines the interface for Cross-Encoder re-ranking models (e.g., bge-reranker). It performs a deep semantic interaction between the query and the retrieved chunks.
Click to show internal directories.
Click to hide internal directories.