Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
@@ -130,28 +130,37 @@ def extract_youtube_details(url: str) -> str:
|
|
130 |
|
131 |
@tool
|
132 |
def decode_reversed_text(text: str) -> str:
|
133 |
-
"""
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
return value
|
147 |
-
return reversed_text
|
148 |
-
return text[::-1]
|
149 |
-
except Exception as e:
|
150 |
-
return f"Text decoding error: {str(e)}"
|
151 |
|
152 |
@tool
|
153 |
def solve_advanced_math(problem: str) -> str:
|
154 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
try:
|
156 |
problem_lower = problem.lower()
|
157 |
if "commutative" in problem_lower and "|" in problem:
|
@@ -209,7 +218,19 @@ def solve_advanced_math(problem: str) -> str:
|
|
209 |
|
210 |
@tool
|
211 |
def get_detailed_wikipedia(topic: str) -> str:
|
212 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
try:
|
214 |
time.sleep(1)
|
215 |
topic_clean = topic.replace(" ", "_").strip()
|
|
|
130 |
|
131 |
@tool
|
132 |
def decode_reversed_text(text: str) -> str:
|
133 |
+
"""
|
134 |
+
Decode reversed text, optionally identifying directional opposites.
|
135 |
+
|
136 |
+
If the input appears to be written backward and contains known patterns, this tool reverses it
|
137 |
+
and checks for direction-related words (e.g., left/right) to return their opposites.
|
138 |
+
|
139 |
+
Args:
|
140 |
+
text (str): A string of text that may be written in reverse.
|
141 |
+
|
142 |
+
Returns:
|
143 |
+
str: The decoded text, possibly with directional opposites, or the original reversed string.
|
144 |
+
"""
|
145 |
+
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
@tool
|
148 |
def solve_advanced_math(problem: str) -> str:
|
149 |
+
"""
|
150 |
+
Solve advanced math problems, including commutative table checks and numeric computations.
|
151 |
+
|
152 |
+
This tool can:
|
153 |
+
- Detect which elements break commutativity in a given operation table.
|
154 |
+
- Extract and analyze chess notation for move-related questions.
|
155 |
+
- Compute arithmetic operations such as sum, average, product, and percentages from a text-based problem.
|
156 |
+
|
157 |
+
Args:
|
158 |
+
problem (str): A string describing a math-related or logic puzzle, operation table, or numeric question.
|
159 |
+
|
160 |
+
Returns:
|
161 |
+
str: The solution or explanation based on the problem type and extracted data.
|
162 |
+
"""
|
163 |
+
|
164 |
try:
|
165 |
problem_lower = problem.lower()
|
166 |
if "commutative" in problem_lower and "|" in problem:
|
|
|
218 |
|
219 |
@tool
|
220 |
def get_detailed_wikipedia(topic: str) -> str:
|
221 |
+
"""
|
222 |
+
Get a detailed summary and metadata from Wikipedia for a given topic.
|
223 |
+
|
224 |
+
This tool first attempts to fetch a summary from Wikipedia's REST API.
|
225 |
+
If that fails, it uses the MediaWiki search API as a fallback to retrieve top matches.
|
226 |
+
|
227 |
+
Args:
|
228 |
+
topic (str): The topic to look up on Wikipedia.
|
229 |
+
|
230 |
+
Returns:
|
231 |
+
str: A formatted string with the topic title, summary extract, and page URL or search results.
|
232 |
+
"""
|
233 |
+
|
234 |
try:
|
235 |
time.sleep(1)
|
236 |
topic_clean = topic.replace(" ", "_").strip()
|