jamesbright commited on
Commit
8d7fbe1
·
verified ·
1 Parent(s): 4d0fe82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -35,6 +35,29 @@ def get_current_time_in_timezone(timezone: str) -> str:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  final_answer = FinalAnswerTool()
39
 
40
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
@@ -56,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool, DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
37
 
38
+ # Tool to suggest a menu based on the occasion
39
+ @tool
40
+ def suggest_menu(occasion: str) -> str:
41
+ """
42
+ Suggests a menu based on the occasion.
43
+ Args:
44
+ occasion (str): The type of occasion for the party. Allowed values are:
45
+ - "casual": Menu for casual party.
46
+ - "formal": Menu for formal party.
47
+ - "superhero": Menu for superhero party.
48
+ - "custom": Custom menu.
49
+ """
50
+ if occasion == "casual":
51
+ return "Pizza, snacks, and drinks."
52
+ elif occasion == "formal":
53
+ return "3-course dinner with wine and dessert."
54
+ elif occasion == "superhero":
55
+ return "Buffet with high-energy and healthy food."
56
+ else:
57
+ return "Custom menu for the butler."
58
+
59
+
60
+
61
  final_answer = FinalAnswerTool()
62
 
63
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
79
 
80
  agent = CodeAgent(
81
  model=model,
82
+ tools=[final_answer, get_current_time_in_timezone, image_generation_tool, suggest_menu, DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
83
  max_steps=6,
84
  verbosity_level=1,
85
  grammar=None,