Skip to main content

Rerank

Order a list of documents by relevance to a query with nebula-rerank, using a Cohere-compatible request and response.

On this page
POST /api/v1/llm/v1/rerank
Cohere-compatible reranking. Supports Idempotency-Key.

Scope: llm:access

Request

Field Type Notes
model string nebula-rerank (default).
query string, required What you are looking for.
documents array of strings, required Up to 256 documents.
top_n integer Return only the best N.
return_documents boolean Include each document’s text in the results. Default false.
cURL
curl https://api.breachline.io/api/v1/llm/v1/rerank \
  -H "Authorization: Bearer $BREACHLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Which finding affects authentication?",
    "documents": [
      "Missing rate limit on the password reset endpoint",
      "Verbose server banner on the marketing site",
      "Session fixation after login"
    ],
    "top_n": 2
  }'

Response

Response
{
  "id": "rerank-...",
  "model": "nebula-rerank",
  "results": [
    {"index": 2, "relevance_score": 0.91},
    {"index": 0, "relevance_score": 0.84}
  ],
  "usage": {"prompt_tokens": 38, "total_tokens": 38}
}

index is the document’s position in your request. Results are ordered from most to least relevant. Rerank is charged on input tokens at the Nebula input rate.

Search documentation

Type to search guides, the API reference, the CLI and the console guide.

    Enter open↑ ↓ moveEsc close