teirank

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package teirank implements the native Text Embeddings Inference rerank protocol. It sends {query, texts} to /rerank and reads a bare array of {index, score}; the deployed model is selected by the TEI server, not by a model field in each request.

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 sends rerank requests to a Text Embeddings Inference server.

func New

func New(cfg Config) *Client

New creates a TEI rerank client for the supplied endpoint.

func (*Client) BuildRequestBody

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

BuildRequestBody returns the native TEI request. raw_scores is explicit: false makes a single-class reranker's logits comparable with WeKnora's 0..1 relevance threshold. The model name is configured when TEI starts.

Settings.ExtraBody is merged in but cannot replace query, texts or raw_scores. truncate defaults to true and may be overridden there: TEI before 1.9 starts with --auto-truncate=false and rejects the whole batch when one passage exceeds the model's input length.

func (*Client) Rerank

func (c *Client) Rerank(ctx context.Context, query string, documents []string) ([]api.RerankResult, error)

Rerank scores documents with TEI and preserves their original indexes.

type Config

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

Config supplies the endpoint and wire-level settings for a TEI reranker.

Jump to

Keyboard shortcuts

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