Spaces:
Sleeping
Sleeping
Upload agent
Browse files- agent.json +10 -9
- app.py +3 -1
- requirements.txt +1 -1
- tools/simple_tool1.py +19 -0
- tools/visit_webpage.py +2 -2
agent.json
CHANGED
@@ -3,13 +3,14 @@
|
|
3 |
"web_search",
|
4 |
"visit_webpage",
|
5 |
"simple_tool",
|
|
|
6 |
"final_answer"
|
7 |
],
|
8 |
"model": {
|
9 |
"class": "HfApiModel",
|
10 |
"data": {
|
11 |
-
"last_input_token_count":
|
12 |
-
"last_output_token_count":
|
13 |
"model_id": "Qwen/Qwen2.5-Coder-32B-Instruct",
|
14 |
"provider": null
|
15 |
}
|
@@ -41,23 +42,23 @@
|
|
41 |
"name": null,
|
42 |
"description": null,
|
43 |
"requirements": [
|
|
|
44 |
"markdownify",
|
45 |
"duckduckgo_search",
|
46 |
-
"requests",
|
47 |
"smolagents"
|
48 |
],
|
49 |
"authorized_imports": [
|
50 |
-
"queue",
|
51 |
"unicodedata",
|
|
|
|
|
52 |
"statistics",
|
53 |
"stat",
|
54 |
-
"datetime",
|
55 |
"math",
|
|
|
|
|
56 |
"itertools",
|
57 |
-
"
|
58 |
-
"time"
|
59 |
-
"collections",
|
60 |
-
"random"
|
61 |
],
|
62 |
"executor_type": "local",
|
63 |
"executor_kwargs": {},
|
|
|
3 |
"web_search",
|
4 |
"visit_webpage",
|
5 |
"simple_tool",
|
6 |
+
"simple_tool1",
|
7 |
"final_answer"
|
8 |
],
|
9 |
"model": {
|
10 |
"class": "HfApiModel",
|
11 |
"data": {
|
12 |
+
"last_input_token_count": 2229,
|
13 |
+
"last_output_token_count": 208,
|
14 |
"model_id": "Qwen/Qwen2.5-Coder-32B-Instruct",
|
15 |
"provider": null
|
16 |
}
|
|
|
42 |
"name": null,
|
43 |
"description": null,
|
44 |
"requirements": [
|
45 |
+
"requests",
|
46 |
"markdownify",
|
47 |
"duckduckgo_search",
|
|
|
48 |
"smolagents"
|
49 |
],
|
50 |
"authorized_imports": [
|
|
|
51 |
"unicodedata",
|
52 |
+
"re",
|
53 |
+
"collections",
|
54 |
"statistics",
|
55 |
"stat",
|
|
|
56 |
"math",
|
57 |
+
"queue",
|
58 |
+
"datetime",
|
59 |
"itertools",
|
60 |
+
"random",
|
61 |
+
"time"
|
|
|
|
|
62 |
],
|
63 |
"executor_type": "local",
|
64 |
"executor_kwargs": {},
|
app.py
CHANGED
@@ -8,6 +8,7 @@ CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
8 |
from tools.web_search import DuckDuckGoSearchTool as WebSearch
|
9 |
from tools.visit_webpage import VisitWebpageTool as VisitWebpage
|
10 |
from tools.simple_tool import SimpleTool as SimpleTool
|
|
|
11 |
from tools.final_answer import FinalAnswerTool as FinalAnswer
|
12 |
|
13 |
|
@@ -20,6 +21,7 @@ provider=None,
|
|
20 |
web_search = WebSearch()
|
21 |
visit_webpage = VisitWebpage()
|
22 |
simple_tool = SimpleTool()
|
|
|
23 |
final_answer = FinalAnswer()
|
24 |
|
25 |
|
@@ -28,7 +30,7 @@ with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
|
|
28 |
|
29 |
agent = CodeAgent(
|
30 |
model=model,
|
31 |
-
tools=[web_search, visit_webpage, simple_tool],
|
32 |
managed_agents=[],
|
33 |
max_steps=20,
|
34 |
verbosity_level=1,
|
|
|
8 |
from tools.web_search import DuckDuckGoSearchTool as WebSearch
|
9 |
from tools.visit_webpage import VisitWebpageTool as VisitWebpage
|
10 |
from tools.simple_tool import SimpleTool as SimpleTool
|
11 |
+
from tools.simple_tool1 import SimpleTool as SimpleTool1
|
12 |
from tools.final_answer import FinalAnswerTool as FinalAnswer
|
13 |
|
14 |
|
|
|
21 |
web_search = WebSearch()
|
22 |
visit_webpage = VisitWebpage()
|
23 |
simple_tool = SimpleTool()
|
24 |
+
simple_tool1 = SimpleTool1()
|
25 |
final_answer = FinalAnswer()
|
26 |
|
27 |
|
|
|
30 |
|
31 |
agent = CodeAgent(
|
32 |
model=model,
|
33 |
+
tools=[web_search, visit_webpage, simple_tool, simple_tool1],
|
34 |
managed_agents=[],
|
35 |
max_steps=20,
|
36 |
verbosity_level=1,
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
|
|
1 |
markdownify
|
2 |
duckduckgo_search
|
3 |
-
requests
|
4 |
smolagents
|
|
|
1 |
+
requests
|
2 |
markdownify
|
3 |
duckduckgo_search
|
|
|
4 |
smolagents
|
tools/simple_tool1.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from smolagents import Tool
|
2 |
+
from typing import Any, Optional
|
3 |
+
|
4 |
+
class SimpleTool(Tool):
|
5 |
+
name = "simple_tool1"
|
6 |
+
description = "A simple tool that returns a string."
|
7 |
+
inputs = {"msg":{"type":"string","description":"A string message."}}
|
8 |
+
output_type = "string"
|
9 |
+
|
10 |
+
def forward(self, msg: str)->str:
|
11 |
+
"""
|
12 |
+
A simple tool that returns a string.
|
13 |
+
Args:
|
14 |
+
msg: A string message.
|
15 |
+
Returns:
|
16 |
+
str: The same string message.
|
17 |
+
"""
|
18 |
+
print(msg)
|
19 |
+
return "Hello, tomorrow!"
|
tools/visit_webpage.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
-
import
|
4 |
import markdownify
|
5 |
import requests
|
6 |
-
import
|
7 |
|
8 |
class VisitWebpageTool(Tool):
|
9 |
name = "visit_webpage"
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
+
import smolagents
|
4 |
import markdownify
|
5 |
import requests
|
6 |
+
import re
|
7 |
|
8 |
class VisitWebpageTool(Tool):
|
9 |
name = "visit_webpage"
|