
    .Ui<                    Z   d dl mZ d dlmZ d dlmZmZ er(ddlmZ ddl	m
Z
mZ ddlmZmZmZ ddlmZ dd	lmZmZmZ dd
lmZ e G d d             Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z  G d de      Z!y)    )annotations)	dataclass)TYPE_CHECKINGAny   )Agent)InputGuardrailResultOutputGuardrailResult)ModelResponseRunItemTResponseInputItem)RunContextWrapper)ToolGuardrailFunctionOutputToolInputGuardrailToolOutputGuardrailpretty_print_run_error_detailsc                  `    e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   ded<   ded<   ddZy)RunErrorDetailsz:Data collected from an agent run when an exception occurs.zstr | list[TResponseInputItem]inputzlist[RunItem]	new_itemszlist[ModelResponse]raw_responsesz
Agent[Any]
last_agentzRunContextWrapper[Any]context_wrapperzlist[InputGuardrailResult]input_guardrail_resultszlist[OutputGuardrailResult]output_guardrail_resultsc                    t        |       S Nr   )selfs    m/home/jay/workspace/tools/ai-image-gen/jaaz-app/server/venv/lib/python3.12/site-packages/agents/exceptions.py__str__zRunErrorDetails.__str__    s    -d33    N)returnstr)__name__
__module____qualname____doc____annotations__r!    r"   r    r   r      s4    D))&&++77994r"   r   c                  0     e Zd ZU dZded<   d fdZ xZS )AgentsExceptionz0Base class for all exceptions in the Agents SDK.zRunErrorDetails | Nonerun_datac                ,    t        |   |  d | _        y r   )super__init__r-   )r   args	__class__s     r    r0   zAgentsException.__init__)   s    $r"   )r1   objectr#   Noner%   r&   r'   r(   r)   r0   __classcell__r2   s   @r    r,   r,   $   s    :$$ r"   r,   c                  0     e Zd ZU dZded<   d fdZ xZS )MaxTurnsExceededz>Exception raised when the maximum number of turns is exceeded.r$   messagec                2    || _         t        | 	  |       y r   r:   r/   r0   r   r:   r2   s     r    r0   zMaxTurnsExceeded.__init__3       !r"   r:   r$   r5   r7   s   @r    r9   r9   .   s    HL" "r"   r9   c                  0     e Zd ZU dZded<   d fdZ xZS )ModelBehaviorErrorzException raised when the model does something unexpected, e.g. calling a tool that doesn't
    exist, or providing malformed JSON.
    r$   r:   c                2    || _         t        | 	  |       y r   r<   r=   s     r    r0   zModelBehaviorError.__init__?   r>   r"   r?   r5   r7   s   @r    rA   rA   8   s     L" "r"   rA   c                  0     e Zd ZU dZded<   d fdZ xZS )	UserErrorz<Exception raised when the user makes an error using the SDK.r$   r:   c                2    || _         t        | 	  |       y r   r<   r=   s     r    r0   zUserError.__init__I   r>   r"   r?   r5   r7   s   @r    rD   rD   D   s    FL" "r"   rD   c                  2     e Zd ZU dZded<   	 d fdZ xZS )InputGuardrailTripwireTriggered8Exception raised when a guardrail tripwire is triggered.r	   guardrail_resultc                v    || _         t        | 	  d|j                  j                  j
                   d       y Nz
Guardrail  triggered tripwirerI   r/   r0   	guardrailr2   r%   r   rI   r2   s     r    r0   z(InputGuardrailTripwireTriggered.__init__T   9     0)33==FFGGZ[	
r"   )rI   r	   r5   r7   s   @r    rG   rG   N   s    B**>
 
r"   rG   c                  2     e Zd ZU dZded<   	 d fdZ xZS ) OutputGuardrailTripwireTriggeredrH   r
   rI   c                v    || _         t        | 	  d|j                  j                  j
                   d       y rK   rM   rO   s     r    r0   z)OutputGuardrailTripwireTriggered.__init__a   rP   r"   )rI   r
   r5   r7   s   @r    rR   rR   [   s    B++>
 
r"   rR   c                  >     e Zd ZU dZded<   	 ded<   	 d fdZ xZS )#ToolInputGuardrailTripwireTriggeredzCException raised when a tool input guardrail tripwire is triggered.ToolInputGuardrail[Any]rN   r   outputc                p    || _         || _        t        |   d|j                  j
                   d       y )NzTool input guardrail rL   rN   rW   r/   r0   r2   r%   r   rN   rW   r2   s      r    r0   z,ToolInputGuardrailTripwireTriggered.__init__q   s6    "01D1D1M1M0NNabcr"   )rN   rV   rW   r   r5   r7   s   @r    rU   rU   h   s$    M&&+''1d dr"   rU   c                  >     e Zd ZU dZded<   	 ded<   	 d fdZ xZS )$ToolOutputGuardrailTripwireTriggeredzDException raised when a tool output guardrail tripwire is triggered.ToolOutputGuardrail[Any]rN   r   rW   c                p    || _         || _        t        |   d|j                  j
                   d       y )NzTool output guardrail rL   rY   rZ   s      r    r0   z-ToolOutputGuardrailTripwireTriggered.__init__   s6    "1)2E2E2N2N1OObcdr"   )rN   r]   rW   r   r5   r7   s   @r    r\   r\   w   s$    N''+''1e er"   r\   N)"
__future__r   dataclassesr   typingr   r   agentr   rN   r	   r
   itemsr   r   r   run_contextr   tool_guardrailsr   r   r   util._pretty_printr   r   	Exceptionr,   r9   rA   rD   rG   rR   rU   r\   r*   r"   r    <module>rh      s    " ! %FAA.  ? 4 4 4i " "	" 	"" "

o 



 

d/ de? er"   