Update app.py
Browse files
app.py
CHANGED
|
@@ -493,8 +493,11 @@ def ask_question(question, temperature, top_p, repetition_penalty, web_search, c
|
|
| 493 |
|
| 494 |
def extract_answer(full_response, instructions=None):
|
| 495 |
try:
|
| 496 |
-
# Remove the
|
| 497 |
-
|
|
|
|
|
|
|
|
|
|
| 498 |
full_response = re.sub(context_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
|
| 499 |
|
| 500 |
# List of patterns to remove
|
|
|
|
| 493 |
|
| 494 |
def extract_answer(full_response, instructions=None):
|
| 495 |
try:
|
| 496 |
+
# Remove the web search results and context information
|
| 497 |
+
web_results_pattern = r"Answer based on: Web Results:.*?(?=\n\n)"
|
| 498 |
+
context_pattern = r"Context:.*?Entities:.*?}\s*"
|
| 499 |
+
|
| 500 |
+
full_response = re.sub(web_results_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
|
| 501 |
full_response = re.sub(context_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
|
| 502 |
|
| 503 |
# List of patterns to remove
|