Documentation
¶
Overview ¶
Package nimrerank implements NVIDIA NIM's retrieval reranking shape: a query object, a passages array, and rankings carrying a logit.
Two things separate it from the Cohere dialect and both matter to callers. The score is an unbounded log-odds value that is routinely negative, not a 0..1 relevance — api.RerankSettings.ScoreScale says so. And `truncate` defaults to "NONE", which means an over-long passage fails the request instead of being cut, so the vendor sets it explicitly.
https://docs.api.nvidia.com/nim/reference/nvidia-llama-3_2-nv-rerankqa-1b-v2-infer
Index ¶
- type Client
- func (c *Client) AcceptsImages() bool
- func (c *Client) BuildImageRequestBody(query string, images []api.EmbedImage) (map[string]any, error)
- func (c *Client) BuildRequestBody(query string, documents []string) (map[string]any, error)
- func (c *Client) Rerank(ctx context.Context, query string, documents []string) ([]api.RerankResult, error)
- func (c *Client) RerankImages(ctx context.Context, query string, images []api.EmbedImage) ([]api.RerankResult, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks NIM reranking to one endpoint.
func (*Client) AcceptsImages ¶
AcceptsImages is true: image passages are part of the NIM ranking schema. Only the VL models score them, which their catalog input says.
func (*Client) BuildImageRequestBody ¶
func (c *Client) BuildImageRequestBody(query string, images []api.EmbedImage) (map[string]any, error)
BuildImageRequestBody is the golden-test entry point for image passages.
func (*Client) BuildRequestBody ¶
BuildRequestBody is the golden-test entry point.
func (*Client) Rerank ¶
func (c *Client) Rerank(ctx context.Context, query string, documents []string) ([]api.RerankResult, error)
Rerank scores documents against the query. The returned scores are logits; see the package comment.
func (*Client) RerankImages ¶
func (c *Client) RerankImages(ctx context.Context, query string, images []api.EmbedImage) ([]api.RerankResult, error)
RerankImages scores image passages against the query; indices refer to images.