Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,26 +19,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
|
| 22 |
-
@tool
|
| 23 |
-
def get_random_excuse() -> str:
|
| 24 |
-
"""A tool that fetches a random excuse.
|
| 25 |
-
"""
|
| 26 |
-
try:
|
| 27 |
-
response = requests.get('https://excuser.herokuapp.com/')
|
| 28 |
-
if response.status_code == 200:
|
| 29 |
-
data = response.json()
|
| 30 |
-
if data and len(data) > 0 and 'excuse' in data[0]:
|
| 31 |
-
excuse = data[0]['excuse']
|
| 32 |
-
return f"Here's a random excuse: {excuse}"
|
| 33 |
-
else:
|
| 34 |
-
return "No excuse found. Please try again."
|
| 35 |
-
else:
|
| 36 |
-
return f"API returned an error: {response.status_code}"
|
| 37 |
-
except Exception as e:
|
| 38 |
-
return f"Error fetching random excuse: {str(e)}"
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
@tool
|
| 43 |
def get_random_cocktail() -> str:
|
| 44 |
"""A tool that fetches a random cocktail recipe.
|
|
@@ -95,7 +75,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 95 |
|
| 96 |
agent = CodeAgent(
|
| 97 |
model=model,
|
| 98 |
-
tools=[final_answer, image_generation_tool, get_current_time_in_timezone, get_random_cocktail
|
| 99 |
max_steps=6,
|
| 100 |
verbosity_level=1,
|
| 101 |
grammar=None,
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
@tool
|
| 23 |
def get_random_cocktail() -> str:
|
| 24 |
"""A tool that fetches a random cocktail recipe.
|
|
|
|
| 75 |
|
| 76 |
agent = CodeAgent(
|
| 77 |
model=model,
|
| 78 |
+
tools=[final_answer, image_generation_tool, get_current_time_in_timezone, get_random_cocktail], ## add your tools here (don't remove final answer)
|
| 79 |
max_steps=6,
|
| 80 |
verbosity_level=1,
|
| 81 |
grammar=None,
|