
    .UiJ                         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ZdefdZdefd	Ze G d
 de
e                Zy)    )	dataclassfieldfields)AnyOptional)ResponseFunctionToolCall   )RunContextWrapperTContextreturnc                      t        d      )Nz*tool_call_id must be passed to ToolContext
ValueError     o/home/jay/workspace/tools/ai-image-gen/jaaz-app/server/venv/lib/python3.12/site-packages/agents/tool_context.py_assert_must_pass_tool_call_idr   	   s    
A
BBr   c                      t        d      )Nz'tool_name must be passed to ToolContextr   r   r   r   _assert_must_pass_tool_namer      s    
>
??r   c                      t        d      )Nz,tool_arguments must be passed to ToolContextr   r   r   r    _assert_must_pass_tool_argumentsr      s    
C
DDr   c            
           e Zd ZU dZ ee      Zeed<   	  ee	      Z
eed<   	  ee      Zeed<   	 e	 ddee   dedee   d	d fd
       Zy)ToolContextzThe context of a tool call.)default_factory	tool_nametool_call_idtool_argumentsNcontext	tool_callr   c                    t        t              D ci c]0  }|j                  s|j                  t	        ||j                        2 }}||j                  n	t               }||j                  n	t               } | d|||d|S c c}w )z@
        Create a ToolContext from a RunContextWrapper.
        )r   r   r   r   )r   r
   initnamegetattrr   	argumentsr   )clsr   r   r   fbase_valuesr   	tool_argss           r   from_agent_contextzToolContext.from_agent_context"   s     7==N6O'
12STSYSYAFFGGQVV,,'
 '
 '0&;INNA\A^	#,#8I>^>` 	  
l9
Xc
 	
'
s
   B#B)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    %+FGIsG-.LML#M"0PQNCQ4
 9=	
"8,
 
 45	

 

 
r   r   N)dataclassesr   r   r   typingr   r   openai.types.responsesr   run_contextr
   r   r.   r   r   r   r   r   r   r   <module>r5      s_    0 0   ; 4C C@S @E# E !
#H- !
 !
r   