Final_Assignment_Template / formatter_node.py
Umer797's picture
Update formatter_node.py
71c390e verified
raw
history blame contribute delete
280 Bytes
import re
def formatter_node(llm_output):
cleaned = llm_output.strip()
cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE)
if cleaned.startswith('"') and cleaned.endswith('"'):
cleaned = cleaned[1:-1]
return cleaned.strip()