rerank

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Model     provider.Provider // The reranking model provider
	TopK      int               // Optional: only rerank top K results (0 = rerank all)
	Threshold float64           // Optional: minimum score threshold after reranking
	Criteria  string            // Optional: domain-specific relevance criteria to guide scoring
}

Config holds reranking configuration

type LLMReranker

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

LLMReranker implements reranking using any LLM provider that supports the RerankingProvider interface. This includes OpenAI, Anthropic, Gemini, and DMR providers.

func NewLLMReranker

func NewLLMReranker(config Config) (*LLMReranker, error)

NewLLMReranker creates a new LLM-based reranker

func (*LLMReranker) Rerank

func (r *LLMReranker) Rerank(ctx context.Context, query string, results []database.SearchResult) ([]database.SearchResult, error)

Rerank re-scores results using the reranking model

type Reranker

type Reranker interface {
	// Rerank re-scores the given search results and returns them sorted by new scores
	Rerank(ctx context.Context, query string, results []database.SearchResult) ([]database.SearchResult, error)
}

Reranker re-scores search results using a reranking model

Jump to

Keyboard shortcuts

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