DashScopeRerank offers the GTE-Rerank series of text rerank models developed by Alibaba Tongyi Lab. You can integrate these models using the LlamaIndex framework to perform high-quality text retrieval and sorting.
Get started
Prerequisites
- Activate Alibaba Cloud Model Studio. For more information, see Product Activation.
- Create an API key. For more information, see Get and configure an API key.
- Install the DashScopeRerank package (Python >=3.9 and <=3.12).
Sample code
Set the API key.
Parameters
Input parameters
- The following are the parameters for DashScopeRerank.
Parameter | Type | Default value | Description |
|---|---|---|---|
model | string | gte-rerank | Supported models:
|
top_n | int | 3 | The number of top-ranked documents to return. If this parameter is not specified, or if its value is greater than the number of candidate documents, all documents are returned. |
return_documents | bool | False | Specifies whether to include the original document text in the sorted results. The default value is `False`. |
api_key | str | None | The DashScope API key. This can be set through an environment variable or other methods. |