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