rerankings

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rerankings provides reranking functions for reordering search results by relevance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RankedResult

type RankedResult struct {
	Index  int // Index in the original input []string
	String string
	Rank   float32
}

RankedResult holds a single reranked item with its original index, content, and relevance score.

type RerankedChromaResults

type RerankedChromaResults struct {
	*chromago.QueryResultImpl
	QueryTexts []string               // Query texts used for reranking (not in V2 QueryResultImpl)
	Ranks      map[string][][]float32 // each reranker adds a rank for each result
}

RerankedChromaResults wraps query results with ranking information

type RerankingFunction

type RerankingFunction interface {
	ID() string
	Rerank(ctx context.Context, query string, results []Result) (map[string][]RankedResult, error)
	RerankResults(ctx context.Context, queryTexts []string, queryResults *chromago.QueryResultImpl) (*RerankedChromaResults, error)
}

RerankingFunction defines the interface for reranking search results.

type RerankingModel

type RerankingModel string

RerankingModel represents the model identifier for a reranking function.

type Result

type Result struct {
	Text   *string
	Object *any
}

Result wraps either a text string or an arbitrary object for reranking input.

func FromObject

func FromObject(object any) Result

func FromObjects

func FromObjects(objects []any) []Result

func FromText

func FromText(text string) Result

func FromTexts

func FromTexts(texts []string) []Result

func (*Result) IsObject

func (r *Result) IsObject() bool

func (*Result) IsText

func (r *Result) IsText() bool

func (*Result) ToText

func (r *Result) ToText() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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