Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,21 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
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 my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -55,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
from forex_python.converter import CurrencyRates
|
| 11 |
+
|
| 12 |
+
@tool
|
| 13 |
+
def convert_currency(curr1:str, curr2:str, amount:int) -> str:
|
| 14 |
+
""" A tool that converts one currency into another.
|
| 15 |
+
Args:
|
| 16 |
+
curr1: Currency 1, the initial currency that needs to be coinverted into another one (e.g. EUR, usd).
|
| 17 |
+
curr2: Currency 2, the currency the first one needs to be converted into (e.g. RUB, eur, Russian rubles).
|
| 18 |
+
amount: The ammount of currency 1 that needs to be converted.
|
| 19 |
+
"""
|
| 20 |
+
try:
|
| 21 |
+
cr = Currencyrates()
|
| 22 |
+
converted_amount = cr.convert(curr1, curr2, amount)
|
| 23 |
+
return f"{amount} {curr1} is {converted_amount {curr2}"
|
| 24 |
+
|
| 25 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 26 |
@tool
|
| 27 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 70 |
|
| 71 |
agent = CodeAgent(
|
| 72 |
model=model,
|
| 73 |
+
tools=[final_answer, get_current_time_in_timezone, convert_currency], ## add your tools here (don't remove final answer)
|
| 74 |
max_steps=6,
|
| 75 |
verbosity_level=1,
|
| 76 |
grammar=None,
|