Spaces:
No application file
No application file
Update tool.py
Browse files
tool.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from smolagents import Tool
|
| 2 |
|
| 3 |
|
|
|
|
| 1 |
+
from smolagents import tool
|
| 2 |
+
|
| 3 |
+
@tool
|
| 4 |
+
def fibonacci_element(element:str)->str:
|
| 5 |
+
"""
|
| 6 |
+
Computes FibonacciSequenceElement for give sequence number
|
| 7 |
+
Args:
|
| 8 |
+
element: sequence number
|
| 9 |
+
Returns:
|
| 10 |
+
fibonacci element value
|
| 11 |
+
"""
|
| 12 |
+
sqrt5 = np.sqrt(5)
|
| 13 |
+
element = int(element)
|
| 14 |
+
return str(int(np.round(1/sqrt5 * (((1+sqrt5)/2)**element-((1-sqrt5)/2)**element))))
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
from smolagents import Tool
|
| 19 |
|
| 20 |
|