import re def formatter_node(llm_output): cleaned = llm_output.strip() # Remove common LLM prefixes cleaned = re.sub(r'^(Answer:|Final Answer:)\s*', '', cleaned, flags=re.IGNORECASE) # Remove enclosing quotes if any if cleaned.startswith('"') and cleaned.endswith('"'): cleaned = cleaned[1:-1] return cleaned.strip()