POST /v1/rerank
This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.
Servers
- https://api.cohere.com
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
X-Client-Name |
String | No |
The name of the project that is making the request. |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
documents[] |
Array | Yes |
A list of document objects or strings to rerank. If a document is provided the text fields is required and all other fields will be preserved in the response. The total max chunks (length of documents * max_chunks_per_doc) must be less than 10000. We recommend a maximum of 1,000 documents for optimal endpoint performance. |
query |
String | Yes |
The search query |
rank_fields[] |
Array | No |
If a JSON object is provided, you can specify which keys you would like to have considered for reranking. The model will rerank based on order of the fields passed in (i.e. rank_fields=['title','author','text'] will rerank using the values in title, author, text sequentially. If the length of title, author, and text exceeds the context length of the model, the chunking will not re-consider earlier fields). If not provided, the model will use the default text field for ranking. |
return_documents |
Boolean | No |
Default value: false |
model |
String | No |
The identifier of the model to use, eg |
top_n |
Integer | No |
The number of most relevant documents or indices to return, defaults to the length of the documents |
max_chunks_per_doc |
Integer | No |
The maximum number of chunks to produce internally from a document Default value: 10 |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.