o
    Ã¿iø8  ã                   @   sœ  d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
 dZdZed 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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/d0„ d0eƒZ"G d1d2„ d2eƒZ#G d3d4„ d4eƒZ$G d5d6„ d6eƒZ%G d7d8„ d8eƒZ&G d9d:„ d:eƒZ'G d;d<„ d<eƒZ(G d=d>„ d>eƒZ)G d?d@„ d@eƒZ*G dAdB„ dBeƒZ+G dCdD„ dDeƒZ,G dEdF„ dFe,ƒZ-G dGdH„ dHeƒZ.G dIdJ„ dJeƒZ/G dKdL„ dLeƒZ0G dMdN„ dNeƒZ1G dOdP„ dPeƒZ2G dQdR„ dReƒZ3G dSdT„ dTeƒZ4G dUdV„ dVeƒZ5G dWdX„ dXeƒZ6G dYdZ„ dZeƒZ7G d[d\„ d\eƒZ8G d]d^„ d^eƒZ9G d_d`„ d`eƒZ:G dadb„ dbeƒZ;G dcdd„ ddeƒZ<G dedf„ dfeƒZ=G dgdh„ dheƒZ>G didj„ djeƒZ?G dkdl„ dleƒZ@G dmdn„ dneƒZAG dodp„ dpeƒZBdqS )raC  RTVI protocol v1 message models.

Contains all RTVI protocol v1 message definitions and data structures.
Import this module under the ``RTVI`` alias to use as a namespace::

    import pipecat.processors.frameworks.rtvi.models as RTVI

    msg = RTVI.BotReady(id="1", data=RTVI.BotReadyData(version=RTVI.PROTOCOL_VERSION))
é    )ÚAnyÚDictÚLiteralÚMappingÚOptional)Ú	BaseModel)ÚAggregationTypez1.2.0zrtvi-aic                   @   sF   e Zd ZU dZeZeed< eed< eed< dZ	e
eeef  ed< dS )ÚMessagezaBase RTVI message structure.

    Represents the standard format for RTVI protocol messages.
    ÚlabelÚtypeÚidNÚdata)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚMESSAGE_LABELr
   ÚMessageLiteralÚ__annotations__Ústrr   r   r   r   © r   r   ú]/home/ubuntu/.local/lib/python3.10/site-packages/pipecat/processors/frameworks/rtvi/models.pyr	   (   s   
 r	   c                   @   ó*   e Zd ZU dZeed< dZee ed< dS )ÚRawClientMessageDatazEData structure expected from client messages sent to the RTVI server.ÚtNÚd©	r   r   r   r   r   r   r   r   r   r   r   r   r   r   7   ó   
 r   c                   @   s2   e Zd ZU dZeed< eed< dZee ed< dS )ÚClientMessagez9Cleansed data structure for client messages for handling.Úmsg_idr   Nr   )	r   r   r   r   r   r   r   r   r   r   r   r   r   r   >   s
   
 r   c                   @   r   )ÚRawServerResponseDataz7Data structure for server responses to client messages.r   Nr   r   r   r   r   r   r    F   r   r    c                   @   ó>   e Zd ZU dZeZeed< dZe	d ed< e
ed< eed< dS )ÚServerResponsez“The RTVI-formatted message response from the server to the client.

    This message is used to respond to custom messages sent by the client.
    r
   zserver-responser   r   r   N)r   r   r   r   r   r
   r   r   r   r   r   r    r   r   r   r   r"   M   ó   
 r"   c                   @   sZ   e Zd ZU dZeed< dZee ed< dZee ed< dZ	ee ed< dZ
ee ed< dS )ÚAboutClientDataz»Data about the RTVI client.

    Contains information about the client, including which RTVI library it
    is using, what platform it is on and any additional details, if available.
    ÚlibraryNÚlibrary_versionÚplatformÚplatform_versionÚplatform_details)r   r   r   r   r   r   r&   r   r'   r(   r)   r   r   r   r   r   r$   Y   s   
 r$   c                   @   ó"   e Zd ZU dZeed< eed< dS )ÚClientReadyDatazjData format of client ready messages.

    Contains the RTVI protocol version and client information.
    ÚversionÚaboutN)r   r   r   r   r   r   r$   r   r   r   r   r+   g   ó   
 r+   c                   @   ó   e Zd ZU dZeed< dS )ÚErrorResponseDatazaData for an RTVI error response.

    Contains the error message to send back to the client.
    ÚerrorN©r   r   r   r   r   r   r   r   r   r   r0   t   ó   
 r0   c                   @   r!   )ÚErrorResponsezqRTVI error response message.

    RTVI formatted error response message for relaying failed client requests.
    r
   zerror-responser   r   r   N)r   r   r   r   r   r
   r   r   r   r   r   r0   r   r   r   r   r4   }   r#   r4   c                   @   r*   )Ú	ErrorDataz`Data for an RTVI error event.

    Contains error information including whether it's fatal.
    r1   ÚfatalN©r   r   r   r   r   r   Úboolr   r   r   r   r5   ‰   r.   r5   c                   @   ó6   e Zd ZU dZeZeed< dZe	d ed< e
ed< dS )ÚErrorzeRTVI error event message.

    RTVI formatted error message for relaying errors in the pipeline.
    r
   r1   r   r   N)r   r   r   r   r   r
   r   r   r   r   r5   r   r   r   r   r:   “   ó
   
 r:   c                   @   s2   e Zd ZU dZeed< dZeeee	f  ed< dS )ÚBotReadyDataz_Data for bot ready notification.

    Contains protocol version and initial configuration.
    r,   Nr-   )
r   r   r   r   r   r   r-   r   r   r   r   r   r   r   r<   ¡   s   
 r<   c                   @   r!   )ÚBotReadyzeMessage indicating bot is ready for interaction.

    Sent after bot initialization is complete.
    r
   z	bot-readyr   r   r   N)r   r   r   r   r   r
   r   r   r   r   r   r<   r   r   r   r   r=   «   r#   r=   c                   @   s2   e Zd ZU dZeed< eed< eeef ed< dS )ÚLLMFunctionCallMessageDatazÏData for LLM function call notification.

    Contains function call details including name, ID, and arguments.

    .. deprecated:: 0.0.102
        Use ``LLMFunctionCallInProgressMessageData`` instead.
    Úfunction_nameÚtool_call_idÚargsN)r   r   r   r   r   r   r   r   r   r   r   r   r>   ·   s
   
 r>   c                   @   r9   )ÚLLMFunctionCallMessagezòMessage notifying of an LLM function call.

    Sent when the LLM makes a function call.

    .. deprecated:: 0.0.102
        Use ``LLMFunctionCallInProgressMessage`` with the
        ``llm-function-call-in-progress`` event type instead.
    r
   zllm-function-callr   r   N)r   r   r   r   r   r
   r   r   r   r   r>   r   r   r   r   rB   Å   s
   
 	rB   c                   @   s*   e Zd ZU dZdZeed< dZeed< dS )ÚSendTextOptionszyOptions for sending text input to the LLM.

    Contains options for how the pipeline should process the text input.
    TÚrun_immediatelyÚaudio_responseN)r   r   r   r   rD   r8   r   rE   r   r   r   r   rC   Ô   ó   
 rC   c                   @   r   )ÚSendTextDataz’Data format for sending text input to the LLM.

    Contains the text content to send and any options for how the pipeline should process it.
    ÚcontentNÚoptions)	r   r   r   r   r   r   rI   r   rC   r   r   r   r   rG   Þ   s   
 rG   c                   @   s6   e Zd ZU dZed eB ed< eed< dZe	ed< dS )ÚAppendToContextDataa&  Data format for appending messages to the context.

    Contains the role, content, and whether to run the message immediately.

    .. deprecated:: 0.0.85
        The RTVI message, append-to-context, has been deprecated. Use send-text
        or custom client and server messages instead.
    )ÚuserÚ	assistantÚrolerH   FrD   N)
r   r   r   r   r   r   r   r   rD   r8   r   r   r   r   rJ   è   s
   
 	rJ   c                   @   r9   )ÚAppendToContextzàRTVI message format to append content to the LLM context.

    .. deprecated:: 0.0.85
        The RTVI message, append-to-context, has been deprecated. Use send-text
        or custom client and server messages instead.
    r
   zappend-to-contextr   r   N)r   r   r   r   r   r
   r   r   r   r   rJ   r   r   r   r   rN   ÷   s
   
 rN   c                   @   s"   e Zd ZU dZdZee ed< dS )ÚLLMFunctionCallStartMessageDataz¼Data for LLM function call start notification.

    Contains the function name being called. Fields may be omitted based on
    the configured function_call_report_level for security.
    Nr?   )r   r   r   r   r?   r   r   r   r   r   r   r   rO     s   
 rO   c                   @   r9   )ÚLLMFunctionCallStartMessagezlMessage notifying that an LLM function call has started.

    Sent when the LLM begins a function call.
    r
   zllm-function-call-startedr   r   N)r   r   r   r   r   r
   r   r   r   r   rO   r   r   r   r   rP     r;   rP   c                   @   s6   e Zd ZU dZeed< eed< eed< eeB ed< dS )ÚLLMFunctionCallResultDatazWData for LLM function call result.

    Contains function call details and result.
    r?   r@   Ú	argumentsÚresultN)r   r   r   r   r   r   Údictr   r   r   r   rQ     s   
 rQ   c                   @   sB   e Zd ZU dZeed< dZee ed< dZee	ee
f  ed< dS )Ú$LLMFunctionCallInProgressMessageDatazÛData for LLM function call in-progress notification.

    Contains function call details including name, ID, and arguments.
    Fields may be omitted based on the configured function_call_report_level for security.
    r@   Nr?   rR   )r   r   r   r   r   r   r?   r   rR   r   r   r   r   r   r   rU   %  s
   
 rU   c                   @   r9   )Ú LLMFunctionCallInProgressMessagezwMessage notifying that an LLM function call is in progress.

    Sent when the LLM function call execution begins.
    r
   zllm-function-call-in-progressr   r   N)r   r   r   r   r   r
   r   r   r   r   rU   r   r   r   r   rV   1  r;   rV   c                   @   sB   e Zd ZU dZeed< eed< dZee ed< dZ	ee
 ed< dS )Ú!LLMFunctionCallStoppedMessageDataa  Data for LLM function call stopped notification.

    Contains details about the function call that stopped, including
    whether it was cancelled or completed with a result.
    Fields may be omitted based on the configured function_call_report_level for security.
    r@   Ú	cancelledNr?   rS   )r   r   r   r   r   r   r8   r?   r   rS   r   r   r   r   r   rW   <  s   
 rW   c                   @   r9   )ÚLLMFunctionCallStoppedMessagez…Message notifying that an LLM function call has stopped.

    Sent when a function call completes (with result) or is cancelled.
    r
   zllm-function-call-stoppedr   r   N)r   r   r   r   r   r
   r   r   r   r   rW   r   r   r   r   rY   J  r;   rY   c                   @   ó.   e Zd ZU dZeZeed< dZe	d ed< dS )ÚBotLLMStartedMessagez2Message indicating bot LLM processing has started.r
   zbot-llm-startedr   N©
r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r[   U  ó   
 r[   c                   @   rZ   )ÚBotLLMStoppedMessagez2Message indicating bot LLM processing has stopped.r
   zbot-llm-stoppedr   Nr\   r   r   r   r   r^   \  r]   r^   c                   @   rZ   )ÚBotTTSStartedMessagez2Message indicating bot TTS processing has started.r
   zbot-tts-startedr   Nr\   r   r   r   r   r_   c  r]   r_   c                   @   rZ   )ÚBotTTSStoppedMessagez2Message indicating bot TTS processing has stopped.r
   zbot-tts-stoppedr   Nr\   r   r   r   r   r`   j  r]   r`   c                   @   r/   )ÚTextMessageDatazCData for text-based RTVI messages.

    Contains text content.
    ÚtextNr2   r   r   r   r   ra   q  r3   ra   c                   @   s*   e Zd ZU dZdZeed< eeB ed< dS )ÚBotOutputMessageDatazjData for bot output RTVI messages.

    Extends TextMessageData to include metadata about the output.
    FÚspokenÚaggregated_byN)	r   r   r   r   rd   r8   r   r   r   r   r   r   r   rc   z  rF   rc   c                   @   r9   )ÚBotOutputMessagez¶Message containing bot output text.

    An event meant to holistically represent what the bot is outputting,
    along with metadata about the output and if it has been spoken.
    r
   z
bot-outputr   r   N)r   r   r   r   r   r
   r   r   r   r   rc   r   r   r   r   rf   …  s
   
 rf   c                   @   r9   )ÚBotTranscriptionMessagez_Message containing bot transcription text.

    Sent when the bot's speech is transcribed.
    r
   zbot-transcriptionr   r   N©r   r   r   r   r   r
   r   r   r   r   ra   r   r   r   r   rg   ‘  r;   rg   c                   @   r9   )ÚBotLLMTextMessagezYMessage containing bot LLM text output.

    Sent when the bot's LLM generates text.
    r
   zbot-llm-textr   r   Nrh   r   r   r   r   ri   œ  r;   ri   c                   @   r9   )ÚBotTTSTextMessagez[Message containing bot TTS text output.

    Sent when text is being processed by TTS.
    r
   zbot-tts-textr   r   Nrh   r   r   r   r   rj   §  r;   rj   c                   @   s*   e Zd ZU dZeed< eed< eed< dS )ÚAudioMessageDatazOData for audio-based RTVI messages.

    Contains audio data and metadata.
    ÚaudioÚsample_rateÚnum_channelsN)r   r   r   r   r   r   Úintr   r   r   r   rk   ²  s
   
 rk   c                   @   r9   )ÚBotTTSAudioMessagez[Message containing bot TTS audio output.

    Sent when the bot's TTS generates audio.
    r
   zbot-tts-audior   r   N)r   r   r   r   r   r
   r   r   r   r   rk   r   r   r   r   rp   ½  r;   rp   c                   @   s2   e Zd ZU dZeed< eed< eed< eed< dS )ÚUserTranscriptionMessageDatazYData for user transcription messages.

    Contains transcription text and metadata.
    rb   Úuser_idÚ	timestampÚfinalNr7   r   r   r   r   rq   È  s   
 rq   c                   @   r9   )ÚUserTranscriptionMessagezVMessage containing user transcription.

    Sent when user speech is transcribed.
    r
   zuser-transcriptionr   r   N)r   r   r   r   r   r
   r   r   r   r   rq   r   r   r   r   ru   Ô  r;   ru   c                   @   r9   )ÚUserLLMTextMessagezbMessage containing user text input for LLM.

    Sent when user text is processed by the LLM.
    r
   zuser-llm-textr   r   Nrh   r   r   r   r   rv   ß  r;   rv   c                   @   rZ   )ÚUserStartedSpeakingMessagez-Message indicating user has started speaking.r
   zuser-started-speakingr   Nr\   r   r   r   r   rw   ê  r]   rw   c                   @   rZ   )ÚUserStoppedSpeakingMessagez-Message indicating user has stopped speaking.r
   zuser-stopped-speakingr   Nr\   r   r   r   r   rx   ñ  r]   rx   c                   @   rZ   )ÚUserMuteStartedMessagez'Message indicating user has been muted.r
   zuser-mute-startedr   Nr\   r   r   r   r   ry   ø  r]   ry   c                   @   rZ   )ÚUserMuteStoppedMessagez)Message indicating user has been unmuted.r
   zuser-mute-stoppedr   Nr\   r   r   r   r   rz   ÿ  r]   rz   c                   @   rZ   )ÚBotStartedSpeakingMessagez,Message indicating bot has started speaking.r
   zbot-started-speakingr   Nr\   r   r   r   r   r{     r]   r{   c                   @   rZ   )ÚBotStoppedSpeakingMessagez,Message indicating bot has stopped speaking.r
   zbot-stopped-speakingr   Nr\   r   r   r   r   r|     r]   r|   c                   @   s>   e Zd ZU dZeZeed< dZe	d ed< e
eef ed< dS )ÚMetricsMessagez`Message containing performance metrics.

    Sent to provide performance and usage metrics.
    r
   Úmetricsr   r   N)r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r}     s
   
 r}   c                   @   r9   )ÚServerMessagezLGeneric server message.

    Used for custom server-to-client messages.
    r
   zserver-messager   r   N)r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r     r;   r   c                   @   r/   )ÚAudioLevelMessageDataz%Data format for sending audio levels.ÚvalueN)r   r   r   r   Úfloatr   r   r   r   r   r€   *  s   
 r€   c                   @   r9   )ÚUserAudioLevelMessagez$Message indicating user audio level.r
   zuser-audio-levelr   r   N©r   r   r   r   r   r
   r   r   r   r   r€   r   r   r   r   rƒ   0  ó
   
 rƒ   c                   @   r9   )ÚBotAudioLevelMessagez#Message indicating bot audio level.r
   zbot-audio-levelr   r   Nr„   r   r   r   r   r†   8  r…   r†   c                   @   r9   )ÚSystemLogMessagezMessage including a system log.r
   z
system-logr   r   Nrh   r   r   r   r   r‡   @  r…   r‡   N)Cr   Útypingr   r   r   r   r   Úpydanticr   Úpipecat.frames.framesr   ÚPROTOCOL_VERSIONr   r   r	   r   r   r    r"   r$   r+   r0   r4   r5   r:   r<   r=   r>   rB   rC   rG   rJ   rN   rO   rP   rQ   rU   rV   rW   rY   r[   r^   r_   r`   ra   rc   rf   rg   ri   rj   rk   rp   rq   ru   rv   rw   rx   ry   rz   r{   r|   r}   r   r€   rƒ   r†   r‡   r   r   r   r   Ú<module>   sx   
	




	