Spaces:
Sleeping
Sleeping
File size: 382 Bytes
3a66e59 7377c46 3a66e59 17bb85a 3a66e59 17bb85a 3a66e59 | 1 2 3 4 5 6 7 8 9 10 11 | import re
def formatter_node(llm_output):
cleaned = llm_output.strip()
# Remove common prefixes like "Answer:", "Final Answer:"
cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE)
# Remove enclosing quotes if present
if cleaned.startswith('"') and cleaned.endswith('"'):
cleaned = cleaned[1:-1]
return cleaned.strip()
|