o
    hJ                     @   s   d dl mZmZmZ d dlmZmZ d dlmZ ddl	m
Z
mZ defddZdefd	d
ZdefddZeG dd de
e ZdS )    )	dataclassfieldfields)AnyOptional)ResponseFunctionToolCall   )RunContextWrapperTContextreturnc                   C      t d)Nz*tool_call_id must be passed to ToolContext
ValueError r   r   T/var/www/html/openai_agents/venv/lib/python3.10/site-packages/agents/tool_context.py_assert_must_pass_tool_call_id	      r   c                   C   r   )Nz'tool_name must be passed to ToolContextr   r   r   r   r   _assert_must_pass_tool_name   r   r   c                   C   r   )Nz,tool_arguments must be passed to ToolContextr   r   r   r   r    _assert_must_pass_tool_arguments   r   r   c                
   @   sx   e Zd ZU dZeedZeed< 	 ee	dZ
eed< 	 eedZeed< 	 e	ddee dedee d	d fd
dZdS )ToolContextzThe context of a tool call.)default_factory	tool_nametool_call_idtool_argumentsNcontext	tool_callr   c                    sT    fddt tD }|dur|jnt }|dur|jnt }| d|||d|S )z@
        Create a ToolContext from a RunContextWrapper.
        c                    s"   i | ]}|j r|jt |jqS r   )initnamegetattr).0fr   r   r   
<dictcomp>-   s
    z2ToolContext.from_agent_context.<locals>.<dictcomp>N)r   r   r   r   )r   r	   r   r   	argumentsr   )clsr   r   r   base_valuesr   	tool_argsr   r!   r   from_agent_context"   s   
zToolContext.from_agent_context)N)__name__
__module____qualname____doc__r   r   r   str__annotations__r   r   r   r   classmethodr	   r
   r   r   r'   r   r   r   r   r      s&   
 r   N)dataclassesr   r   r   typingr   r   openai.types.responsesr   run_contextr	   r
   r,   r   r   r   r   r   r   r   r   <module>   s    