Rerank documents for a query
rerank_documents[PAID $0.002 USDC per call via x402 on Base; errors are free] Cohere/Jina-style rerank: POST {query, documents: string[] | {text}[], top_n, return_documents} and get {results: [{index, relevance_score, document?}]} sorted by relevance. Models (Cloudflare Workers AI): bge-reranker-base (cross-encoder, English/Chinese, scores 0..1); bge-m3 (multilingual similarity scoring) (default bge-reranker-base; other names map to it). Up to 100 documents, each scored on its first 4000 chars; one fixed price per call. Use after vector search to pick the best passages for an LLM. Errors are never charged. All params optional: with none it ranks a small sample.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Rerank model (default bge-reranker-base). | |
| query | No | Search query (max 2000 chars). Optional with documents omitted: a sample is ranked. | |
| top_n | No | Return only the best N (default all). | |
| documents | No | Documents to rank: strings or {text} objects (max 100). | |
| return_documents | No | Include the document text in each result (default false). |