Chris4K commited on
Commit
a967d35
1 Parent(s): e2750f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -32,7 +32,7 @@ from scipy.stats import spearmanr
32
  from functools import lru_cache
33
  from langchain.retrievers import MultiQueryRetriever
34
  from langchain_huggingface.llms import HuggingFacePipeline
35
- from langchain.schema import BaseRunManager, NoOpRunManager
36
  from transformers import pipeline
37
  from sklearn.model_selection import ParameterGrid
38
  from tqdm import tqdm
@@ -199,9 +199,8 @@ def optimize_query(query, llm_model, chunks, embedding_model, vector_store_type,
199
  retriever=temp_retriever,
200
  llm=llm
201
  )
202
- # Use a NoOpRunManager as the run_manager
203
- run_manager = NoOpRunManager()
204
- optimized_queries = multi_query_retriever.generate_queries(query, run_manager=run_manager)
205
  return optimized_queries
206
 
207
 
@@ -1184,7 +1183,7 @@ def optimize_query(query, llm):
1184
  retriever=get_retriever(vector_store, search_type, search_kwargs),
1185
  llm=llm
1186
  )
1187
- optimized_queries = multi_query_retriever.generate_queries(query)
1188
  return optimized_queries
1189
  ````
1190
 
 
32
  from functools import lru_cache
33
  from langchain.retrievers import MultiQueryRetriever
34
  from langchain_huggingface.llms import HuggingFacePipeline
35
+ from langchain.schema import NoOpRunManager
36
  from transformers import pipeline
37
  from sklearn.model_selection import ParameterGrid
38
  from tqdm import tqdm
 
199
  retriever=temp_retriever,
200
  llm=llm
201
  )
202
+ # Use a NoOpRunManager as the run_manager
203
+ optimized_queries = multi_query_retriever.invoke(query)
 
204
  return optimized_queries
205
 
206
 
 
1183
  retriever=get_retriever(vector_store, search_type, search_kwargs),
1184
  llm=llm
1185
  )
1186
+ optimized_queries = multi_query_retriever.invoke(query)
1187
  return optimized_queries
1188
  ````
1189