Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,29 +8,9 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
-
from num2words import num2words
|
| 12 |
|
| 13 |
-
@tool
|
| 14 |
-
def number_to_words(number: int, lang: str = "en") -> str:
|
| 15 |
-
"""Converts a number to its word representation.
|
| 16 |
-
|
| 17 |
-
Args:
|
| 18 |
-
number (int): The number to convert.
|
| 19 |
-
lang (str): The language for conversion (default is "en" for English).
|
| 20 |
|
| 21 |
-
|
| 22 |
-
str: The number in words.
|
| 23 |
-
|
| 24 |
-
Example:
|
| 25 |
-
>>> number_to_words(123)
|
| 26 |
-
'one hundred twenty-three'
|
| 27 |
-
>>> number_to_words(456, lang="fr")
|
| 28 |
-
'quatre cent cinquante-six'
|
| 29 |
-
"""
|
| 30 |
-
try:
|
| 31 |
-
return num2words(number, lang=lang)
|
| 32 |
-
except NotImplementedError:
|
| 33 |
-
return f"Language '{lang}' not supported."
|
| 34 |
|
| 35 |
@tool
|
| 36 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -69,7 +49,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 69 |
|
| 70 |
agent = CodeAgent(
|
| 71 |
model=model,
|
| 72 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 73 |
max_steps=6,
|
| 74 |
verbosity_level=1,
|
| 75 |
grammar=None,
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
search_tool = DuckDuckGoSearchTool()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
@tool
|
| 16 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 49 |
|
| 50 |
agent = CodeAgent(
|
| 51 |
model=model,
|
| 52 |
+
tools=[final_answer,search_tool], ## add your tools here (don't remove final answer)
|
| 53 |
max_steps=6,
|
| 54 |
verbosity_level=1,
|
| 55 |
grammar=None,
|