Commit
·
c34a7b1
1
Parent(s):
0e07fa6
adsfasdf
Browse files
app.py
CHANGED
@@ -12,7 +12,8 @@ from smolagents import (
|
|
12 |
OpenAIServerModel,
|
13 |
DuckDuckGoSearchTool,
|
14 |
FinalAnswerTool,
|
15 |
-
PythonInterpreterTool
|
|
|
16 |
)
|
17 |
|
18 |
# (Keep Constants as is)
|
@@ -24,6 +25,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
24 |
from smolagents import CodeAgent, HfApiModel
|
25 |
import os
|
26 |
from smolagents import HfApiModel
|
|
|
27 |
|
28 |
|
29 |
# --- Agent Definition ---
|
@@ -32,16 +34,21 @@ class BasicAgent:
|
|
32 |
print("Initializing BasicAgent with tools...")
|
33 |
|
34 |
# Load OpenAI token from environment
|
35 |
-
openai_token = os.getenv("
|
36 |
if not openai_token:
|
37 |
raise ValueError("Missing OpenAI API token!")
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
# Initialize model and tools
|
40 |
-
model = OpenAIServerModel(
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
)
|
45 |
search_tool = DuckDuckGoSearchTool()
|
46 |
final_answer_tool = FinalAnswerTool()
|
47 |
reverse_tool = ReverseTextTool()
|
|
|
12 |
OpenAIServerModel,
|
13 |
DuckDuckGoSearchTool,
|
14 |
FinalAnswerTool,
|
15 |
+
PythonInterpreterTool,
|
16 |
+
InferenceClientModel
|
17 |
)
|
18 |
|
19 |
# (Keep Constants as is)
|
|
|
25 |
from smolagents import CodeAgent, HfApiModel
|
26 |
import os
|
27 |
from smolagents import HfApiModel
|
28 |
+
from huggingface_hub import login, InferenceClient
|
29 |
|
30 |
|
31 |
# --- Agent Definition ---
|
|
|
34 |
print("Initializing BasicAgent with tools...")
|
35 |
|
36 |
# Load OpenAI token from environment
|
37 |
+
openai_token = os.getenv("HF_TOKEN")
|
38 |
if not openai_token:
|
39 |
raise ValueError("Missing OpenAI API token!")
|
40 |
|
41 |
+
login(openai_token)
|
42 |
+
|
43 |
+
model = InferenceClientModel(provider="auto")
|
44 |
+
|
45 |
+
|
46 |
# Initialize model and tools
|
47 |
+
# model = OpenAIServerModel(
|
48 |
+
# #api_base="openai",
|
49 |
+
# api_key=openai_token,
|
50 |
+
# model_id="gpt-4.1"
|
51 |
+
# )
|
52 |
search_tool = DuckDuckGoSearchTool()
|
53 |
final_answer_tool = FinalAnswerTool()
|
54 |
reverse_tool = ReverseTextTool()
|