Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,19 +29,19 @@ collection_name_qna = 'report_10K_db'
|
|
29 |
persisted_vectordb_location = 'report_10K_db'
|
30 |
|
31 |
# Load the persisted vectorDB
|
32 |
-
|
33 |
vectorstore_persisted = Chroma(
|
34 |
collection_name='report_10K_db',
|
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 |
-
|
45 |
# Prepare the logging functionality
|
46 |
|
47 |
log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
@@ -107,7 +107,7 @@ def predict(user_input,company):
|
|
107 |
# Create context_for_query
|
108 |
user_input = user_input
|
109 |
relevant_document_chunks = vectorstore_retriever.get_relevant_documents(user_input,k=5,filter={"source":filter_company})
|
110 |
-
|
111 |
context_list = [d.page_content for d in relevant_document_chunks]
|
112 |
context_for_query = ". ".join(context_list)
|
113 |
print("context_for_query",context_for_query)
|
|
|
29 |
persisted_vectordb_location = 'report_10K_db'
|
30 |
|
31 |
# Load the persisted vectorDB
|
32 |
+
|
33 |
vectorstore_persisted = Chroma(
|
34 |
collection_name='report_10K_db',
|
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 |
+
|
45 |
# Prepare the logging functionality
|
46 |
|
47 |
log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
|
|
107 |
# Create context_for_query
|
108 |
user_input = user_input
|
109 |
relevant_document_chunks = vectorstore_retriever.get_relevant_documents(user_input,k=5,filter={"source":filter_company})
|
110 |
+
|
111 |
context_list = [d.page_content for d in relevant_document_chunks]
|
112 |
context_for_query = ". ".join(context_list)
|
113 |
print("context_for_query",context_for_query)
|