STARX33 commited on
Commit
eb675e9
·
verified ·
1 Parent(s): 8b0695f

Update tools/page_navigation_tools.py

Browse files
Files changed (1) hide show
  1. tools/page_navigation_tools.py +33 -0
tools/page_navigation_tools.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+ from tools.simple_text_browser import _BROWSER
3
+
4
+ @tool
5
+ def find_on_page_ctrl_f(search_string: str) -> str:
6
+ """
7
+ Find the first occurrence of a string in the current page viewport.
8
+
9
+ Args:
10
+ search_string: The string to search for on the page.
11
+ """
12
+ return _BROWSER.find_on_page(search_string)
13
+
14
+ @tool
15
+ def find_next() -> str:
16
+ """
17
+ Find the next occurrence of the previous search string (after find_on_page_ctrl_f).
18
+ """
19
+ return _BROWSER.find_next()
20
+
21
+ @tool
22
+ def page_down() -> str:
23
+ """
24
+ Scroll the viewport DOWN one page-length in the current document.
25
+ """
26
+ return _BROWSER.page_down()
27
+
28
+ @tool
29
+ def page_up() -> str:
30
+ """
31
+ Scroll the viewport UP one page-length in the current document.
32
+ """
33
+ return _BROWSER.page_up()