Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
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
|
| 21 |
|
| 22 |
-
# FIX:
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 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 |
)
|