Update app.py
Browse files
app.py
CHANGED
@@ -517,8 +517,9 @@ def extract_answer(full_response, instructions=None):
|
|
517 |
full_response = re.sub(instruction_pattern, "", full_response, flags=re.IGNORECASE | re.DOTALL)
|
518 |
|
519 |
# Remove any remaining instruction-like phrases at the beginning of the response
|
520 |
-
|
521 |
-
|
|
|
522 |
lines.pop(0)
|
523 |
full_response = '\n'.join(lines)
|
524 |
|
|
|
517 |
full_response = re.sub(instruction_pattern, "", full_response, flags=re.IGNORECASE | re.DOTALL)
|
518 |
|
519 |
# Remove any remaining instruction-like phrases at the beginning of the response
|
520 |
+
lines = full_response.split('\n')
|
521 |
+
starters = ["answer:", "response:", "here's", "here is"]
|
522 |
+
while lines and any(lines[0].strip().lower().startswith(starter) for starter in starters):
|
523 |
lines.pop(0)
|
524 |
full_response = '\n'.join(lines)
|
525 |
|