Documentation
¶
Overview ¶
Package rerank scores search candidates with a cross-encoder: the second stage of retrieval, after the vector search has picked the candidates and before anything is truncated to the requested limit. Any hosted or local provider with an HTTP rerank endpoint works; the three request shapes in use are the API values below.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API string
API is the request shape a provider expects.
const ( // APIGeneric is `{model, query, documents, top_n}` with a bearer token: // OpenRouter, Jina, vLLM, Text Embeddings Inference. APIGeneric API = "generic" // APIVoyage is `{model, query, documents, top_k, truncation}` with an // x-api-key header. APIVoyage API = "voyage" // APICohere is `{model, query, documents:[{text}], top_n}` with a bearer // token. APICohere API = "cohere" )
func APIForHost ¶
APIForHost guesses the request shape from the endpoint's host.
type Config ¶
type Config struct {
// BaseURL is the API base the rerank route hangs off; empty means no
// reranker.
BaseURL string
APIKey string
// Model is the provider's model name.
Model string
// API selects the request shape; "" means APIForHost of BaseURL.
API API
// Timeout bounds one call (30 s when zero).
Timeout time.Duration
}
Config is a rerank endpoint.