Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -340,7 +340,7 @@ vectorstore,search_type="similarity",k=4,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,10 @@ def create_compression_retriever(embeddings, base_retriever, chunk_size=500, k=1
|
|
382 |
)
|
383 |
print("compression retriever done")
|
384 |
return compression_retriever
|
|
|
|
|
385 |
|
|
|
386 |
def CohereRerank_retriever(
|
387 |
base_retriever,
|
388 |
cohere_api_key,cohere_model="rerank-multilingual-v2.0", top_n=8
|
@@ -407,10 +410,10 @@ def CohereRerank_retriever(
|
|
407 |
)
|
408 |
print("cohere rerank done")
|
409 |
return retriever_Cohere
|
|
|
410 |
|
411 |
|
412 |
-
|
413 |
-
|
414 |
def retrieval_blocks(
|
415 |
create_vectorstore=True,# if True a Chroma vectorstore is created, else the Chroma vectorstore will be loaded
|
416 |
LLM_service="HuggingFace",
|
@@ -514,7 +517,7 @@ and has {vector_store._collection.count()} chunks.")
|
|
514 |
return retriever
|
515 |
except Exception as e:
|
516 |
print(e)
|
517 |
-
|
518 |
|
519 |
|
520 |
|
@@ -903,7 +906,7 @@ with gr.Blocks(css=css) as demo:
|
|
903 |
btn_clear_conversation = gr.Button("Start New Conversation")
|
904 |
|
905 |
|
906 |
-
with gr.
|
907 |
prompt_template = gr.Dropdown(label="Choose an Expert:", choices=list(prompt_templates.keys()))
|
908 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
909 |
with gr.Accordion("Advanced parameters", open=False):
|
|
|
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 |
+
|
387 |
|
388 |
+
'''
|
389 |
def CohereRerank_retriever(
|
390 |
base_retriever,
|
391 |
cohere_api_key,cohere_model="rerank-multilingual-v2.0", top_n=8
|
|
|
410 |
)
|
411 |
print("cohere rerank done")
|
412 |
return retriever_Cohere
|
413 |
+
'''
|
414 |
|
415 |
|
416 |
+
'''
|
|
|
417 |
def retrieval_blocks(
|
418 |
create_vectorstore=True,# if True a Chroma vectorstore is created, else the Chroma vectorstore will be loaded
|
419 |
LLM_service="HuggingFace",
|
|
|
517 |
return retriever
|
518 |
except Exception as e:
|
519 |
print(e)
|
520 |
+
'''
|
521 |
|
522 |
|
523 |
|
|
|
906 |
btn_clear_conversation = gr.Button("Start New Conversation")
|
907 |
|
908 |
|
909 |
+
with gr.Column(visible=False):
|
910 |
prompt_template = gr.Dropdown(label="Choose an Expert:", choices=list(prompt_templates.keys()))
|
911 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
912 |
with gr.Accordion("Advanced parameters", open=False):
|