Firoj112 commited on
Commit
08a5992
·
verified ·
1 Parent(s): 75196fc

Update tools/go_back.py

Browse files
Files changed (1) hide show
  1. tools/go_back.py +18 -16
tools/go_back.py CHANGED
@@ -1,16 +1,18 @@
1
- from typing import Any
2
- from smolagents.tools import Tool
3
-
4
- class GoBackTool(Tool):
5
- name = "go_back"
6
- description = "Goes back to the previous page."
7
- inputs = {}
8
- output_type = "None"
9
-
10
- def forward(self, driver: Any = None) -> None:
11
- if not driver:
12
- raise ValueError("WebDriver instance is required.")
13
- driver.back()
14
-
15
- def __init__(self, *args, **kwargs):
16
- self.is_initialized = False
 
 
 
1
+ from typing import Any
2
+ from smolagents.tools import Tool
3
+
4
+ class GoBackTool(Tool):
5
+ name = "go_back"
6
+ description = "Goes back to the previous page."
7
+ inputs = {}
8
+ output_type = "null"
9
+
10
+ def __init__(self, driver: Any = None, *args, **kwargs):
11
+ super().__init__(*args, **kwargs)
12
+ self.driver = driver
13
+ self.is_initialized = False
14
+
15
+ def forward(self) -> None:
16
+ if not self.driver:
17
+ raise ValueError("WebDriver instance is required.")
18
+ self.driver.back()