Umer797 commited on
Commit
3a66e59
·
verified ·
1 Parent(s): e3c0d0c

Update formatter_node.py

Browse files
Files changed (1) hide show
  1. formatter_node.py +12 -1
formatter_node.py CHANGED
@@ -1,2 +1,13 @@
 
 
1
  def formatter_node(llm_output):
2
- return llm_output.strip()
 
 
 
 
 
 
 
 
 
 
1
+ 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()