feat: add language detection tool
Browse files
app.py
CHANGED
@@ -17,16 +17,6 @@ from tools.translation import TranslationTool
|
|
17 |
from Gradio_UI import GradioUI
|
18 |
|
19 |
|
20 |
-
@tool
|
21 |
-
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
22 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
23 |
-
"""A tool that does nothing yet
|
24 |
-
Args:
|
25 |
-
arg1: the first argument
|
26 |
-
arg2: the second argument
|
27 |
-
"""
|
28 |
-
return "What magic will you build ?"
|
29 |
-
|
30 |
@tool
|
31 |
def get_current_time_in_timezone(timezone: str) -> str:
|
32 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -55,7 +45,8 @@ def conversational_utterance(user_content:str)-> str:
|
|
55 |
|
56 |
|
57 |
final_answer = FinalAnswerTool()
|
58 |
-
|
|
|
59 |
visit_webpage = VisitWebpageTool()
|
60 |
translation_tool = TranslationTool()
|
61 |
|
@@ -70,7 +61,8 @@ custom_role_conversions=None,
|
|
70 |
)
|
71 |
|
72 |
# Import tool from Hub
|
73 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
74 |
|
75 |
with open("prompts.yaml", 'r') as stream:
|
76 |
prompt_templates = yaml.safe_load(stream)
|
@@ -79,11 +71,13 @@ agent = CodeAgent(
|
|
79 |
model=model,
|
80 |
tools=[
|
81 |
final_answer,
|
82 |
-
|
|
|
83 |
visit_webpage,
|
84 |
get_current_time_in_timezone,
|
85 |
conversational_utterance,
|
86 |
image_generation_tool,
|
|
|
87 |
translation_tool
|
88 |
],
|
89 |
max_steps=6,
|
|
|
17 |
from Gradio_UI import GradioUI
|
18 |
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
@tool
|
21 |
def get_current_time_in_timezone(timezone: str) -> str:
|
22 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
45 |
|
46 |
|
47 |
final_answer = FinalAnswerTool()
|
48 |
+
prefered_web_search = GoogleSearchTool()
|
49 |
+
alternative_web_search = DuckDuckGoSearchTool()
|
50 |
visit_webpage = VisitWebpageTool()
|
51 |
translation_tool = TranslationTool()
|
52 |
|
|
|
61 |
)
|
62 |
|
63 |
# Import tool from Hub
|
64 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
65 |
+
language_detection_tool = load_tool("team-language-detector/LanguageDetector", trust_remote_code=True)
|
66 |
|
67 |
with open("prompts.yaml", 'r') as stream:
|
68 |
prompt_templates = yaml.safe_load(stream)
|
|
|
71 |
model=model,
|
72 |
tools=[
|
73 |
final_answer,
|
74 |
+
prefered_web_search,
|
75 |
+
alternative_web_search,
|
76 |
visit_webpage,
|
77 |
get_current_time_in_timezone,
|
78 |
conversational_utterance,
|
79 |
image_generation_tool,
|
80 |
+
language_detection_tool,
|
81 |
translation_tool
|
82 |
],
|
83 |
max_steps=6,
|