Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,17 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
-
"""A tool that
|
| 16 |
Args:
|
| 17 |
-
|
| 18 |
-
arg2: the second argument
|
| 19 |
"""
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
@tool
|
| 23 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -58,7 +61,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
-
tools=[final_answer, image_generation_tool, get_current_time_in_timezone, visit_page, web_search], ## add your tools here (don't remove final answer)
|
| 62 |
max_steps=6,
|
| 63 |
verbosity_level=1,
|
| 64 |
grammar=None,
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def fahrenheit_to_celsius(temperature:str)-> str: #it's import to specify the return type
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
+
"""A tool that converts weather from Degrees Fahrenheit to Degrees Celsius.
|
| 16 |
Args:
|
| 17 |
+
temperature: The current temperature.
|
|
|
|
| 18 |
"""
|
| 19 |
+
is_fahrenheit = temperature.split("°F").[0]
|
| 20 |
+
if is_fahrenheit == "°F":
|
| 21 |
+
temperature = (temperature - 32) * 5/9
|
| 22 |
+
|
| 23 |
+
return temperature
|
| 24 |
|
| 25 |
@tool
|
| 26 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 61 |
|
| 62 |
agent = CodeAgent(
|
| 63 |
model=model,
|
| 64 |
+
tools=[final_answer, image_generation_tool, get_current_time_in_timezone, visit_page, web_search, fahrenheit_to_celsius], ## add your tools here (don't remove final answer)
|
| 65 |
max_steps=6,
|
| 66 |
verbosity_level=1,
|
| 67 |
grammar=None,
|