langchain.tools.playwright.click.ClickTool¶
- class langchain.tools.playwright.click.ClickTool(*, name: str = 'click_element', description: str = 'Click on an element with the given CSS selector', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'langchain.tools.playwright.click.ClickToolInput'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, tags: ~typing.Optional[~typing.List[str]] = None, metadata: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, sync_browser: Optional['SyncBrowser'] = None, async_browser: Optional['AsyncBrowser'] = None, visible_only: bool = True, playwright_strict: bool = False, playwright_timeout: float = 1000)[source]¶
Bases:
BaseBrowserToolTool for clicking on an element with the given CSS selector.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.click.ClickToolInput'>¶
Pydantic model class to validate and parse the tool’s input arguments.
- param async_browser: Optional['AsyncBrowser'] = None¶
- param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
- param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
- param description: str = 'Click on an element with the given CSS selector'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
- param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
- param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with the tool. Defaults to None This metadata will be associated with each call to this tool, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a tool with its use case.
- param name: str = 'click_element'¶
The unique name of the tool that clearly communicates its purpose.
- param playwright_strict: bool = False¶
Whether to employ Playwright’s strict mode when clicking on elements.
- param playwright_timeout: float = 1000¶
Timeout (in ms) for Playwright to wait for element to be ready.
- param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
- param sync_browser: Optional['SyncBrowser'] = None¶
- param tags: Optional[List[str]] = None¶
Optional list of tags associated with the tool. Defaults to None These tags will be associated with each call to this tool, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a tool with its use case.
- param verbose: bool = False¶
Whether to log the tool’s progress.
- param visible_only: bool = True¶
Whether to consider only visible elements.
- __call__(tool_input: str, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) str¶
Make tool callable.
- async ainvoke(input: Union[str, Dict], config: Optional[RunnableConfig] = None, **kwargs: Any) Any¶
- async arun(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any¶
Run the tool asynchronously.
- classmethod from_browser(sync_browser: Optional[SyncBrowser] = None, async_browser: Optional[AsyncBrowser] = None) BaseBrowserTool¶
Instantiate the tool.
- invoke(input: Union[str, Dict], config: Optional[RunnableConfig] = None, **kwargs: Any) Any¶
- validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
- run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any¶
Run the tool.
- validator validate_browser_provided » all fields¶
Check that the arguments are valid.
- property args: dict¶
- property is_single_input: bool¶
Whether the tool only accepts a single input.