yangminded commited on
Commit
722cdfa
·
verified ·
1 Parent(s): 55d6647

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -42,6 +42,11 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
42
 
43
  # --- Basic Agent Definition ---
44
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
 
 
 
 
 
45
  class BasicAgent:
46
  def __init__(self):
47
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
@@ -55,7 +60,7 @@ class BasicAgent:
55
  prompts = yaml.safe_load(stream)
56
 
57
  #prompt_templates.final_answer.pre_messages = prompts['final_answer']['pre_messages']
58
-
59
  self.agent = CodeAgent(
60
  model=model,
61
  tools=[FinalAnswerTool(), DuckDuckGoSearchTool(), VisitWebpageTool()], ## add your tools here (don't remove final answer),
@@ -65,13 +70,15 @@ class BasicAgent:
65
  #step_callbacks=[delay_execution_10]
66
  )
67
 
68
- #self.agent.prompt_templates['']
 
 
69
 
70
  print("BasicAgent initialized.")
71
 
72
  def __call__(self, question: str) -> str:
73
  print(f"Agent received question (first 50 chars): {question[:50]}...")
74
- answer = self.agent.run(question)
75
  print(f"Agent returning answer: {answer}")
76
  return answer
77
 
 
42
 
43
  # --- Basic Agent Definition ---
44
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
45
+
46
+ # RUNTIME PARAMS
47
+ set_inference_on = False
48
+
49
+ # Agent stuff starts here
50
  class BasicAgent:
51
  def __init__(self):
52
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
60
  prompts = yaml.safe_load(stream)
61
 
62
  #prompt_templates.final_answer.pre_messages = prompts['final_answer']['pre_messages']
63
+
64
  self.agent = CodeAgent(
65
  model=model,
66
  tools=[FinalAnswerTool(), DuckDuckGoSearchTool(), VisitWebpageTool()], ## add your tools here (don't remove final answer),
 
70
  #step_callbacks=[delay_execution_10]
71
  )
72
 
73
+ print('*$%')
74
+
75
+ print(self.agent.prompt_templates['system_prompt'])
76
 
77
  print("BasicAgent initialized.")
78
 
79
  def __call__(self, question: str) -> str:
80
  print(f"Agent received question (first 50 chars): {question[:50]}...")
81
+ answer = self.agent.run(question) if set_inference_on else "DEFAULT: INFERENCE IS SET TO INACTIVE."
82
  print(f"Agent returning answer: {answer}")
83
  return answer
84