George Sergia commited on
Commit
0a4cec3
·
1 Parent(s): b216a70

Test if token is loaded

Browse files
Files changed (1) hide show
  1. agent.py +4 -1
agent.py CHANGED
@@ -2,6 +2,8 @@ from smolagents import DuckDuckGoSearchTool, CodeAgent, HfApiModel
2
  import os
3
  import yaml
4
 
 
 
5
  class BasicAgent:
6
  def __init__(self):
7
  print("BasicAgent initialized.")
@@ -12,7 +14,8 @@ class BasicAgent:
12
  with open("prompts.yaml", 'r') as stream:
13
  prompt_templates = yaml.safe_load(stream)
14
 
15
- HF_TOKEN = os.getenv("HF_TOKEN")
 
16
 
17
  model = HfApiModel(model_id="Qwen/Qwen3-235B-A22B", token=HF_TOKEN)
18
  search_tool = DuckDuckGoSearchTool()
 
2
  import os
3
  import yaml
4
 
5
+ HF_TOKEN = os.getenv("HF_TOKEN")
6
+
7
  class BasicAgent:
8
  def __init__(self):
9
  print("BasicAgent initialized.")
 
14
  with open("prompts.yaml", 'r') as stream:
15
  prompt_templates = yaml.safe_load(stream)
16
 
17
+ if HF_TOKEN is None:
18
+ raise ValueError("HF_TOKEN environment variable is not set.")
19
 
20
  model = HfApiModel(model_id="Qwen/Qwen3-235B-A22B", token=HF_TOKEN)
21
  search_tool = DuckDuckGoSearchTool()