nimrerank

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0, MIT Imports: 4 Imported by: 0

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

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 New

func New(cfg Config) *Client

New builds a client.

func (*Client) AcceptsImages

func (c *Client) AcceptsImages() bool

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

func (c *Client) BuildRequestBody(query string, documents []string) (map[string]any, error)

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.

type Config

type Config struct {
	Endpoint api.Endpoint
	Settings api.RerankSettings
}

Config is everything the client needs, already resolved by the api.

Jump to

Keyboard shortcuts

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