2MoOn24mOoN4 commited on
Commit
3774de7
·
verified ·
1 Parent(s): cbd4dd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -10,6 +10,8 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
10
 
11
  # --- Basic Agent Definition ---
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
 
 
13
  class BasicAgent:
14
  def __init__(self):
15
  print("BasicAgent initialized.")
@@ -17,7 +19,8 @@ class BasicAgent:
17
 
18
  def __call__(self, question: str) -> str:
19
  print(f"Agent received question (first 50 chars): {question[:50]}...")
20
- response = self.agent.run(question)
 
21
  return response
22
 
23
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
10
 
11
  # --- Basic Agent Definition ---
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
+
14
+ sys_prompt = 'You are a friendly, humorous, all-knowing and all-powerful question-answering assistant. Please answer questions in the shortest possible words to ensure that the search tool does not exhaust the generator and avoid the StopIteration error.'
15
  class BasicAgent:
16
  def __init__(self):
17
  print("BasicAgent initialized.")
 
19
 
20
  def __call__(self, question: str) -> str:
21
  print(f"Agent received question (first 50 chars): {question[:50]}...")
22
+ messages = [{"role": "system", "content": sys_prompt},{"role": "user", "content": question}]
23
+ response = self.agent.run(messages)
24
  return response
25
 
26
  def run_and_submit_all( profile: gr.OAuthProfile | None):