Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -19,11 +19,17 @@ def calculate_math(expression: str) -> str:
|
|
| 19 |
|
| 20 |
class CourseEvaluationAgent:
|
| 21 |
def __init__(self):
|
| 22 |
-
print("[Agent System] Booting API
|
| 23 |
|
| 24 |
-
# FIX:
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
self.agent = CodeAgent(
|
| 29 |
tools=[DuckDuckGoSearchTool(), calculate_math],
|
|
|
|
| 19 |
|
| 20 |
class CourseEvaluationAgent:
|
| 21 |
def __init__(self):
|
| 22 |
+
print("[Agent System] Booting API Authenticated Engine...")
|
| 23 |
|
| 24 |
+
# FIX: Explicitly extract the environment secret token.
|
| 25 |
+
# This stops the serverless API from throwing a 401/403 "Error in generating model output"
|
| 26 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 27 |
+
|
| 28 |
+
# Pass the token directly into the InferenceClientModel wrapper
|
| 29 |
+
self.model = InferenceClientModel(
|
| 30 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 31 |
+
token=hf_token
|
| 32 |
+
)
|
| 33 |
|
| 34 |
self.agent = CodeAgent(
|
| 35 |
tools=[DuckDuckGoSearchTool(), calculate_math],
|