Thomas Hatting commited on
Commit
d983bab
·
verified ·
1 Parent(s): c7355a6

Update app.py

Browse files

Update CodeAgent

Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -9,24 +9,21 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def restaurant_service_tool(query: str) -> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
  """
15
- This tool returns the highest-rated restaurant in Copenhagen.
16
-
17
  Args:
18
- query: A search term for finding restaurant.
19
  """
20
- # Example list of catering services and their ratings
21
- services = {
22
- "Geranium": 4.7,
23
- "Alchemist": 4.9,
24
- "Maple Casual Dining": 4.8,
25
- }
26
- # Find the highest rated catering service (simulating search query filtering)
27
- best_service = max(services, key=services.get)
28
-
29
- return best_service
30
 
31
  @tool
32
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -66,7 +63,7 @@ with open("prompts.yaml", 'r') as stream:
66
 
67
  agent = CodeAgent(
68
  model=model,
69
- tools=[restaurant_service_tool, DuckDuckGoSearchTool(), final_answer], ## add your tools here (don't remove final answer)
70
  max_steps=6,
71
  verbosity_level=1,
72
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def suggest_menu(query: str) -> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
  """
15
+ Suggests a menu based on the occasion.
 
16
  Args:
17
+ occasion: The type of occasion for the party.
18
  """
19
+ if occasion == "casual":
20
+ return "Pizza, snacks, and drinks."
21
+ elif occasion == "formal":
22
+ return "3-course dinner with wine and dessert."
23
+ elif occasion == "superhero":
24
+ return "Buffet with high-energy and healthy food."
25
+ else:
26
+ return "Custom menu for the butler."
 
 
27
 
28
  @tool
29
  def get_current_time_in_timezone(timezone: str) -> str:
 
63
 
64
  agent = CodeAgent(
65
  model=model,
66
+ tools=[DuckDuckGoSearchTool(), suggest_menu, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
67
  max_steps=6,
68
  verbosity_level=1,
69
  grammar=None,