Spaces:
Sleeping
Sleeping
added the search for pizza from discord
Browse files
app.py
CHANGED
@@ -14,6 +14,8 @@ def get_kcal_for_crisps_flavour(flavour:str)-> str: #it's import to specify the
|
|
14 |
"""A tool that gives back the kcal for a particular flavour of crisps
|
15 |
Args:
|
16 |
flavour: A string representing the flavour of the crisps (e.g., "Paprika")
|
|
|
|
|
17 |
"""
|
18 |
try:
|
19 |
match flavour:
|
@@ -27,7 +29,20 @@ def get_kcal_for_crisps_flavour(flavour:str)-> str: #it's import to specify the
|
|
27 |
return f"Error fetching time kcal for flavour '{flavour}': {str(e)}"
|
28 |
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
@tool
|
33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -66,7 +81,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
66 |
|
67 |
agent = CodeAgent(
|
68 |
model=model,
|
69 |
-
tools=[final_answer, get_current_time_in_timezone, image_generation_tool, get_kcal_for_crisps_flavour], ## add your tools here (don't remove final answer)
|
70 |
max_steps=6,
|
71 |
verbosity_level=1,
|
72 |
grammar=None,
|
|
|
14 |
"""A tool that gives back the kcal for a particular flavour of crisps
|
15 |
Args:
|
16 |
flavour: A string representing the flavour of the crisps (e.g., "Paprika")
|
17 |
+
Returns:
|
18 |
+
str: a string with the kcal count for that flavour.
|
19 |
"""
|
20 |
try:
|
21 |
match flavour:
|
|
|
29 |
return f"Error fetching time kcal for flavour '{flavour}': {str(e)}"
|
30 |
|
31 |
|
32 |
+
@tool
|
33 |
+
def search_pizza(region: str) -> str:
|
34 |
+
"""Search tipical pizza for italian region usando DuckDuckGo.
|
35 |
+
Args:
|
36 |
+
region: Name of region
|
37 |
+
|
38 |
+
Returns:
|
39 |
+
str: A list of typical pizzas found for that region.
|
40 |
+
"""
|
41 |
+
if not region:
|
42 |
+
return "Please, insert a valid region!"
|
43 |
+
|
44 |
+
results = PizzaSearchTool.search(region)
|
45 |
+
return "\n".join(results)
|
46 |
|
47 |
@tool
|
48 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
81 |
|
82 |
agent = CodeAgent(
|
83 |
model=model,
|
84 |
+
tools=[final_answer, get_current_time_in_timezone, image_generation_tool, get_kcal_for_crisps_flavour, search_pizza], ## add your tools here (don't remove final answer)
|
85 |
max_steps=6,
|
86 |
verbosity_level=1,
|
87 |
grammar=None,
|