Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,20 @@ 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 |
-
|
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 does nothing yet
|
16 |
Args:
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
@tool
|
24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -44,7 +47,7 @@ final_answer = FinalAnswerTool()
|
|
44 |
model = HfApiModel(
|
45 |
max_tokens=2096,
|
46 |
temperature=0.5,
|
47 |
-
model_id='
|
48 |
custom_role_conversions=None,
|
49 |
)
|
50 |
|
|
|
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 |
@tool
|
13 |
+
def web_search_tool(search_text: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 does nothing yet
|
16 |
Args:
|
17 |
+
search_text: a string representing a search query from user
|
18 |
+
"""
|
19 |
+
try:
|
20 |
+
# Create a search object
|
21 |
+
query = DuckDuckGoSearchTool(search_text)
|
22 |
+
return f"The result for your search query is {query}."
|
23 |
+
except Exception as e:
|
24 |
+
return f"Error fetching the search query text."
|
25 |
|
26 |
@tool
|
27 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
47 |
model = HfApiModel(
|
48 |
max_tokens=2096,
|
49 |
temperature=0.5,
|
50 |
+
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
|
51 |
custom_role_conversions=None,
|
52 |
)
|
53 |
|