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.4.0.tar.gz.

File metadata

  • Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.4.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.4.0.tar.gz
Algorithm Hash digest
SHA256 58b55cbbee222d1e25875d6955a0d56ed794f01f1266dea6dd477d43c546b2af
MD5 37fef0123d4a7dbd7e90466c740d4ebf
BLAKE2b-256 92e36b31855eda5645a4655fd877a749dc0ef79f1a8de87f20f72657394c8bb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_postprocessor_alibabacloud_aisearch_rerank-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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}

File hashes

Hashes for llama_index_postprocessor_alibabacloud_aisearch_rerank-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1da4896569905456543ccfaf35ba9c234335c0b88b2a1d28b7f5cb1c982f95c2
MD5 1aabfa3b50987482ccdc5de4dd899504
BLAKE2b-256 4b5c1f60aa9ace1eae01e9a37f71f59ac5c436d499d197eff658697113fe2c60

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