Update app.py
Browse files
app.py
CHANGED
|
@@ -648,7 +648,6 @@ def ask_question(question, temperature, top_p, repetition_penalty, web_search, g
|
|
| 648 |
model = get_model(temperature, top_p, repetition_penalty)
|
| 649 |
embed = get_embeddings()
|
| 650 |
|
| 651 |
-
# Check if the FAISS database exists
|
| 652 |
if os.path.exists("faiss_database"):
|
| 653 |
database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
|
| 654 |
else:
|
|
@@ -670,7 +669,7 @@ def ask_question(question, temperature, top_p, repetition_penalty, web_search, g
|
|
| 670 |
|
| 671 |
database.save_local("faiss_database")
|
| 672 |
|
| 673 |
-
context_str = "\n".join([doc.page_content for doc in web_docs])
|
| 674 |
|
| 675 |
prompt_template = """
|
| 676 |
Answer the question based on the following web search results:
|
|
|
|
| 648 |
model = get_model(temperature, top_p, repetition_penalty)
|
| 649 |
embed = get_embeddings()
|
| 650 |
|
|
|
|
| 651 |
if os.path.exists("faiss_database"):
|
| 652 |
database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
|
| 653 |
else:
|
|
|
|
| 669 |
|
| 670 |
database.save_local("faiss_database")
|
| 671 |
|
| 672 |
+
context_str = "\n".join([f"Source: {doc.metadata['source']}\nContent: {doc.page_content}" for doc in web_docs])
|
| 673 |
|
| 674 |
prompt_template = """
|
| 675 |
Answer the question based on the following web search results:
|