File size: 515 Bytes
08a5992
 
 
 
 
 
 
52bccd1
08a5992
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from typing import Any
from smolagents.tools import Tool

class GoBackTool(Tool):
    name = "go_back"
    description = "Goes back to the previous page."
    inputs = {}
    output_type = "null"

    def __init__(self, driver: Any = None, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.driver = driver
        self.is_initialized = False

    def forward(self) -> None:
        if not self.driver:
            raise ValueError("WebDriver instance is required.")
        self.driver.back()