llama-index postprocessor alibabacloud_aisearch_rerank integration
Project description
LlamaIndex Postprocessor Integration: Alibabacloud_Aisearch_Rerank
Installation
pip install llama-index-postprocessor-alibabacloud-aisearch-rerank
Usage
For further details, please visit ranker-api-details.
You can specify the endpoint and aisearch_api_key in the constructor, or set the environment variables AISEARCH_ENDPOINT and AISEARCH_API_KEY.
from llama_index.core.data_structs import Node
from llama_index.core.schema import NodeWithScore
from llama_index.postprocessor.alibabacloud_aisearch_rerank import (
AlibabaCloudAISearchRerank,
)
nodes = [
NodeWithScore(
node=Node(id_="1", text="<text1>"),
score=0.7,
),
NodeWithScore(
node=Node(id_="2", text="<text2>"),
score=0.8,
),
NodeWithScore(
node=Node(id_="3", text="<text3>"),
score=0.1,
),
]
reranker = AlibabaCloudAISearchRerank(top_n=2)
new_nodes = reranker.postprocess_nodes(nodes, query_str="<query>")
for node in new_nodes:
print(f"{node.node.text[:20]}\t{node.score}")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.0.tar.gz.
File metadata
- Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d0b0921b4390c4cb8032611f468eee3f51cd9a8e8d26472da4b05cb2fcc5337
|
|
| MD5 |
8b37e9406b6e16cb1f7c45da9c5009ed
|
|
| BLAKE2b-256 |
820885f35dda0c0dfa9902e45d72e5b44bdaaafe75b86fbf5764b5e7665e8819
|
File details
Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a99a8cd675f218c560796011bdbcf41822ff9c3b4bbe3f0f40824a303b7f2ae9
|
|
| MD5 |
f5cb994c873e652ca309a6e287806fd1
|
|
| BLAKE2b-256 |
1ad15f53732a279d01a23bf4bf49206ca5135795f101357a91e063d61a28c1aa
|