Update app.py
Browse files492 unmodified lines493494495496497498499500501502503504492 unmodified linesdef extract_answer(full_response, instructions=None):try:# Remove the web search results and context informationweb_results_pattern = r"Answer based on: Web Results:.*?(?=\n\n)"context_pattern = r"Context:.*?Entities:.*?}\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)# List of patterns to removepatterns_to_remove = [492 unmodified lines493494495496497498499500501502503504505506492 unmodified linesdef extract_answer(full_response, instructions=None):try:# Remove the web search results, context information, and "Human:" prefixweb_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 removepatterns_to_remove = [
app.py+3-1