Skip to main content

Reranking

POST https://gateway.primexos.com/v1/rerank

Rank documents by relevance to a query. Each document may be a string or an object with a text field. top_n is optional and defaults to all results.

POST /v1/rerank · Primex-native

ParameterTypeRequiredDescription
modelstringYesOffering ID to route to (discover IDs via GET /v1/models for this service_type).
querystringYesThe search query to rank the documents against.
documents(string | object)[]YesDocuments to rank (1–1000). Each item is a string or an object with a text field.
top_nintegerNoReturn only the top N ranked documents. Omit to return all.

Billed per query.

curl https://gateway.primexos.com/v1/rerank \
-H "Authorization: Bearer prx-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_LIVE_RERANK_MODEL",
"query": "How does Primex protect funds?",
"documents": [
"Failed requests aren't billed.",
"VM credentials arrive after provisioning."
],
"top_n": 1
}'

The response returns document indexes and relevance scores plus usage.searches. One request is one billable search unit, independent of the number of returned results. Get the current model name and rate from the live catalogue.