a
    bg                     @  sx   d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZmZ G dd de	ZG d	d
 d
eZdS )    )annotations)OptionalType)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)	BaseModel)BaseBrowserTool)aget_current_pageget_current_pagec                   @  s   e Zd ZdZdS )CurrentWebPageToolInputz.Explicit no-args input for CurrentWebPageTool.N)__name__
__module____qualname____doc__ r   r   /var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langchain_community/tools/playwright/current_page.pyr      s   r   c                   @  sZ   e Zd ZU dZdZded< dZded< eZded< dd
ddddZ	ddddddZ
d	S )CurrentWebPageToolz0Tool for getting the URL of the current webpage.Zcurrent_webpagestrnamez#Returns the URL of the current pagedescriptionzType[BaseModel]args_schemaNz#Optional[CallbackManagerForToolRun])run_managerreturnc                 C  s.   | j du rtd| j t| j }t|jS )Use the tool.Nz$Synchronous browser not provided to )Zsync_browser
ValueErrorr   r
   r   urlselfr   pager   r   r   _run   s    

zCurrentWebPageTool._runz(Optional[AsyncCallbackManagerForToolRun]c                   s4   | j du rtd| j t| j I dH }t|jS )r   Nz%Asynchronous browser not provided to )Zasync_browserr   r   r	   r   r   r   r   r   r   _arun'   s    
zCurrentWebPageTool._arun)N)N)r   r   r   r   r   __annotations__r   r   r   r   r    r   r   r   r   r      s   
  r   N)
__future__r   typingr   r   Zlangchain_core.callbacksr   r   Zpydanticr   Z)langchain_community.tools.playwright.baser   Z*langchain_community.tools.playwright.utilsr	   r
   r   r   r   r   r   r   <module>   s   