Ritesh-hf commited on
Commit
1cc72f8
1 Parent(s): 24f7cc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -88,9 +88,16 @@ retriever = PineconeHybridSearchRetriever(
88
  llm = ChatOpenAI(temperature=0, model_name="gpt-4o-mini", max_tokens=512)
89
 
90
  # Initialize Reranker
91
- reranker_model = HuggingFaceCrossEncoder(model_name="jinaai/jina-reranker-v2-base-multilingual", model_kwargs={"trust_remote_code":True})
92
- compressor = CrossEncoderReranker(model=reranker_model, top_n=10)
93
 
 
 
 
 
 
 
 
94
  compression_retriever = ContextualCompressionRetriever(
95
  base_compressor=compressor, base_retriever=retriever
96
  )
 
88
  llm = ChatOpenAI(temperature=0, model_name="gpt-4o-mini", max_tokens=512)
89
 
90
  # Initialize Reranker
91
+ # reranker_model = HuggingFaceCrossEncoder(model_name="jinaai/jina-reranker-v2-base-multilingual", model_kwargs={"trust_remote_code":True})
92
+ # compressor = CrossEncoderReranker(model=reranker_model, top_n=10)
93
 
94
+ # compression_retriever = ContextualCompressionRetriever(
95
+ # base_compressor=compressor, base_retriever=retriever
96
+ # )
97
+
98
+ from langchain_community.document_compressors.rankllm_rerank import RankLLMRerank
99
+
100
+ compressor = RankLLMRerank(top_n=3, model="gpt", gpt_model="gpt-4o-mini")
101
  compression_retriever = ContextualCompressionRetriever(
102
  base_compressor=compressor, base_retriever=retriever
103
  )