chezhian commited on
Commit
b4936e8
·
verified ·
1 Parent(s): 3534241

optimised the answer_question function

Browse files
Files changed (1) hide show
  1. agent.py +4 -2
agent.py CHANGED
@@ -65,6 +65,8 @@ agent = CodeAgent(
65
  )
66
 
67
  def answer_question(question: str) -> str:
68
- """Run agent on question and format output"""
69
  result = agent.run(question)
70
- return f"FINAL ANSWER: {result}" if "FINAL ANSWER:" not in result else result
 
 
 
 
65
  )
66
 
67
  def answer_question(question: str) -> str:
 
68
  result = agent.run(question)
69
+ # Ensure output starts with "FINAL ANSWER:"
70
+ if not result.strip().startswith("FINAL ANSWER:"):
71
+ result = f"FINAL ANSWER: {result.strip()}"
72
+ return result