mnavas commited on
Commit
9585b09
·
verified ·
1 Parent(s): 2181af7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -14,10 +14,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  class BasicAgent:
16
  def __init__(self):
 
 
 
 
 
 
 
 
17
  print("BasicAgent initialized.")
18
  def __call__(self, question: str) -> str:
19
  print(f"Agent received question (first 50 chars): {question[:50]}...")
20
- fixed_answer = "This is a default answer."
 
 
21
  print(f"Agent returning fixed answer: {fixed_answer}")
22
  return fixed_answer
23
 
@@ -42,12 +52,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
42
 
43
  # 1. Instantiate Agent ( modify this part to create your agent)
44
  try:
45
- agent = BasicAgent(
46
- tools=[GoogleSearchTool],
47
- model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
48
- add_base_tools=True, # Add any additional base tools
49
- planning_interval=3 # Enable planning every 3 steps
50
- )
51
  except Exception as e:
52
  print(f"Error instantiating agent: {e}")
53
  return f"Error initializing agent: {e}", None
 
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  class BasicAgent:
16
  def __init__(self):
17
+ model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct") #, provider="together")
18
+ self.agent = codeAgent(
19
+ tools=[GoogleSearchTool],
20
+ model=model,
21
+ add_base_tools=True, # Add any additional base tools
22
+ max_steps=15,
23
+ planning_interval=3 # Enable planning every 3 steps
24
+ )
25
  print("BasicAgent initialized.")
26
  def __call__(self, question: str) -> str:
27
  print(f"Agent received question (first 50 chars): {question[:50]}...")
28
+ fixed_answer = agent.run(
29
+ f"Answer the following question: {question[:50]}"
30
+ )
31
  print(f"Agent returning fixed answer: {fixed_answer}")
32
  return fixed_answer
33
 
 
52
 
53
  # 1. Instantiate Agent ( modify this part to create your agent)
54
  try:
55
+ agent = BasicAgent()
 
 
 
 
 
56
  except Exception as e:
57
  print(f"Error instantiating agent: {e}")
58
  return f"Error initializing agent: {e}", None