Spaces:
Sleeping
Sleeping
Upload tool
Browse files- agent.json +7 -7
- app.py +6 -1
- requirements.txt +2 -2
- tools/visit_webpage.py +1 -1
agent.json
CHANGED
@@ -35,17 +35,17 @@
|
|
35 |
"name": null,
|
36 |
"description": null,
|
37 |
"authorized_imports": [
|
38 |
-
"time",
|
39 |
-
"unicodedata",
|
40 |
-
"statistics",
|
41 |
-
"re",
|
42 |
"datetime",
|
43 |
-
"random",
|
44 |
"pandas",
|
45 |
-
"collections",
|
46 |
"math",
|
|
|
47 |
"queue",
|
|
|
48 |
"itertools",
|
49 |
-
"
|
|
|
|
|
|
|
|
|
50 |
]
|
51 |
}
|
|
|
35 |
"name": null,
|
36 |
"description": null,
|
37 |
"authorized_imports": [
|
|
|
|
|
|
|
|
|
38 |
"datetime",
|
|
|
39 |
"pandas",
|
|
|
40 |
"math",
|
41 |
+
"statistics",
|
42 |
"queue",
|
43 |
+
"collections",
|
44 |
"itertools",
|
45 |
+
"re",
|
46 |
+
"time",
|
47 |
+
"stat",
|
48 |
+
"random",
|
49 |
+
"unicodedata"
|
50 |
]
|
51 |
}
|
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
|
|
|
2 |
from smolagents import GradioUI, CodeAgent, HfApiModel
|
3 |
|
4 |
from tools.web_search import DuckDuckGoSearchTool
|
@@ -16,6 +17,10 @@ visit_webpage = VisitWebpageTool()
|
|
16 |
final_answer = FinalAnswerTool()
|
17 |
|
18 |
|
|
|
|
|
|
|
|
|
19 |
agent = CodeAgent(
|
20 |
model=model,
|
21 |
tools=[web_search, visit_webpage, final_answer],
|
@@ -25,7 +30,7 @@ agent = CodeAgent(
|
|
25 |
planning_interval=None,
|
26 |
name=None,
|
27 |
description=None,
|
28 |
-
|
29 |
)
|
30 |
|
31 |
GradioUI(agent).launch()
|
|
|
1 |
|
2 |
+
import yaml
|
3 |
from smolagents import GradioUI, CodeAgent, HfApiModel
|
4 |
|
5 |
from tools.web_search import DuckDuckGoSearchTool
|
|
|
17 |
final_answer = FinalAnswerTool()
|
18 |
|
19 |
|
20 |
+
prompt_templates = yaml.safe_load(
|
21 |
+
importlib.resources.files("smolagents.prompts").joinpath("code_agent.yaml").read_text()
|
22 |
+
)
|
23 |
+
|
24 |
agent = CodeAgent(
|
25 |
model=model,
|
26 |
tools=[web_search, visit_webpage, final_answer],
|
|
|
30 |
planning_interval=None,
|
31 |
name=None,
|
32 |
description=None,
|
33 |
+
prompt_templates=prompt_templates
|
34 |
)
|
35 |
|
36 |
GradioUI(agent).launch()
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
duckduckgo_search
|
2 |
-
|
3 |
pandas
|
|
|
4 |
smolagents
|
5 |
-
requests
|
|
|
1 |
duckduckgo_search
|
2 |
+
requests
|
3 |
pandas
|
4 |
+
markdownify
|
5 |
smolagents
|
|
tools/visit_webpage.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import markdownify
|
4 |
-
import smolagents
|
5 |
import requests
|
|
|
6 |
|
7 |
class VisitWebpageTool(Tool):
|
8 |
name = "visit_webpage"
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import markdownify
|
|
|
4 |
import requests
|
5 |
+
import smolagents
|
6 |
|
7 |
class VisitWebpageTool(Tool):
|
8 |
name = "visit_webpage"
|