Skip to content

Commit

Permalink
remove cohere rerank temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-sol committed Jul 24, 2024
1 parent e34ffae commit b8b5739
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/custom_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from llama_index.core import QueryBundle
from llama_index.core.retrievers import BaseRetriever, VectorIndexRetriever
from llama_index.core.schema import NodeWithScore, TextNode
from llama_index.postprocessor.cohere_rerank import CohereRerank

# from llama_index.postprocessor.cohere_rerank import CohereRerank

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -72,8 +73,8 @@ def filter_nodes_by_unique_doc_id(nodes):
else:
nodes_context.append(node)

reranker = CohereRerank(top_n=8, model="rerank-english-v3.0")
nodes_context = reranker.postprocess_nodes(nodes_context, query_bundle)
logfire.info(f"Cohere raranking to {len(nodes_context)} nodes")
# reranker = CohereRerank(top_n=8, model="rerank-english-v3.0")
# nodes_context = reranker.postprocess_nodes(nodes_context, query_bundle)
# logfire.info(f"Cohere raranking to {len(nodes_context)} nodes")

return nodes_context

0 comments on commit b8b5739

Please sign in to comment.