updates for hf inference api
Browse files- gaia_agent.py +7 -3
gaia_agent.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
-
from smolagents import CodeAgent, Tool,
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from bs4 import BeautifulSoup
|
| 6 |
|
|
@@ -12,8 +12,12 @@ hf_token = os.getenv("HF_TOKEN")
|
|
| 12 |
if not hf_token:
|
| 13 |
raise RuntimeError("Set HF_TOKEN in your Space secrets")
|
| 14 |
|
| 15 |
-
# Initialize the model
|
| 16 |
-
model =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# --- Custom Tools Definition ---
|
| 19 |
class MultiplyTool(Tool):
|
|
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
+
from smolagents import CodeAgent, Tool, InferenceClientModel
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from bs4 import BeautifulSoup
|
| 6 |
|
|
|
|
| 12 |
if not hf_token:
|
| 13 |
raise RuntimeError("Set HF_TOKEN in your Space secrets")
|
| 14 |
|
| 15 |
+
# Initialize the model using InferenceClientModel (renamed from HfApiModel)
|
| 16 |
+
model = InferenceClientModel(
|
| 17 |
+
model_id="Qwen/Qwen2.5-72B-Instruct",
|
| 18 |
+
token=hf_token,
|
| 19 |
+
timeout=120
|
| 20 |
+
)
|
| 21 |
|
| 22 |
# --- Custom Tools Definition ---
|
| 23 |
class MultiplyTool(Tool):
|