Skip to main content

Module rerank

Module rerank 

Source
Expand description

Port of lib/ruby_llm/rerank.rb (RubyLLM.rerank), Protocol#rerank, and lib/ruby_llm/protocols/chat_completions/rerank.rb, the Jina-style endpoint OpenRouter and GPUStack serve. Cohere’s and Bedrock’s rerank protocols belong to providers RustLLM does not port.

rerank = RubyLLM.rerank("what is ruby", docs, model: "voyageai/rerank-2.5-lite", provider: :openrouter)
rerank.results.first.document # => "Ruby is a programming language"

Structs§

Rerank
Documents ordered by relevance to a query (RubyLLM::Rerank).
RerankOptions
Options for rerank, the keyword arguments of Rerank.rerank.
RerankResult
One reranked document (RubyLLM::Rerank::Result).

Functions§

rerank
RubyLLM.rerank(query, documents, model:, provider:, top_n:, provider_options:, metadata:), inside a rerank.rust_llm event. model is required: rerank catalogs are provider-specific.