This PR introduces a unified reranker implementation within phi.reranker to support reranking functionality across various vectordb instances, not limited to lancedb. It adds the CohereReranker to allow consistent reranking behavior across different vector databases.
Changes
Implemented a common reranker under phi.reranker to standardize reranking across vectordb instances.
Added CohereReranker to phi.reranker.cohere.py, enabling the integration of Cohere’s reranker with any vectordb instance.
Updated search logic to conditionally apply the reranker, allowing flexible and consistent reranking during searches.
Added reranking_score field to Document to store scores used in reranking.
Added 06_agentic_rag_with_reranking.py to cookbook.rag as an example demonstrating RAG (Retrieval-Augmented Generation) with reranking integration.
Verified functionality with CohereReranker specifically on lancedb to ensure consistent behavior.
1416
Summary
This PR introduces a unified reranker implementation within phi.reranker to support reranking functionality across various vectordb instances, not limited to lancedb. It adds the CohereReranker to allow consistent reranking behavior across different vector databases.
Changes
CohereReranker
tophi.reranker.cohere.py
, enabling the integration of Cohere’s reranker with any vectordb instance.reranking_score
field toDocument
to store scores used in reranking.06_agentic_rag_with_reranking.py
tocookbook.rag
as an example demonstrating RAG (Retrieval-Augmented Generation) with reranking integration.Verified functionality with
CohereReranker
specifically onlancedb
to ensure consistent behavior.