kpalatel commited on
Commit
63af69d
·
verified ·
1 Parent(s): 2f10655

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +8 -7
agent.py CHANGED
@@ -1,5 +1,5 @@
1
  import os
2
- from smolagents import CodeAgent, DuckDuckGoSearchTool, tool
3
 
4
  @tool
5
  def calculate_math(expression: str) -> str:
@@ -17,15 +17,16 @@ def calculate_math(expression: str) -> str:
17
 
18
  class CourseEvaluationAgent:
19
  def __init__(self):
20
- print("[Agent System] Booting Engine using direct Hub pipeline...")
21
 
22
- # FIX: We bypass all model objects/classes completely.
23
- # In this smolagents version, passing the model ID as a string parameter
24
- # to 'model_id=' tells the CodeAgent constructor to directly instantiate
25
- # its own internal client, safely avoiding the abstract ApiModel constraint.
 
26
  self.agent = CodeAgent(
 
27
  tools=[DuckDuckGoSearchTool(), calculate_math],
28
- model_id="meta-llama/Llama-3.3-70B-Instruct",
29
  max_steps=5, # Prevents long execution delays or infinite loops
30
  verbosity_level=1
31
  )
 
1
  import os
2
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, tool, HfApiModel
3
 
4
  @tool
5
  def calculate_math(expression: str) -> str:
 
17
 
18
  class CourseEvaluationAgent:
19
  def __init__(self):
20
+ print("[Agent System] Booting Engine...")
21
 
22
+ # FIX: Positionally instantiate HfApiModel so it builds the concrete client.
23
+ # This satisfies CodeAgent's strict requirement for an active 'model' instance.
24
+ self.model = HfApiModel("meta-llama/Llama-3.3-70B-Instruct")
25
+
26
+ # Build the functional CodeAgent, supplying the mandatory positional model parameter
27
  self.agent = CodeAgent(
28
+ model=self.model,
29
  tools=[DuckDuckGoSearchTool(), calculate_math],
 
30
  max_steps=5, # Prevents long execution delays or infinite loops
31
  verbosity_level=1
32
  )