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
Release history Release notifications | RSS feed
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
File details
Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0.tar.gz
.
File metadata
- Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09580252e44c86bc87a08ea253c30127d7025a18fef8728daf6f74eb12e97135 |
|
MD5 | 5f387cd06094d999eb6fc7b7708a1392 |
|
BLAKE2b-256 | e7e18ddb2eee14308da7dd2502b92c9558ee896634fbc69df6283b8bc159ac86 |
File details
Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3548788713fa94705639f9c1c960a7be475f8d61a0a4aa6602617ec6f546571b |
|
MD5 | b4e5d5c8f883a4a665e6dd039ae858b2 |
|
BLAKE2b-256 | 022fc28d06c60b1ef982cdbcbf1ed59a573898f19cb6cc907f0ffb0e5c0dadad |