tsumarios commited on
Commit
eca6eaf
·
verified ·
1 Parent(s): d455df1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -16,7 +16,7 @@ class AwesomeAgent:
16
 
17
  def __init__(self):
18
  print("AwesomeAgent initialised.")
19
- self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel(model_name="mistralai/Mistral-7B-Instruct-v0.2"))
20
 
21
  SYSTEM_PROMPT = """
22
  You are a precise, domain-agnostic assistant. For every query, perform internal reasoning silently and respond only with a conclusive output using this format:
@@ -39,9 +39,12 @@ class AwesomeAgent:
39
 
40
  def __call__(self, question: str) -> str:
41
  print(f"Agent received question (first 50 chars): {question[:50]}...")
42
- final_answer = self.agent.run(question)
43
- print(f"Agent returning final answer: {final_answer}")
44
- return final_answer
 
 
 
45
 
46
 
47
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
16
 
17
  def __init__(self):
18
  print("AwesomeAgent initialised.")
19
+ self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel(model="mistralai/Mistral-7B-Instruct-v0.2"))
20
 
21
  SYSTEM_PROMPT = """
22
  You are a precise, domain-agnostic assistant. For every query, perform internal reasoning silently and respond only with a conclusive output using this format:
 
39
 
40
  def __call__(self, question: str) -> str:
41
  print(f"Agent received question (first 50 chars): {question[:50]}...")
42
+ raw = self.agent.run(question)
43
+ print(f"Raw model output: {raw}")
44
+ for line in raw.splitlines():
45
+ if "FINAL:" in line:
46
+ return line.split("FINAL:")[-1].strip().strip('".,')
47
+ return raw.strip()
48
 
49
 
50
  def run_and_submit_all( profile: gr.OAuthProfile | None):