Help us shape the future of Go! Take the 2026 Go Developer Survey

reranker

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = internalreranker.Config

Config configures an HTTPReranker: BaseURL, optional APIKey, and Model.

type HTTPReranker

type HTTPReranker = internalreranker.HTTPReranker

HTTPReranker speaks the Cohere-compatible rerank API shape, also understood by self-hosted alternatives (HuggingFace TEI, vLLM). LangSearchReranker is HTTPReranker preconfigured for LangSearch's hosted API - both names refer to the same underlying type.

func New

func New(cfg Config) *HTTPReranker

New creates an HTTPReranker from an explicit Config - use this to point at a self-hosted rerank server (e.g. a local TEI or vLLM instance serving BAAI/bge-reranker-v2-m3) instead of LangSearch's hosted API.

func NewFromEnv

func NewFromEnv() *HTTPReranker

NewFromEnv builds a reranker from RAG_RERANK_URL / RAG_RERANK_MODEL / RAG_RERANK_API_KEY, falling back to LangSearch's hosted API when only LANGSEARCH_API_KEY is set. See internal/rag/reranker's package doc.

type LangSearchReranker

type LangSearchReranker = internalreranker.LangSearchReranker

LangSearchReranker is HTTPReranker preconfigured for LangSearch's hosted rerank API (langsearch.com - no credit card required for the free tier). Kept as a distinct name for backward compatibility; for a fully free, self-hosted alternative requiring no API key, use New/NewFromEnv with a BaseURL pointing at a local TEI or vLLM instance instead - see reranker.go's package doc.

func NewLangSearchRerankerWithKey

func NewLangSearchRerankerWithKey(apiKey string) *LangSearchReranker

NewLangSearchRerankerWithKey builds a reranker pointed at LangSearch's hosted API specifically. An empty apiKey produces an unconfigured reranker rather than one pointed at LangSearch with no credentials.

type Profile added in v1.8.0

type Profile = internalreranker.Profile

Profile describes a hosted rerank provider: endpoint, key variables, request shape and models (the first model is the default).

func ProfileFor added in v1.8.0

func ProfileFor(id string) (Profile, bool)

ProfileFor returns the rerank profile of a provider ID.

func Profiles added in v1.8.0

func Profiles() []Profile

Profiles returns the rerank providers this build knows (Cohere, Voyage AI, OpenRouter, LangSearch). RAG_RERANK_PROVIDER selects one from the environment.

Jump to

Keyboard shortcuts

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