o
    iL                     @  s   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 ddl
mZmZ ddlmZ d	d
lmZ d	dlmZ eG dd dee ZdS )    )annotations)Callable)	dataclass)Any)ApprovalRequired   )
AgentDepsT
RunContext)ToolDefinition   )ToolsetTool)WrapperToolsetc                      s4   e Zd ZU dZdd Zded< d fddZ  ZS )ApprovalRequiredToolsetzA toolset that requires (some) calls to tools it contains to be approved.

    See [toolset docs](../toolsets.md#requiring-tool-approval) for more information.
    c                 C  s   dS )NT )ctxtool_def	tool_argsr   r   l/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/toolsets/approval_required.py<lambda>   s    z ApprovalRequiredToolset.<lambda>zHCallable[[RunContext[AgentDepsT], ToolDefinition, dict[str, Any]], bool]approval_required_funcnamestrr   dict[str, Any]r   RunContext[AgentDepsT]toolToolsetTool[AgentDepsT]returnr   c                   s4   |j s| ||j|rtt ||||I d H S )N)tool_call_approvedr   r   r   super	call_tool)selfr   r   r   r   	__class__r   r   r      s   z!ApprovalRequiredToolset.call_tool)
r   r   r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__r   __annotations__r   __classcell__r   r   r!   r   r      s
   
 
r   N)
__future__r   collections.abcr   dataclassesr   typingr   pydantic_ai.exceptionsr   _run_contextr   r	   toolsr
   abstractr   wrapperr   r   r   r   r   r   <module>   s    