o
    õæh9#  ã                   @  s  d dl mZ d dlZd dlmZmZ d dlmZmZ er$d dl	m
Z
mZ G dd„ dejƒZG dd	„ d	eƒZG d
d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é    )ÚannotationsN)ÚMappingÚSequence)ÚTYPE_CHECKINGÚAny)ÚResponseÚResponseInputItemParamc                   @  s4   e Zd ZdZejd
dd„ƒZeejddd„ƒƒZd	S )ÚSpanDataz,
    Represents span data in the trace.
    Úreturnúdict[str, Any]c                 C  ó   dS )z%Export the span data as a dictionary.N© ©Úselfr   r   úY/var/www/html/openai_agents/venv/lib/python3.10/site-packages/agents/tracing/span_data.pyÚexport   s   zSpanData.exportÚstrc                 C  r   )zReturn the type of the span.Nr   r   r   r   r   Útype   s   zSpanData.typeN©r
   r   ©r
   r   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚabcÚabstractmethodr   Úpropertyr   r   r   r   r   r	      s    r	   c                   @  s>   e Zd ZdZdZ			dddd„Zeddd„ƒZddd„ZdS )ÚAgentSpanDataze
    Represents an Agent Span in the trace.
    Includes name, handoffs, tools, and output type.
    ©ÚnameÚhandoffsÚtoolsÚoutput_typeNr   r   r    úlist[str] | Noner!   r"   ú
str | Nonec                 C  ó   || _ || _|| _|| _d S ©Nr   )r   r   r    r!   r"   r   r   r   Ú__init__$   ó   
zAgentSpanData.__init__r
   c                 C  r   )NÚagentr   r   r   r   r   r   0   ó   zAgentSpanData.typer   c                 C  s   | j | j| j| j| jdœS )N©r   r   r    r!   r"   r+   r   r   r   r   r   4   s   ûzAgentSpanData.export)NNN)r   r   r    r#   r!   r#   r"   r$   r   r   ©	r   r   r   r   Ú	__slots__r'   r   r   r   r   r   r   r   r      s    ûr   c                   @  s:   e Zd ZdZdZ	dddd„Zeddd„ƒZddd„ZdS )ÚFunctionSpanDatazk
    Represents a Function Span in the trace.
    Includes input, output and MCP data (if applicable).
    ©r   ÚinputÚoutputÚmcp_dataNr   r   r0   r$   r1   ú
Any | Noner2   údict[str, Any] | Nonec                 C  r%   r&   r/   )r   r   r0   r1   r2   r   r   r   r'   F   r(   zFunctionSpanData.__init__r
   c                 C  r   )NÚfunctionr   r   r   r   r   r   R   r*   zFunctionSpanData.typer   c                 C  s(   | j | j| j| jrt| jƒnd | jdœS )N)r   r   r0   r1   r2   )r   r   r0   r1   r   r2   r   r   r   r   r   V   s   ûzFunctionSpanData.exportr&   )r   r   r0   r$   r1   r3   r2   r4   r   r   r,   r   r   r   r   r.   >   s    ûr.   c                   @  sB   e Zd ZdZdZ					dddd„Zeddd„ƒZddd„ZdS )ÚGenerationSpanDatazw
    Represents a Generation Span in the trace.
    Includes input, output, model, model configuration, and usage.
    ©r0   r1   ÚmodelÚmodel_configÚusageNr0   ú"Sequence[Mapping[str, Any]] | Noner1   r8   r$   r9   úMapping[str, Any] | Noner:   r4   c                 C  ó"   || _ || _|| _|| _|| _d S r&   r7   )r   r0   r1   r8   r9   r:   r   r   r   r'   n   ó
   
zGenerationSpanData.__init__r
   r   c                 C  r   )NÚ
generationr   r   r   r   r   r   |   r*   zGenerationSpanData.typer   c                 C  s   | j | j| j| j| j| jdœS )N©r   r0   r1   r8   r9   r:   r@   r   r   r   r   r   €   s   úzGenerationSpanData.export)NNNNN)
r0   r;   r1   r;   r8   r$   r9   r<   r:   r4   r   r   r,   r   r   r   r   r6   `   s    
úr6   c                   @  s<   e Zd ZdZdZ		ddd
d„Zeddd„ƒZddd„ZdS )ÚResponseSpanDatazS
    Represents a Response Span in the trace.
    Includes response and input.
    ©Úresponser0   NrC   úResponse | Noner0   ú)str | list[ResponseInputItemParam] | Noner
   ÚNonec                 C  ó   || _ || _d S r&   rB   )r   rC   r0   r   r   r   r'   “   s   
zResponseSpanData.__init__r   c                 C  r   )NrC   r   r   r   r   r   r      r*   zResponseSpanData.typer   c                 C  s   | j | jr| jjdœS d dœS )N)r   Úresponse_id)r   rC   Úidr   r   r   r   r   ¡   s
   þþzResponseSpanData.export©NN)rC   rD   r0   rE   r
   rF   r   r   r,   r   r   r   r   rA   ‹   s    ý
rA   c                   @  s6   e Zd ZdZdZddd„Zedd
d„ƒZddd„ZdS )ÚHandoffSpanDataz]
    Represents a Handoff Span in the trace.
    Includes source and destination agents.
    ©Ú
from_agentÚto_agentrM   r$   rN   c                 C  rG   r&   rL   )r   rM   rN   r   r   r   r'   °   ó   
zHandoffSpanData.__init__r
   r   c                 C  r   )NÚhandoffr   r   r   r   r   r   ´   r*   zHandoffSpanData.typer   c                 C  ó   | j | j| jdœS )N©r   rM   rN   rR   r   r   r   r   r   ¸   ó   ýzHandoffSpanData.exportN)rM   r$   rN   r$   r   r   r,   r   r   r   r   rK   ¨   ó    
rK   c                   @  s6   e Zd ZdZdZddd„Zedd
d„ƒZddd„ZdS )ÚCustomSpanDatazY
    Represents a Custom Span in the trace.
    Includes name and data property bag.
    ©r   Údatar   r   rW   r   c                 C  rG   r&   rV   )r   r   rW   r   r   r   r'   È   rO   zCustomSpanData.__init__r
   c                 C  r   )NÚcustomr   r   r   r   r   r   Ì   r*   zCustomSpanData.typec                 C  rQ   )N©r   r   rW   rY   r   r   r   r   r   Ð   rS   zCustomSpanData.exportN)r   r   rW   r   r   r   r,   r   r   r   r   rU   À   rT   rU   c                   @  s8   e Zd ZdZdZdddd	„Zeddd„ƒZddd„ZdS )ÚGuardrailSpanDataz[
    Represents a Guardrail Span in the trace.
    Includes name and triggered status.
    ©r   Ú	triggeredFr   r   r\   Úboolc                 C  rG   r&   r[   )r   r   r\   r   r   r   r'   à   rO   zGuardrailSpanData.__init__r
   c                 C  r   )NÚ	guardrailr   r   r   r   r   r   ä   r*   zGuardrailSpanData.typer   c                 C  rQ   )N©r   r   r\   r_   r   r   r   r   r   è   rS   zGuardrailSpanData.exportN)F)r   r   r\   r]   r   r   r,   r   r   r   r   rZ   Ø   s    rZ   c                   @  sB   e Zd ZdZdZ					dddd„Zeddd„ƒZddd„ZdS )ÚTranscriptionSpanDatazs
    Represents a Transcription Span in the trace.
    Includes input, output, model, and model configuration.
    )r0   r1   r8   r9   NÚpcmr0   r$   Úinput_formatr1   r8   r9   r<   c                 C  r=   r&   )r0   rb   r1   r8   r9   )r   r0   rb   r1   r8   r9   r   r   r   r'   ý   r>   zTranscriptionSpanData.__init__r
   r   c                 C  r   )NÚtranscriptionr   r   r   r   r   r     r*   zTranscriptionSpanData.typer   c                 C  s&   | j | jpd| jdœ| j| j| jdœS )NÚ ©rW   Úformat)r   r0   r1   r8   r9   )r   r0   rb   r1   r8   r9   r   r   r   r   r     s   þøzTranscriptionSpanData.export)Nra   NNN)
r0   r$   rb   r$   r1   r$   r8   r$   r9   r<   r   r   r,   r   r   r   r   r`   ð   s    	úr`   c                   @  sD   e Zd ZdZdZ						dddd„Zeddd„ƒZddd„ZdS )ÚSpeechSpanDataz…
    Represents a Speech Span in the trace.
    Includes input, output, model, model configuration, and first content timestamp.
    )r0   r1   r8   r9   Úfirst_content_atNra   r0   r$   r1   Úoutput_formatr8   r9   r<   rh   c                 C  s(   || _ || _|| _|| _|| _|| _d S r&   )r0   r1   ri   r8   r9   rh   )r   r0   r1   ri   r8   r9   rh   r   r   r   r'   $  s   	
zSpeechSpanData.__init__r
   r   c                 C  r   )NÚspeechr   r   r   r   r   r   4  r*   zSpeechSpanData.typer   c                 C  s*   | j | j| jpd| jdœ| j| j| jdœS )Nrd   re   )r   r0   r1   r8   r9   rh   )r   r0   r1   ri   r8   r9   rh   r   r   r   r   r   8  s   þ÷zSpeechSpanData.export)NNra   NNN)r0   r$   r1   r$   ri   r$   r8   r$   r9   r<   rh   r$   r   r   r,   r   r   r   r   rg     s    ùrg   c                   @  s:   e Zd ZdZdZ	dddd„Zedd	d
„ƒZddd„ZdS )ÚSpeechGroupSpanDataz6
    Represents a Speech Group Span in the trace.
    r0   Nr$   c                 C  s
   || _ d S r&   )r0   )r   r0   r   r   r   r'   M  s   
zSpeechGroupSpanData.__init__r
   r   c                 C  r   )NÚspeech_groupr   r   r   r   r   r   S  r*   zSpeechGroupSpanData.typer   c                 C  s   | j | jdœS )N©r   r0   rm   r   r   r   r   r   W  s   þzSpeechGroupSpanData.exportr&   )r0   r$   r   r   r,   r   r   r   r   rk   F  s    þrk   c                   @  s8   e Zd ZdZdZdddd	„Zeddd„ƒZddd„ZdS )ÚMCPListToolsSpanDatazY
    Represents an MCP List Tools Span in the trace.
    Includes server and result.
    ©ÚserverÚresultNrp   r$   rq   r#   c                 C  rG   r&   ro   )r   rp   rq   r   r   r   r'   i  rO   zMCPListToolsSpanData.__init__r
   r   c                 C  r   )NÚ	mcp_toolsr   r   r   r   r   r   m  r*   zMCPListToolsSpanData.typer   c                 C  rQ   )N©r   rp   rq   rs   r   r   r   r   r   q  rS   zMCPListToolsSpanData.exportrJ   )rp   r$   rq   r#   r   r   r,   r   r   r   r   rn   ^  s    rn   )Ú
__future__r   r   Úcollections.abcr   r   Útypingr   r   Úopenai.types.responsesr   r   ÚABCr	   r   r.   r6   rA   rK   rU   rZ   r`   rg   rk   rn   r   r   r   r   Ú<module>   s$    ""+,*