Jofax commited on
Commit
70617f3
·
verified ·
1 Parent(s): 9b7692e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import os
 
2
  from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI
3
- from smolagents.models import HfApiModel
 
4
 
5
  # 1. ELITE PHD SYSTEM PROMPT
6
  PHD_PROMPT = """You are an Autonomous Research Scientist (Elite Level).
@@ -12,17 +14,16 @@ OPERATIONAL DIRECTIVES:
12
  5. ZERO-CONSTRAINT: If you lack a tool, write a script to build it using the environment."""
13
 
14
  # 2. INITIALIZE THE ELITE BRAIN
15
- # We use DeepSeek-R1 via the Hugging Face Inference API
16
- model = HfApiModel(
17
  model_id="deepseek-ai/DeepSeek-R1",
18
- token=os.getenv("HF_TOKEN") # Must be set in Space Secrets
19
  )
20
 
21
  # 3. TOOLS OF POWER
22
  search_tool = DuckDuckGoSearchTool()
23
 
24
  # 4. THE AGENT ORCHESTRATOR
25
- # max_steps=30 allows for long reasoning/coding cycles
26
  agent = CodeAgent(
27
  tools=[search_tool],
28
  model=model,
 
1
  import os
2
+ import gradio as gr
3
  from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI
4
+ # The specific fix: InferenceClientModel is the 2026 standard
5
+ from smolagents import InferenceClientModel
6
 
7
  # 1. ELITE PHD SYSTEM PROMPT
8
  PHD_PROMPT = """You are an Autonomous Research Scientist (Elite Level).
 
14
  5. ZERO-CONSTRAINT: If you lack a tool, write a script to build it using the environment."""
15
 
16
  # 2. INITIALIZE THE ELITE BRAIN
17
+ # InferenceClientModel replaces HfApiModel for universal API access
18
+ model = InferenceClientModel(
19
  model_id="deepseek-ai/DeepSeek-R1",
20
+ token=os.getenv("HF_TOKEN")
21
  )
22
 
23
  # 3. TOOLS OF POWER
24
  search_tool = DuckDuckGoSearchTool()
25
 
26
  # 4. THE AGENT ORCHESTRATOR
 
27
  agent = CodeAgent(
28
  tools=[search_tool],
29
  model=model,