# Sample dictionary documents with 'text' field
docs_dict = [
{
"id": "doc1",
"text": "Article about renewable energy.",
"title": "Renewable Energy",
},
{"id": "doc2", "text": "Report on economic growth.", "title": "Economic Growth"},
{
"id": "doc3",
"text": "News on climate policy changes.",
"title": "Climate Policy",
},
]
# Initialize reranker with rank_fields
reranker_text = PineconeRerank(model="bge-reranker-v2-m3", rank_fields=["text"])
climate_docs = reranker_text.rerank(docs_dict, "Latest news on climate change.")
# Show IDs and scores
for res in climate_docs:
print(f"ID: {res['id']} | Score: {res['score']:.4f}")