# LlamaIndex Postprocessor Integration: Alibabacloud_Aisearch_Rerank
## Installation
```bash
pip install llama-index-postprocessor-alibabacloud-aisearch-rerank
```
## Usage
For further details, please visit [ranker-api-details](https://help.aliyun.com/zh/open-search/search-platform/developer-reference/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`.
```python
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}")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-postprocessor-alibabacloud-aisearch-rerank",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": null,
"author": "llama-index",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e7/e1/8ddb2eee14308da7dd2502b92c9558ee896634fbc69df6283b8bc159ac86/llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0.tar.gz",
"platform": null,
"description": "# LlamaIndex Postprocessor Integration: Alibabacloud_Aisearch_Rerank\n\n## Installation\n\n```bash\npip install llama-index-postprocessor-alibabacloud-aisearch-rerank\n```\n\n## Usage\n\nFor further details, please visit [ranker-api-details](https://help.aliyun.com/zh/open-search/search-platform/developer-reference/ranker-api-details).\n\nYou can specify the `endpoint` and `aisearch_api_key` in the constructor, or set the environment variables `AISEARCH_ENDPOINT` and `AISEARCH_API_KEY`.\n\n```python\nfrom llama_index.core.data_structs import Node\nfrom llama_index.core.schema import NodeWithScore\nfrom llama_index.postprocessor.alibabacloud_aisearch_rerank import (\n AlibabaCloudAISearchRerank,\n)\n\nnodes = [\n NodeWithScore(\n node=Node(id_=\"1\", text=\"<text1>\"),\n score=0.7,\n ),\n NodeWithScore(\n node=Node(id_=\"2\", text=\"<text2>\"),\n score=0.8,\n ),\n NodeWithScore(\n node=Node(id_=\"3\", text=\"<text3>\"),\n score=0.1,\n ),\n]\nreranker = AlibabaCloudAISearchRerank(top_n=2)\nnew_nodes = reranker.postprocess_nodes(nodes, query_str=\"<query>\")\nfor node in new_nodes:\n print(f\"{node.node.text[:20]}\\t{node.score}\")\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index postprocessor alibabacloud_aisearch_rerank integration",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "022fc28d06c60b1ef982cdbcbf1ed59a573898f19cb6cc907f0ffb0e5c0dadad",
"md5": "b4e5d5c8f883a4a665e6dd039ae858b2",
"sha256": "3548788713fa94705639f9c1c960a7be475f8d61a0a4aa6602617ec6f546571b"
},
"downloads": -1,
"filename": "llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4e5d5c8f883a4a665e6dd039ae858b2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 4173,
"upload_time": "2024-09-11T04:15:27",
"upload_time_iso_8601": "2024-09-11T04:15:27.453774Z",
"url": "https://files.pythonhosted.org/packages/02/2f/c28d06c60b1ef982cdbcbf1ed59a573898f19cb6cc907f0ffb0e5c0dadad/llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e7e18ddb2eee14308da7dd2502b92c9558ee896634fbc69df6283b8bc159ac86",
"md5": "5f387cd06094d999eb6fc7b7708a1392",
"sha256": "09580252e44c86bc87a08ea253c30127d7025a18fef8728daf6f74eb12e97135"
},
"downloads": -1,
"filename": "llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5f387cd06094d999eb6fc7b7708a1392",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 3440,
"upload_time": "2024-09-11T04:15:28",
"upload_time_iso_8601": "2024-09-11T04:15:28.766073Z",
"url": "https://files.pythonhosted.org/packages/e7/e1/8ddb2eee14308da7dd2502b92c9558ee896634fbc69df6283b8bc159ac86/llama_index_postprocessor_alibabacloud_aisearch_rerank-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 04:15:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-postprocessor-alibabacloud-aisearch-rerank"
}