Skip to main content
LlamaIndex

DashScopeRerank

Using DashScope Rerank Models in LlamaIndex

DashScopeRerank is a reranking postprocessor for LlamaIndex that reorders retrieved results to improve relevance.

Installation

pip install llama-index-postprocessor-dashscope-rerank

Usage Example

from llama_index.postprocessor.dashscope_rerank import DashScopeRerank

reranker = DashScopeRerank(
    api_key="your-api-key",
    model="gte-rerank",
    top_n=3
)

# Use in a query engine
query_engine = index.as_query_engine(
    node_postprocessors=[reranker]
)

Parameters

ParameterTypeRequiredDescription
api_keystringYesYour DashScope API key
modelstringNoName of the reranking model. Default: "gte-rerank"
top_nintegerNoMaximum number of results to return
Overview
Managed Agent API
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Assistant API (Deprecating)
  • Overview