rerankwire

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 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

Overview

Package rerankwire owns validation-preserving acceptance of every built-in reranker response. It is module-internal because its exported identifiers exist only to share the acceptance owner between search and provider packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse(reader io.Reader, value any) error

DecodeResponse is the only JSON decoding entry point exposed to provider adapters. All adapters therefore share decodeEnvelope's grammar and decodeBoundJSON's field-binding rules.

Types

type AcceptedResult

type AcceptedResult struct {
	Index        int
	Score        float64
	ScorePresent bool
	Document     string
}

AcceptedResult is the sole normalized output of built-in provider decoding.

func AcceptCrossEncoder

func AcceptCrossEncoder(results []IndexedResult, scores []Required[float64], rankings []IndexedResult, population int) ([]AcceptedResult, error)

AcceptCrossEncoder validates every supported cross-encoder representation and rejects a response that supplies more than one non-empty ranking.

func AcceptLLM

func AcceptLLM(raw string, population int) ([]AcceptedResult, error)

AcceptLLM owns envelope selection and presence-aware binding for model output. Every response must satisfy the one-envelope JSON grammar before a ranking can be interpreted.

func AcceptTyped

func AcceptTyped(values []TypedResult, population int) ([]AcceptedResult, error)

AcceptTyped validates a provider result that arrived through a typed API.

func AcceptVoyage

func AcceptVoyage(data, results []IndexedResult, population int) ([]AcceptedResult, error)

AcceptVoyage validates both Voyage response spellings without preferring one.

type IndexedResult

type IndexedResult struct {
	Index          Required[int]     `json:"index"`
	Score          Required[float64] `json:"score"`
	RelevanceScore Required[float64] `json:"relevance_score"`
	Document       string            `json:"document,omitempty"`
}

IndexedResult is the shared presence-aware indexed JSON representation.

type Required

type Required[T any] struct {
	// contains filtered or unexported fields
}

Required is a JSON scalar or collection whose presence is part of the wire contract. The zero value means absent; JSON null is present but invalid.

func (*Required[T]) UnmarshalJSON

func (r *Required[T]) UnmarshalJSON(data []byte) error

type TypedResult

type TypedResult struct {
	Index    int
	Score    float64
	Document string
}

TypedResult represents a result whose index and score came from a typed provider API rather than JSON. Its constructor marks both fields present.

Jump to

Keyboard shortcuts

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