Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
93d7318
1
Parent(s):
50480d9
Update app.py
Browse files
app.py
CHANGED
@@ -340,7 +340,7 @@ vectorstore,search_type="similarity",k=10,score_threshold=None
|
|
340 |
base_retriever_HF = Vectorstore_backed_retriever(vector_store_HF,"similarity",k=10)
|
341 |
|
342 |
|
343 |
-
|
344 |
def create_compression_retriever(embeddings, base_retriever, chunk_size=500, k=16, similarity_threshold=None):
|
345 |
"""Build a ContextualCompressionRetriever.
|
346 |
We wrap the the base_retriever (a vectorstore-backed retriever) into a ContextualCompressionRetriever.
|
@@ -382,7 +382,11 @@ def create_compression_retriever(embeddings, base_retriever, chunk_size=500, k=1
|
|
382 |
)
|
383 |
print("compression retriever done")
|
384 |
return compression_retriever
|
385 |
-
|
|
|
|
|
|
|
|
|
386 |
|
387 |
|
388 |
'''
|
@@ -718,8 +722,8 @@ chain = ConversationalRetrievalChain.from_llm(
|
|
718 |
LLM_provider="Google",api_key=google_api_key,temperature=0.1,
|
719 |
model_name="gemini-pro"),
|
720 |
memory=create_memory("gemini-pro"),
|
721 |
-
|
722 |
-
retriever = base_retriever_HF, #base_retriever_HF
|
723 |
llm=instantiate_LLM(
|
724 |
LLM_provider="Google",api_key=google_api_key,temperature=0.7,
|
725 |
model_name="gemini-pro"),
|
@@ -808,8 +812,8 @@ Standalone question: {question}""")
|
|
808 |
model_name="gemini-pro"),
|
809 |
|
810 |
memory=memory,
|
811 |
-
|
812 |
-
retriever = base_retriever_HF, #changed this
|
813 |
#retriever = retriever,
|
814 |
#llm=llm, #changed this
|
815 |
llm=instantiate_LLM(
|
|
|
340 |
base_retriever_HF = Vectorstore_backed_retriever(vector_store_HF,"similarity",k=10)
|
341 |
|
342 |
|
343 |
+
|
344 |
def create_compression_retriever(embeddings, base_retriever, chunk_size=500, k=16, similarity_threshold=None):
|
345 |
"""Build a ContextualCompressionRetriever.
|
346 |
We wrap the the base_retriever (a vectorstore-backed retriever) into a ContextualCompressionRetriever.
|
|
|
382 |
)
|
383 |
print("compression retriever done")
|
384 |
return compression_retriever
|
385 |
+
|
386 |
+
compression_retriever_HF = create_compression_retriever(
|
387 |
+
embeddings=embeddings_HuggingFace,
|
388 |
+
base_retriever=base_retriever_HF,
|
389 |
+
k=16)
|
390 |
|
391 |
|
392 |
'''
|
|
|
722 |
LLM_provider="Google",api_key=google_api_key,temperature=0.1,
|
723 |
model_name="gemini-pro"),
|
724 |
memory=create_memory("gemini-pro"),
|
725 |
+
retriever = compression_retriever_HF,
|
726 |
+
#retriever = base_retriever_HF, #base_retriever_HF
|
727 |
llm=instantiate_LLM(
|
728 |
LLM_provider="Google",api_key=google_api_key,temperature=0.7,
|
729 |
model_name="gemini-pro"),
|
|
|
812 |
model_name="gemini-pro"),
|
813 |
|
814 |
memory=memory,
|
815 |
+
retriever = compression_retriever_HF,
|
816 |
+
#retriever = base_retriever_HF, #changed this
|
817 |
#retriever = retriever,
|
818 |
#llm=llm, #changed this
|
819 |
llm=instantiate_LLM(
|