Maikelborys commited on
Commit
13a8e56
·
verified ·
1 Parent(s): 9ee2603

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -1
app.py CHANGED
@@ -36,6 +36,36 @@ def get_current_time_in_timezone(timezone: str) -> str:
36
  except Exception as e:
37
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  final_answer = FinalAnswerTool()
41
  generate_recipe = RecipeGeneratorTool()
@@ -60,7 +90,7 @@ with open("prompts.yaml", 'r') as stream:
60
 
61
  agent = CodeAgent(
62
  model=model,
63
- tools=[final_answer, generate_recipe], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
 
36
  except Exception as e:
37
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
38
 
39
+ @tool
40
+ def recommend_diet_brunch(diet_type: str) -> str:
41
+ """A tool that recommends a brunch based on the type of diet.
42
+
43
+ Args:
44
+ diet_type: A description of the type of diet (e.g., vegan, keto, etc.).
45
+
46
+ Returns:
47
+ A string with a brunch recommendation.
48
+ """
49
+ # Normalize input to lowercase for matching.
50
+ diet_type_lower = diet_type.lower()
51
+
52
+ # Map diet types to brunch suggestions.
53
+ diet_to_brunch = {
54
+ "vegan": "Tofu scramble with avocado toast, fruit salad, and a green smoothie.",
55
+ "keto": "Avocado and egg breakfast bowl with bacon and spinach.",
56
+ "vegetarian": "Vegetable frittata with a side of roasted potatoes and fresh fruit.",
57
+ "paleo": "Grilled chicken with roasted sweet potatoes, sautéed spinach, and avocado.",
58
+ "gluten-free": "Gluten-free pancakes with berries and almond butter.",
59
+ "low-carb": "Egg muffins with spinach, cheese, and bacon, served with a side of avocado.",
60
+ "intermittent fasting": "A light salad with lean protein like grilled chicken, nuts, and avocado.",
61
+ "mediterranean": "Greek yogurt with honey, walnuts, and a side of olives and cucumber."
62
+ }
63
+
64
+ # Default to a vegetarian brunch if diet type is unknown.
65
+ recommended_brunch = diet_to_brunch.get(diet_type_lower, "Vegetable frittata with a side of roasted potatoes and fresh fruit.")
66
+
67
+ return f"Based on your diet type ('{diet_type}'), I recommend this brunch: {recommended_brunch}"
68
+
69
 
70
  final_answer = FinalAnswerTool()
71
  generate_recipe = RecipeGeneratorTool()
 
90
 
91
  agent = CodeAgent(
92
  model=model,
93
+ tools=[final_answer, recommend_diet_brunch], ## add your tools here (don't remove final answer)
94
  max_steps=6,
95
  verbosity_level=1,
96
  grammar=None,