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

rerank

package
v1.152.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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