kpalatel commited on
Commit
33bbc44
·
verified ·
1 Parent(s): 53ced1d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +10 -4
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 Optimized Engine...")
23
 
24
- # FIX: Swapped to Qwen2.5-Coder. It is the natively recommended model for
25
- # smolagents code execution tasks and responds instantly on the serverless API.
26
- self.model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
 
 
 
 
 
 
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],