Final_Assignment_Template / tools /page_navigation_tools.py
STARX33's picture
Update tools/page_navigation_tools.py
eb675e9 verified
Raw History Blame Contribute Delete
801 Bytes
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()