Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,9 +32,15 @@ persisted_vectordb_location = './report_10K_db'
|
|
32 |
print("before")
|
33 |
vectorstore_persisted = Chroma(
|
34 |
collection_name=collection_name_qna,
|
35 |
-
persist_directory=
|
36 |
embedding_function=embedding_model
|
37 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
print("after")
|
39 |
# Prepare the logging functionality
|
40 |
|
@@ -100,7 +106,7 @@ def predict(user_input,company):
|
|
100 |
|
101 |
# Create context_for_query
|
102 |
user_input = user_input
|
103 |
-
relevant_document_chunks =
|
104 |
context_list = [d.page_content for d in relevant_document_chunks]
|
105 |
context_for_query = ". ".join(context_list)
|
106 |
|
|
|
32 |
print("before")
|
33 |
vectorstore_persisted = Chroma(
|
34 |
collection_name=collection_name_qna,
|
35 |
+
persist_directory='./report_10K_db',
|
36 |
embedding_function=embedding_model
|
37 |
)
|
38 |
+
|
39 |
+
vectorstore_retriever = vectorstore_persisted.as_retriever(
|
40 |
+
search_type='similarity',
|
41 |
+
search_kwargs={'k': 5}
|
42 |
+
)
|
43 |
+
|
44 |
print("after")
|
45 |
# Prepare the logging functionality
|
46 |
|
|
|
106 |
|
107 |
# Create context_for_query
|
108 |
user_input = user_input
|
109 |
+
relevant_document_chunks = vectorstore_retriever.similarity_search(user_input,k=5,filter={"source":filter_company})
|
110 |
context_list = [d.page_content for d in relevant_document_chunks]
|
111 |
context_for_query = ". ".join(context_list)
|
112 |
|