Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -585,8 +585,11 @@ def clean_response(response_text):
|
|
585 |
document_name = "Unknown"
|
586 |
page_number = "Unknown"
|
587 |
|
588 |
-
# Remove the 'Document(metadata=...'
|
589 |
response_text = re.sub(r'Document\(metadata=\{.*?\},page_content=', '', response_text, flags=re.DOTALL)
|
|
|
|
|
|
|
590 |
|
591 |
# Remove any unwanted escape characters like \u and \u00
|
592 |
response_text = re.sub(r'\\u[0-9A-Fa-f]{4}', '', response_text)
|
@@ -614,6 +617,7 @@ def clean_response(response_text):
|
|
614 |
|
615 |
|
616 |
|
|
|
617 |
# Define a new template specifically for GPT-4o-mini in VDB Details mode
|
618 |
gpt4o_mini_template_details = f"""
|
619 |
As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
|
|
|
585 |
document_name = "Unknown"
|
586 |
page_number = "Unknown"
|
587 |
|
588 |
+
# Remove the entire 'Document(metadata=...' and any mention of it from the response
|
589 |
response_text = re.sub(r'Document\(metadata=\{.*?\},page_content=', '', response_text, flags=re.DOTALL)
|
590 |
+
|
591 |
+
# Remove any mention of "Document:" in the response
|
592 |
+
response_text = re.sub(r'- Document:.*', '', response_text)
|
593 |
|
594 |
# Remove any unwanted escape characters like \u and \u00
|
595 |
response_text = re.sub(r'\\u[0-9A-Fa-f]{4}', '', response_text)
|
|
|
617 |
|
618 |
|
619 |
|
620 |
+
|
621 |
# Define a new template specifically for GPT-4o-mini in VDB Details mode
|
622 |
gpt4o_mini_template_details = f"""
|
623 |
As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
|