LLamaIndex node postprocessing reranker using pinecone hosted models
- use rerank models with the pinecone managed vector service to rerank the search results
- available rerank models from pinecone
import os
from llama_index.core import VectorStoreIndex
from llama_index.core.schema import TextNode
from llama_index.postprocessor.pinecone_native_rerank import (
PineconeNativeRerank,
)
from llama_index.core.response.pprint_utils import pprint_response
os.environ["PINECONE_API_KEY"] = "your_pinecone_api_key"
os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
txts = [
"Apple is a popular fruit known for its sweetness and crisp texture.",
"Apple is known for its innovative products like the iPhone.",
"Many people enjoy eating apples as a healthy snack.",
"Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.",
"An apple a day keeps the doctor away, as the saying goes.",
"apple has a lot of vitamins",
]
nodes = [TextNode(id_=f"vec{i}", text=txt) for i, txt in enumerate(txts)]
pinecone_reranker = PineconeNativeRerank(top_n=4, model="pinecone-rerank-v0")
index = VectorStoreIndex(nodes)
query_engine = index.as_query_engine(
similarity_top_k=10,
node_postprocessors=[pinecone_reranker],
)
response = query_engine.query(
"The tech company Apple is known for its innovative products like the iPhone."
)
pprint_response(response, show_source=True)
output
Final Response: Apple is recognized for its innovative products like
the iPhone.
______________________________________________________________________
Source Node 1/4
Node ID: vec1
Similarity: 0.9655668
Text: Apple is known for its innovative products like the iPhone.
______________________________________________________________________
Source Node 2/4
Node ID: vec3
Similarity: 0.55420566
Text: Apple Inc. has revolutionized the tech industry with its sleek
designs and user-friendly interfaces.
______________________________________________________________________
Source Node 3/4
Node ID: vec4
Similarity: 0.3172258
Text: An apple a day keeps the doctor away, as the saying goes.
______________________________________________________________________
Source Node 4/4
Node ID: vec0
Similarity: 0.25139993
Text: Apple is a popular fruit known for its sweetness and crisp
texture.
Metadata
Release files for llama-index-postprocessor-pinecone-native-rerank 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_postprocessor_pinecone_native_rerank-0.4.0.tar.gz | 5.0 kB | Without provenance | Details for llama_index_postprocessor_pinecone_native_rerank-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_postprocessor_pinecone_native_rerank-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_postprocessor_pinecone_native_rerank-0.4.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / llama_index_postprocessor_pinecone_native_rerank-0.4.0.tar.gz
| Download URL | llama_index_postprocessor_pinecone_native_rerank-0.4.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9142d3b9dfd512bd755a43a100abb80dca763645b3ff17babfb1536dbabc94f7
|
|
BLAKE2b-256 checksum How to use checksums |
e1ffe6cf6dd51afe091c7060b8f38cbefb33c7f0641ba051e4e2c4d3cb79a17c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}
|
Release files / llama_index_postprocessor_pinecone_native_rerank-0.4.0-py3-none-any.whl
| Download URL | llama_index_postprocessor_pinecone_native_rerank-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20d1993f8e4098e9c6ff6833db24caf8542d174c7067bb46cfc9a6278b484c45
|
|
BLAKE2b-256 checksum How to use checksums |
1c433dfd740b46811d6d563a011193f1a1db24ddb1474e3f4294284ab0fca884
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}
|
Security for llama-index-postprocessor-pinecone-native-rerank 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.