Spaces:
Sleeping
Sleeping
Added the barbecue_sauce_tool
Browse files
app.py
CHANGED
|
@@ -9,14 +9,37 @@ 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
|
| 13 |
-
|
| 14 |
-
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -51,7 +74,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 51 |
|
| 52 |
agent = CodeAgent(
|
| 53 |
model=model,
|
| 54 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 55 |
max_steps=6,
|
| 56 |
verbosity_level=1,
|
| 57 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def barbecue_sauce_tool(location:str, meat:int)-> str: #it's import to specify the return type
|
| 13 |
+
"""A tool that determines the type of barbecue sauce used in the specified location on the specified meat.
|
|
|
|
| 14 |
Args:
|
| 15 |
+
location: A string that is the name of a US city
|
| 16 |
+
meat: A string that specifies a type of meat
|
| 17 |
"""
|
| 18 |
+
|
| 19 |
+
sauces = {
|
| 20 |
+
"kansas city": {
|
| 21 |
+
"beef": "vinegar",
|
| 22 |
+
"chicken": "mustard"
|
| 23 |
+
"other": "hot"
|
| 24 |
+
},
|
| 25 |
+
"memphis": {
|
| 26 |
+
"beef": "ketchup-based",
|
| 27 |
+
"chicken": "tomato-based"
|
| 28 |
+
"other": "molasses-based"
|
| 29 |
+
},
|
| 30 |
+
"other": {
|
| 31 |
+
"beef": "vinegar",
|
| 32 |
+
"chicken": "tomato-based"
|
| 33 |
+
"other": "vinegar"
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
# Hack to always return an answer
|
| 38 |
+
city_key = location if location in sauces.keys() else "other"
|
| 39 |
+
meat_key = meat if meat in sauces[city_key].keys() else "other"
|
| 40 |
+
|
| 41 |
+
# Convert to a web search tool later...
|
| 42 |
+
return f"The sauce you would use would be {sauces[city_key][meat_key]}"
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 74 |
|
| 75 |
agent = CodeAgent(
|
| 76 |
model=model,
|
| 77 |
+
tools=[final_answer, barbecue_sauce_tool, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
|
| 78 |
max_steps=6,
|
| 79 |
verbosity_level=1,
|
| 80 |
grammar=None,
|