Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,26 @@ import requests
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
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
|
13 |
-
|
14 |
-
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
-
|
17 |
-
|
|
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
import wikipedia
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
|
|
11 |
@tool
|
12 |
+
def wikipedia_search(question: str) -> str:
|
13 |
+
"""Search Wikipedia for factual information about a topic, person, place or concept.
|
|
|
14 |
Args:
|
15 |
+
Question about a topic, person, place, or concept: str
|
16 |
+
Output:
|
17 |
+
Answer to the question based on content in wikipedia: str
|
18 |
"""
|
19 |
+
try:
|
20 |
+
return wikipedia.summary(question)
|
21 |
+
except wikipedia.exceptions.PageError:
|
22 |
+
return "Wikipedia page not found for the question."
|
23 |
+
except wikipedia.exceptions.DisambiguationError as e:
|
24 |
+
return "Wikipedia found multiple possible pages, please be more specific: " + str(e.options)
|
25 |
+
except Exception as e:
|
26 |
+
return f"An error occurred while searching Wikipedia: {e}"
|
27 |
|
28 |
@tool
|
29 |
def get_current_time_in_timezone(timezone: str) -> str:
|