yannis2025 commited on
Commit
7be3a41
·
verified ·
1 Parent(s): f09a19c

Create tools.py

Browse files
Files changed (1) hide show
  1. tools.py +15 -0
tools.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import wikipedia
2
+
3
+ class WikipediaTool:
4
+ def run(self, query: str) -> str:
5
+ try:
6
+ return wikipedia.summary(query, sentences=2)
7
+ except Exception as e:
8
+ return f"Error: {e}"
9
+
10
+ class MathTool:
11
+ def run(self, question: str) -> str:
12
+ try:
13
+ return str(eval(question))
14
+ except Exception as e:
15
+ return f"Math error: {e}"