Spaces:
Sleeping
Sleeping
Update formatter_node.py
Browse files- formatter_node.py +2 -5
formatter_node.py
CHANGED
|
@@ -2,12 +2,9 @@ import re
|
|
| 2 |
|
| 3 |
def formatter_node(llm_output):
|
| 4 |
cleaned = llm_output.strip()
|
| 5 |
-
|
| 6 |
-
# Remove common LLM prefixes
|
| 7 |
cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE)
|
| 8 |
-
|
| 9 |
-
# Remove enclosing quotes if any
|
| 10 |
if cleaned.startswith('"') and cleaned.endswith('"'):
|
| 11 |
cleaned = cleaned[1:-1]
|
| 12 |
-
|
| 13 |
return cleaned.strip()
|
|
|
|
| 2 |
|
| 3 |
def formatter_node(llm_output):
|
| 4 |
cleaned = llm_output.strip()
|
| 5 |
+
# Remove common prefixes like "Answer:", "Final Answer:"
|
|
|
|
| 6 |
cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE)
|
| 7 |
+
# Remove enclosing quotes if present
|
|
|
|
| 8 |
if cleaned.startswith('"') and cleaned.endswith('"'):
|
| 9 |
cleaned = cleaned[1:-1]
|
|
|
|
| 10 |
return cleaned.strip()
|