Spaces:
Build error
Build error
Create reranker.py
Browse files- reranker.py +7 -0
reranker.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from llama_index.postprocessor.cohere_rerank import CohereRerank
|
| 2 |
+
|
| 3 |
+
def reranker(cohere_key):
|
| 4 |
+
# Define the Cohere Reranking object to return only the first two highest ranking chunks.
|
| 5 |
+
cohere_rerank3 = CohereRerank(top_n=2, api_key=cohere_key,model = 'rerank-english-v3.0')
|
| 6 |
+
return cohere_rerank3
|
| 7 |
+
|