Skip to main content

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.1.tar.gz
Algorithm Hash digest
SHA256 731b06018ec06b281f4644f39003c6cf2f5e6857259729466a32a5a8b5d7fc47
MD5 7d54f86045211d3c7951896d979bbf46
BLAKE2b-256 6eb24f912890d58eec3159e96e0cdf0b9395d621fc9a6ef328d3f91e91bee6d6

See more details on using hashes here.

File details

Details for the file llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f62f01c5a0fd036ba4e8ce10aa744545063be20c37b415ed12d6b904bc6aa87
MD5 3bebbe8e44be9db68287dcf2d0d02b8b
BLAKE2b-256 a76c655cf3cb2ff7f9f499dc086773e9b4962019ce87369edbbd0286a3e6bbb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page