Documentation
¶
Overview ¶
Package rerank holds the cross-encoder reranker: an HTTP client for a dedicated ranking model (bge-reranker, Qwen3-Reranker, mxbai-rerank, …) served over the Cohere-style /rerank API that Infinity, vLLM, TEI, and llama-server --rerank expose. It implements llm.Reranker, so recall can reorder candidates with a ranking model instead of (and cheaper than) an LLM.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BaseURL is the API root (e.g. http://host:8002/v1); "/rerank" is appended.
BaseURL string
Model string
APIKey string
HTTPClient *http.Client
}
Config configures the cross-encoder reranker client.
type CrossEncoder ¶
type CrossEncoder struct {
// contains filtered or unexported fields
}
CrossEncoder reranks candidates by calling a ranking model's /rerank endpoint.
func New ¶
func New(cfg Config) (*CrossEncoder, error)
New builds a cross-encoder reranker client. BaseURL is required.
func (*CrossEncoder) Rerank ¶
func (c *CrossEncoder) Rerank(ctx context.Context, query string, candidates []llm.RerankCandidate) ([]string, error)
Rerank scores every candidate against the query with the ranking model and returns the candidate IDs most-relevant-first. Candidates the server omits are appended in their original order, satisfying the reorder-only contract of llm.Reranker.