Alexandre Gazola commited on
Commit
7ca052e
·
1 Parent(s): 43fc159
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -55,9 +55,13 @@ class LangChainAgent:
55
  "input": question,
56
  "chat_history": []
57
  })
58
- answer = result.get("output", "No answer returned.")
59
- print(f"Agent response: {answer}")
60
- return answer
 
 
 
 
61
 
62
  def run_and_submit_all( profile: gr.OAuthProfile | None):
63
  """
 
55
  "input": question,
56
  "chat_history": []
57
  })
58
+ output = result.get("output", "No answer returned.")
59
+ print(f"Agent response: {output}")
60
+ match = re.search(r"FINAL ANSWER:\s*(.*)", response['output'])
61
+ if match:
62
+ return match.group(1).strip()
63
+ else:
64
+ return output
65
 
66
  def run_and_submit_all( profile: gr.OAuthProfile | None):
67
  """