Aller au contenu principal
Velqa

Reranking with Velqa.dev — reorder your RAG results (FR / AR)

Velqa offers multilingual reranking via qwen3-reranker-8b (Alibaba), on the API https://api.velqa.dev/v1/rerank. The reranker takes a query and a list of documents, then reorders them by their real relevance to the query — it complements embeddings in a RAG pipeline to surface the best passages before sending them to the chat model. It is included in every plan (Starter, Dev, Pro, Recharge Boost).

Why a reranker?

Embedding search is fast but approximate: it brings vectors close together, not necessarily exact meaning. A reranker re-reads each (query, document) pair and assigns a fine-grained relevance_score. The typical pattern:

  1. Embeddings (bge-m3 or qwen3-embedding-8b) fetch the 20–50 closest candidates.
  2. qwen3-reranker-8b reorders them and you keep the top 3–5.
  3. You send that top set to the chat model as context.

Pricing

Billed on input tokens (query + documents), with no output tokens.

ModelTypeIndicative price (MAD/M input tokens)
qwen3-reranker-8bRerank~0.6 MAD

The exact price is shown in your dashboard and depends on the current USD/MAD exchange rate.

Example with curl

curl https://api.velqa.dev/v1/rerank \
  -H "Authorization: Bearer $VELQA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-reranker-8b",
    "query": "How do I top up my balance in dirhams?",
    "documents": [
      "Payment is made in MAD from the dashboard.",
      "Whisper transcribes audio in French and darija.",
      "Choose Top up, then an amount in dirhams."
    ]
  }'

Example with Python

import requests

resp = requests.post(
    "https://api.velqa.dev/v1/rerank",
    headers={"Authorization": "Bearer VELQA_API_KEY"},
    json={
        "model": "qwen3-reranker-8b",
        "query": "How do I top up my balance in dirhams?",
        "documents": [
            "Payment is made in MAD from the dashboard.",
            "Whisper transcribes audio in French and darija.",
            "Choose Top up, then an amount in dirhams.",
        ],
    },
)
for r in resp.json()["results"]:
    print(round(r["relevance_score"], 3), r["index"])

The response contains results, a list sorted from most to least relevant, where each item exposes index (the document's position in your request) and relevance_score. Reorder your documents using index and keep the best ones for your context.

See also