Documentation
¶
Overview ¶
Package rerank adapts the app.RerankProvider port to a Cohere-style rerank HTTP API (POST /rerank with {model, query, documents, top_n} → {results: [{index, relevance_score}]}), the de-facto standard that Cohere, Jina, Voyage, and others conform to. It is a separate provider from the OpenAI-compatible embed/chat endpoint, reusing only the shared httpjson transport (auth, retry).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reranker ¶
type Reranker struct {
// contains filtered or unexported fields
}
Reranker calls a Cohere-style /rerank endpoint.
func NewReranker ¶
func NewReranker(baseURL, apiKey, model string, auth httpjson.Auth, httpClient *http.Client) (*Reranker, error)
NewReranker constructs a Reranker. baseURL and model are required (an unconfigured rerank provider is a usage error the caller surfaces). auth selects the API-key scheme; a nil httpClient uses http.DefaultClient.
func (*Reranker) Rerank ¶
func (r *Reranker) Rerank(ctx context.Context, query string, documents []string, topN int) ([]app.RankResult, error)
Rerank scores documents against query via the /rerank endpoint and returns the results best-first as the provider ordered them. topN is forwarded when set; the Reranker use case still owns final ordering/truncation. Empty documents makes no request.