Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
@@ -18,6 +19,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -56,7 +67,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 56 |
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from random import random
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
|
|
|
| 19 |
"""
|
| 20 |
return "What magic will you build ?"
|
| 21 |
|
| 22 |
+
|
| 23 |
+
@tool
|
| 24 |
+
def get_random_number(arg1: int)-> int: #it's import to specify the return type
|
| 25 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 26 |
+
"""A tool that return a random integer number between 0 and arg1
|
| 27 |
+
Args:
|
| 28 |
+
arg1: the maximum random number
|
| 29 |
+
"""
|
| 30 |
+
return int(random.random()*100)
|
| 31 |
+
|
| 32 |
@tool
|
| 33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 34 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 67 |
|
| 68 |
agent = CodeAgent(
|
| 69 |
model=model,
|
| 70 |
+
tools=[final_answer, get_current_time_in_timezone, get_random_number], ## add your tools here (don't remove final answer)
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|