techarmour commited on
Commit
b35d982
·
verified ·
1 Parent(s): f6dbe0f

Upload agent

Browse files
agent.json CHANGED
@@ -1,13 +1,17 @@
1
  {
2
  "tools": [
 
 
3
  "suggest_menu",
 
 
4
  "final_answer"
5
  ],
6
  "model": {
7
  "class": "HfApiModel",
8
  "data": {
9
- "last_input_token_count": 3050,
10
- "last_output_token_count": 46,
11
  "model_id": "Qwen/Qwen2.5-Coder-32B-Instruct",
12
  "provider": null
13
  }
@@ -32,27 +36,30 @@
32
  "post_messages": "Based on the above, please provide an answer to the following user task:\n{{task}}"
33
  }
34
  },
35
- "max_steps": 20,
36
- "verbosity_level": 1,
37
  "grammar": null,
38
  "planning_interval": null,
39
  "name": null,
40
  "description": null,
41
  "requirements": [
42
- "smolagents"
 
 
 
43
  ],
44
  "authorized_imports": [
45
- "random",
46
- "itertools",
47
- "statistics",
48
- "collections",
49
- "queue",
50
- "time",
51
  "unicodedata",
52
- "datetime",
53
  "stat",
 
 
 
54
  "math",
55
- "re"
 
 
 
56
  ],
57
  "executor_type": "local",
58
  "executor_kwargs": {},
 
1
  {
2
  "tools": [
3
+ "web_search",
4
+ "visit_webpage",
5
  "suggest_menu",
6
+ "catering_service_tool",
7
+ "superhero_party_theme_generator",
8
  "final_answer"
9
  ],
10
  "model": {
11
  "class": "HfApiModel",
12
  "data": {
13
+ "last_input_token_count": 8557,
14
+ "last_output_token_count": 471,
15
  "model_id": "Qwen/Qwen2.5-Coder-32B-Instruct",
16
  "provider": null
17
  }
 
36
  "post_messages": "Based on the above, please provide an answer to the following user task:\n{{task}}"
37
  }
38
  },
39
+ "max_steps": 10,
40
+ "verbosity_level": 2,
41
  "grammar": null,
42
  "planning_interval": null,
43
  "name": null,
44
  "description": null,
45
  "requirements": [
46
+ "duckduckgo_search",
47
+ "requests",
48
+ "smolagents",
49
+ "markdownify"
50
  ],
51
  "authorized_imports": [
 
 
 
 
 
 
52
  "unicodedata",
53
+ "collections",
54
  "stat",
55
+ "statistics",
56
+ "re",
57
+ "datetime",
58
  "math",
59
+ "queue",
60
+ "random",
61
+ "itertools",
62
+ "time"
63
  ],
64
  "executor_type": "local",
65
  "executor_kwargs": {},
app.py CHANGED
@@ -5,7 +5,11 @@ from smolagents import GradioUI, CodeAgent, HfApiModel
5
  # Get current directory path
6
  CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
7
 
 
 
8
  from tools.suggest_menu import SimpleTool as SuggestMenu
 
 
9
  from tools.final_answer import FinalAnswerTool as FinalAnswer
10
 
11
 
@@ -15,7 +19,11 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
15
  provider=None,
16
  )
17
 
 
 
18
  suggest_menu = SuggestMenu()
 
 
19
  final_answer = FinalAnswer()
20
 
21
 
@@ -24,10 +32,10 @@ with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
24
 
25
  agent = CodeAgent(
26
  model=model,
27
- tools=[suggest_menu],
28
  managed_agents=[],
29
- max_steps=20,
30
- verbosity_level=1,
31
  grammar=None,
32
  planning_interval=None,
33
  name=None,
 
5
  # Get current directory path
6
  CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
7
 
8
+ from tools.web_search import DuckDuckGoSearchTool as WebSearch
9
+ from tools.visit_webpage import VisitWebpageTool as VisitWebpage
10
  from tools.suggest_menu import SimpleTool as SuggestMenu
11
+ from tools.catering_service_tool import SimpleTool as CateringServiceTool
12
+ from tools.superhero_party_theme_generator import SuperheroPartyThemeTool as SuperheroPartyThemeGenerator
13
  from tools.final_answer import FinalAnswerTool as FinalAnswer
14
 
15
 
 
19
  provider=None,
20
  )
21
 
22
+ web_search = WebSearch()
23
+ visit_webpage = VisitWebpage()
24
  suggest_menu = SuggestMenu()
25
+ catering_service_tool = CateringServiceTool()
26
+ superhero_party_theme_generator = SuperheroPartyThemeGenerator()
27
  final_answer = FinalAnswer()
28
 
29
 
 
32
 
33
  agent = CodeAgent(
34
  model=model,
35
+ tools=[web_search, visit_webpage, suggest_menu, catering_service_tool, superhero_party_theme_generator],
36
  managed_agents=[],
37
+ max_steps=10,
38
+ verbosity_level=2,
39
  grammar=None,
40
  planning_interval=None,
41
  name=None,
requirements.txt CHANGED
@@ -1 +1,4 @@
 
 
1
  smolagents
 
 
1
+ duckduckgo_search
2
+ requests
3
  smolagents
4
+ markdownify
tools/superhero_party_theme_generator.py CHANGED
@@ -6,17 +6,17 @@ class SuperheroPartyThemeTool(Tool):
6
  description = """
7
  This tool suggests creative superhero-themed party ideas based on a category.
8
  It returns a unique party theme idea."""
9
- inputs = {'category': {'type': 'string', 'description': "The type of superhero party (e.g., 'classic heroes', 'villain masquerade', 'futuristic gotham')."}}
10
  output_type = "string"
11
 
12
  def forward(self, category: str):
13
  themes = {
14
  "classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
15
  "villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
16
- "futuristic gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
17
  }
18
 
19
- return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic gotham'.")
20
 
21
  def __init__(self, *args, **kwargs):
22
  self.is_initialized = False
 
6
  description = """
7
  This tool suggests creative superhero-themed party ideas based on a category.
8
  It returns a unique party theme idea."""
9
+ inputs = {'category': {'type': 'string', 'description': "The type of superhero party (e.g., 'classic heroes', 'villain masquerade', 'futuristic Gotham')."}}
10
  output_type = "string"
11
 
12
  def forward(self, category: str):
13
  themes = {
14
  "classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
15
  "villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
16
+ "futuristic Gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
17
  }
18
 
19
+ return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.")
20
 
21
  def __init__(self, *args, **kwargs):
22
  self.is_initialized = False
tools/visit_webpage.py CHANGED
@@ -1,8 +1,8 @@
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
3
- import re
4
  import smolagents
5
  import requests
 
6
  import markdownify
7
 
8
  class VisitWebpageTool(Tool):
 
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
 
3
  import smolagents
4
  import requests
5
+ import re
6
  import markdownify
7
 
8
  class VisitWebpageTool(Tool):