Skip to main content
Use the Go SDK to rank candidate documents by relevance to a query. Provider/model examples:
  • Cohere: Provider: schemas.Cohere, Model: "rerank-v3.5"
  • vLLM: Provider: schemas.VLLM, Model: "BAAI/bge-reranker-v2-m3"

Basic Example

Parameters

  • Provider, Model: provider/model to use for rerank
  • Query: query text
  • Documents: documents to score (text, optional id, meta)
  • Params.TopN: max result count
  • Params.MaxTokensPerDoc: provider-dependent token cap
  • Params.Priority: provider-dependent priority hint
  • Params.ReturnDocuments: include source document in each result
  • Fallbacks: fallback provider/model choices
For vLLM, set Provider to schemas.VLLM and use the upstream model ID as Model (without the vllm/ prefix that is used in Gateway HTTP requests).

Response

BifrostRerankResponse includes:
  • Results []RerankResult (index, relevance_score, optional document)
  • Model
  • optional Usage
  • ExtraFields metadata (provider, latency, request_type, etc.)

Next Steps