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

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.2.0.tar.gz
Algorithm Hash digest
SHA256 27e47d02ae61380586e343667407f69b8edadf0cb7d9ad00ff3baea7924b7a70
MD5 d3f8649ae5e793254a03ba8109ba7f62
BLAKE2b-256 ca5b63424d299648b22475d14fa364dce2c2054527a09b989cdc668a58db204d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d088a753b16527cbc6ef61dfd7add0c3d0e6a0b34cbfab2969face344dda53d3
MD5 0f78e0b1393c4af3d497b4e6c5b29d66
BLAKE2b-256 f3e9bf3b85cf1b535990835b847945b1a8976aa8f22ebf7db725c4358a52d9d7

See more details on using hashes here.

Supported by

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