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