AbdullahRasul commited on
Commit
bef899b
·
verified ·
1 Parent(s): 9ad2292

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -14,18 +14,11 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  class BasicAgent:
15
  def __init__(self):
16
 
17
- openai_key_present = bool(os.getenv("OPENAI_API_KEY"))
18
- print("OPENAI_API_KEY loaded:", openai_key_present)
19
- if not openai_key_present:
20
- raise ValueError("OPENAI_API_KEY environment variable not set.")
21
 
22
- # Check if Hugging Face token is set
23
- hf_token = os.getenv("HF_API_TOKEN")
24
- if not hf_token:
25
- raise ValueError("HF_API_TOKEN environment variable not set.")
26
-
27
- # Initialize model
28
- model = OpenAIServerModel(model_id="gpt-3.5-turbo")
29
 
30
  # Initialize tools
31
  search_tool = DuckDuckGoSearchTool()
 
14
  class BasicAgent:
15
  def __init__(self):
16
 
17
+ api_key = os.getenv("OPENAI_API_KEY")
18
+ if not api_key:
19
+ raise ValueError("OPENAI_API_KEY not found. Please set it as a Hugging Face secret.")
 
20
 
21
+ model = OpenAIServerModel(model_id="gpt-4o", api_key=api_key)
 
 
 
 
 
 
22
 
23
  # Initialize tools
24
  search_tool = DuckDuckGoSearchTool()