Update app.py
Browse files492 unmodified lines493494495496496497498499500501502503504505506492 unmodified lines
def extract_answer(full_response, instructions=None): try: # Remove the web search results and context information # Remove the web search results, context information, and "Human:" prefix web_results_pattern = r"Answer based on: Web Results:.*?(?=\n\n)" context_pattern = r"Context:.*?Entities:.*?}\s*" human_prefix_pattern = r"Human:\s*" full_response = re.sub(web_results_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE) full_response = re.sub(context_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE) full_response = re.sub(human_prefix_pattern, "", full_response, flags=re.IGNORECASE)
# List of patterns to remove patterns_to_remove = [app.py+3-1