LlamaIndex Postprocessor Integration: DashScope-Rerank
The llama-index-postprocessor-dashscope-rerank package contains LlamaIndex integrations for the gte-rerank series models provided by Alibaba Tongyi Laboratory.
Installation
pip install --upgrade llama-index llama-index-core llama-index-postprocessor-dashscope-rerank
Setup
Get started:
- Obtain the API-KEY from the Alibaba Cloud ModelStudio platform.
- Set API-KEY
export DASHSCOPE_API_KEY=YOUR_DASHSCOPE_API_KEY
Example:
from llama_index.core.data_structs import Node
from llama_index.core.schema import NodeWithScore
from llama_index.postprocessor.dashscope_rerank import DashScopeRerank
nodes = [
NodeWithScore(node=Node(text="text1"), score=0.7),
NodeWithScore(node=Node(text="text2"), score=0.8),
]
dashscope_rerank = DashScopeRerank(top_n=5)
results = dashscope_rerank.postprocess_nodes(nodes, query_str="<user query>")
for res in results:
print("Text: ", res.node.get_content(), "Score: ", res.score)
output
Text: text1 Score: 0.25589250620997755
Text: text2 Score: 0.18071043165292258
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | str |
model name | gte-rerank |
| top_n | int |
The number of top documents to be returned in the ranking; if not specified, all candidate documents will be returned. If the specified top_n value exceeds the number of input candidate documents, all documents will be returned. | 3 |
| return_documents | bool |
Whether to return the original text for each document in the returned sorted result list, with the default value being False. | False |
| api_key | str |
The DashScope api key. | None |
Metadata
Release files for llama-index-postprocessor-dashscope-rerank 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_postprocessor_dashscope_rerank-0.6.0.tar.gz | 4.8 kB | Without provenance | Details for llama_index_postprocessor_dashscope_rerank-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_postprocessor_dashscope_rerank-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_postprocessor_dashscope_rerank-0.6.0-py3-none-any.whl |
Total release size: 9.4 kB
Release files / llama_index_postprocessor_dashscope_rerank-0.6.0.tar.gz
| Download URL | llama_index_postprocessor_dashscope_rerank-0.6.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08aeb5e78343d857fa6f61e87d0097118396bbf2cbe9e21df75ef985044975b2
|
|
BLAKE2b-256 checksum How to use checksums |
739c5916b8676f5c6ae8ea82c97e508ad8a4c171ccf07ea8e7976579825c1afc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_postprocessor_dashscope_rerank-0.6.0-py3-none-any.whl
| Download URL | llama_index_postprocessor_dashscope_rerank-0.6.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42bea5be041266e987e2897a3d10dbcb5917d6def5bececf88ae8230a902a907
|
|
BLAKE2b-256 checksum How to use checksums |
08b0c70abfdf7196e25053bf9d854fec45b63c27d4f720c6538a15b67cf7d13b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-postprocessor-dashscope-rerank 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.