
    h                       % S SK Jr  S SKrS SKrS SKJr  S SKJrJrJ	r	J
r
  S SKJr  S SKrS SKJr  SSKJrJrJrJrJrJr  S	S
KJrJrJrJr  S	SKJrJrJrJ r J!r!  S	SK"J#r#  S	SK$J%r%  S	SK&J'r'J(r(  S	SK)J*r*  S	SK+J,r,  S	SK-J.r.J/r/J0r0  SSK1J2r2J3r3J4r4J5r5J6r6J7r7  S	SK8J9r9  S	SK:J;r;  S	SK<J=r=  S	SK>J?r?  S	SK@JArA  \(       a  S SKBJCrD  S SKEJCrF  S	SKGJHrHJIrI  SS/rJ\R                  " \L5      rMS\NS'    " S S\'5      rO " S S\(5      rP " S  S!5      rQ " S" S#5      rR " S$ S%5      rS " S& S'5      rT " S( S)5      rU " S* S+5      rV " S, S-5      rW " S. S/5      rX " S0 S15      rY " S2 S3\Y5      rZ " S4 S5\Y5      r[ " S6 S7\Y5      r\ " S8 S9\Y5      r] " S: S;\Y5      r^ " S< S=\Y5      r_ " S> S?5      r` " S@ SA\`5      ra " SB SC\`5      rb " SD SE\`5      rc " SF SG\`5      rd " SH SI\`5      re " SJ SK\`5      rfg)L    )annotationsN)TracebackType)TYPE_CHECKINGAnyIteratorcast)AsyncIterator)	BaseModel   )SessionsAsyncSessionsSessionsWithRawResponseAsyncSessionsWithRawResponseSessionsWithStreamingResponse"AsyncSessionsWithStreamingResponse   )	NOT_GIVENQueryHeadersNotGiven)is_azure_clientmaybe_transformstrip_not_givenasync_maybe_transformis_async_azure_client)cached_property)construct_type_unchecked)SyncAPIResourceAsyncAPIResource)OpenAIError)_merge_mappings)session_update_event_paramresponse_create_event_param"transcription_session_update_param)TranscriptionSessionsAsyncTranscriptionSessions$TranscriptionSessionsWithRawResponse)AsyncTranscriptionSessionsWithRawResponse*TranscriptionSessionsWithStreamingResponse/AsyncTranscriptionSessionsWithStreamingResponse)WebsocketConnectionOptions)RealtimeClientEvent)RealtimeServerEvent)ConversationItemParam)RealtimeClientEventParam)ClientConnection)OpenAIAsyncOpenAIRealtimeAsyncRealtimezlogging.Loggerlogc                      \ rS rSr\S
S j5       r\SS j5       r\SS j5       r\SS j5       r0 0 0 S.         SS jjr	Sr
g	)r3   A   c                ,    [        U R                  5      $ N)r   _clientselfs    Y/var/www/html/env/lib/python3.13/site-packages/openai/resources/beta/realtime/realtime.pysessionsRealtime.sessionsB   s    %%    c                ,    [        U R                  5      $ r9   )r%   r:   r;   s    r=   transcription_sessionsRealtime.transcription_sessionsF   s    $T\\22r@   c                    [        U 5      $ z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)RealtimeWithRawResponser;   s    r=   with_raw_responseRealtime.with_raw_responseJ   s     't,,r@   c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)RealtimeWithStreamingResponser;   s    r=   with_streaming_response Realtime.with_streaming_responseT   s     -T22r@   extra_queryextra_headerswebsocket_connection_optionsc               0    [        U R                  UUUUS9$ a  
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as function calling.

Some notable benefits of the API include:

- Native speech-to-speech: Skipping an intermediate text format means low latency and nuanced output.
- Natural, steerable voices: The models have natural inflection and can laugh, whisper, and adhere to tone direction.
- Simultaneous multimodal output: Text is useful for moderation; faster-than-realtime audio ensures stable playback.

The Realtime API is a stateful, event-based API that communicates over a WebSocket.
)clientrO   rP   rQ   model)RealtimeConnectionManagerr:   r<   rU   rO   rP   rQ   s        r=   connectRealtime.connect]   s$    & )<<#')E
 	
r@    N)returnr   )r[   r%   )r[   rF   )r[   rK   )
rU   strrO   r   rP   r   rQ   r+   r[   rV   __name__
__module____qualname____firstlineno__r   r>   rB   rG   rL   rX   __static_attributes__rZ   r@   r=   r3   r3   A   s    & & 3 3 - - 3 3  !#CE
 
 	

 
 'A
 
#
 
r@   c                      \ rS rSr\S
S j5       r\SS j5       r\SS j5       r\SS j5       r0 0 0 S.         SS jjr	Sr
g	)r4   y   c                ,    [        U R                  5      $ r9   )r   r:   r;   s    r=   r>   AsyncRealtime.sessionsz   s    T\\**r@   c                ,    [        U R                  5      $ r9   )r&   r:   r;   s    r=   rB   $AsyncRealtime.transcription_sessions~   s    )$,,77r@   c                    [        U 5      $ rE   )AsyncRealtimeWithRawResponser;   s    r=   rG   AsyncRealtime.with_raw_response   s     ,D11r@   c                    [        U 5      $ rJ   )"AsyncRealtimeWithStreamingResponser;   s    r=   rL   %AsyncRealtime.with_streaming_response   s     2$77r@   rN   c               0    [        U R                  UUUUS9$ rS   )AsyncRealtimeConnectionManagerr:   rW   s        r=   rX   AsyncRealtime.connect   s$    & .<<#')E
 	
r@   rZ   N)r[   r   )r[   r&   )r[   rj   )r[   rm   )
rU   r\   rO   r   rP   r   rQ   r+   r[   rp   r]   rZ   r@   r=   r4   r4   y   s    + + 8 8 2 2 8 8  !#CE
 
 	

 
 'A
 
(
 
r@   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rF      c                    Xl         g r9   	_realtimer<   realtimes     r=   __init__ RealtimeWithRawResponse.__init__       !r@   c                @    [        U R                  R                  5      $ r9   )r   rv   r>   r;   s    r=   r>    RealtimeWithRawResponse.sessions   s    &t~~'>'>??r@   c                @    [        U R                  R                  5      $ r9   )r'   rv   rB   r;   s    r=   rB   .RealtimeWithRawResponse.transcription_sessions   s    3DNN4Y4YZZr@   ru   Nrx   r3   r[   None)r[   r   )r[   r'   	r^   r_   r`   ra   ry   r   r>   rB   rb   rZ   r@   r=   rF   rF      s3    " @ @ [ [r@   rF   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rj      c                    Xl         g r9   ru   rw   s     r=   ry   %AsyncRealtimeWithRawResponse.__init__   r{   r@   c                @    [        U R                  R                  5      $ r9   )r   rv   r>   r;   s    r=   r>   %AsyncRealtimeWithRawResponse.sessions   s    +DNN,C,CDDr@   c                @    [        U R                  R                  5      $ r9   )r(   rv   rB   r;   s    r=   rB   3AsyncRealtimeWithRawResponse.transcription_sessions   s    89^9^__r@   ru   Nrx   r4   r[   r   )r[   r   )r[   r(   r   rZ   r@   r=   rj   rj      s3    " E E ` `r@   rj   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rK      c                    Xl         g r9   ru   rw   s     r=   ry   &RealtimeWithStreamingResponse.__init__   r{   r@   c                @    [        U R                  R                  5      $ r9   )r   rv   r>   r;   s    r=   r>   &RealtimeWithStreamingResponse.sessions   s    ,T^^-D-DEEr@   c                @    [        U R                  R                  5      $ r9   )r)   rv   rB   r;   s    r=   rB   4RealtimeWithStreamingResponse.transcription_sessions   s    9$..:_:_``r@   ru   Nr   )r[   r   )r[   r)   r   rZ   r@   r=   rK   rK      s3    " F F a ar@   rK   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rm      c                    Xl         g r9   ru   rw   s     r=   ry   +AsyncRealtimeWithStreamingResponse.__init__   r{   r@   c                @    [        U R                  R                  5      $ r9   )r   rv   r>   r;   s    r=   r>   +AsyncRealtimeWithStreamingResponse.sessions   s    1$..2I2IJJr@   c                @    [        U R                  R                  5      $ r9   )r*   rv   rB   r;   s    r=   rB   9AsyncRealtimeWithStreamingResponse.transcription_sessions   s    >t~~?d?deer@   ru   Nr   )r[   r   )r[   r*   r   rZ   r@   r=   rm   rm      s3    " K K f fr@   rm   c                      \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   SS jrSS jrSS jrSS jr	SS jr
SSS.S S jjrS!S jrSrg)"AsyncRealtimeConnection   :Represents a live websocket connection to the Realtime APIAsyncRealtimeSessionResourcesessionAsyncRealtimeResponseResourceresponse%AsyncRealtimeInputAudioBufferResourceinput_audio_buffer!AsyncRealtimeConversationResourceconversation)AsyncRealtimeTranscriptionSessionResourcetranscription_sessionAsyncWebsocketConnection_connectionc                    Xl         [        U 5      U l        [        U 5      U l        [        U 5      U l        [        U 5      U l        [        U 5      U l
        g r9   )r   r   r   r   r   r   r   r   r   r   r   r<   
connections     r=   ry    AsyncRealtimeConnection.__init__   sG    %3D95d;"G"M=dC%Nt%T"r@   c               p   #    SSK Jn    U R                  5       I Sh  vN 7v   M   N	! U a     gf = f7fzY
An infinite-iterator that will continue to yield events until
the connection is closed.
r   )ConnectionClosedOKNwebsockets.exceptionsr   recvr<   r   s     r=   	__aiter__!AsyncRealtimeConnection.__aiter__   s:     
 	=	 IIK'' '! 		s    6* (
* 3636c                \   #    U R                  U R                  5       I Sh  vN 5      $  N7f)
Receive the next message from the connection and parses it into a `RealtimeServerEvent` object.

Canceling this method is safe. There's no risk of losing data.
Nparse_event
recv_bytesr;   s    r=   r   AsyncRealtimeConnection.recv  s%      doo&7 788 7s   ,*	,c                   #    U R                   R                  SS9I Sh  vN n[        R                  SU5        U$  N7f)Receive the next message from the connection as raw bytes.

Canceling this method is safe. There's no risk of losing data.

If you want to parse the message into a `RealtimeServerEvent` object like `.recv()` does,
then you can call `.parse_event(data)`.
FdecodeNReceived websocket message: %sr   r   r5   debugr<   messages     r=   r   "AsyncRealtimeConnection.recv_bytes  s<      ((--U-;;		2W= <s   ><>c                   #    [        U[        5      (       a  UR                  SSSS9O+[        R                  " [        U[        5      I S h  vN 5      nU R                  R                  U5      I S h  vN   g  N, N7fNT)use_api_namesexclude_defaultsexclude_unset)	
isinstancer
   to_jsonjsondumpsr   r/   r   sendr<   eventdatas      r=   r   AsyncRealtimeConnection.send  sk      %++ MMtSWMX"7?W"XXY 	
 ##D))) Y)s$   A
A=A9&A=3A;4A=;A=   codereasonc               R   #    U R                   R                  XS9I S h  vN   g  N7fNr   r   closer<   r   r   s      r=   r   AsyncRealtimeConnection.close"  s"     $$$$>>>s   '%'c           
     ~    [        [        [        [        R                  " U5      [        [
        [        5      S95      $ z
Converts a raw `str` or `bytes` message into a `RealtimeServerEvent` object.

This is helpful if you're using `.recv_bytes()`.
)valuetype_r   r-   r   r   loadsr   r<   r   s     r=   r   #AsyncRealtimeConnection.parse_event%  1     !9

4@PX\]`buXv!w
 	
r@   r   r   r   r   r   r   N)r   r   r[   r   )r[   z"AsyncIterator[RealtimeServerEvent]r[   r-   r[   bytesr   z.RealtimeClientEvent | RealtimeClientEventParamr[   r   r   intr   r\   r[   r   r   zstr | bytesr[   r-   )r^   r_   r`   ra   __doc____annotations__ry   r   r   r   r   r   r   rb   rZ   r@   r=   r   r      sT    D))++==33DD))U9
* *.R ?
r@   r   c                  l    \ rS rSrSr            S	S jrS
S jr\rSS jr        SS jr	Sr
g)rp   i0  a  
Context manager over a `AsyncRealtimeConnection` that is returned by `beta.realtime.connect()`

This context manager ensures that the connection will be closed when it exits.

---

Note that if your application doesn't work well with the context manager approach then you
can call the `.enter()` method directly to initiate a connection.

**Warning**: You must remember to close the connection with `.close()`.

```py
connection = await client.beta.realtime.connect(...).enter()
# ...
await connection.close()
```
c               N    Xl         X l        S U l        X0l        X@l        XPl        g r9   )'_AsyncRealtimeConnectionManager__client&_AsyncRealtimeConnectionManager__model+_AsyncRealtimeConnectionManager__connection,_AsyncRealtimeConnectionManager__extra_query._AsyncRealtimeConnectionManager__extra_headers=_AsyncRealtimeConnectionManager__websocket_connection_optionsr<   rT   rU   rO   rP   rQ   s         r=   ry   'AsyncRealtimeConnectionManager.__init__D  s(     <@(,.J+r@   c                >  #     SSK Jn  U R                  nU R
                  R                  n[        U R
                  5      (       a1  U R
                  R                  U R                  U5      I Sh  vN u  pTOMU R                  5       R                  0 U R
                  R                  R                  ESU R                  0EUES9n[        R                  SU5        U R                   (       a   [        R                  SU R                   5        [#        U" [%        U5      4U R
                  R&                  [)        0 UES	S
0EU R*                  5      S.U R                   D6I Sh  vN 5      U l        U R,                  $ ! [         a  n[        S5      UeSnAff = f GN) N:7f)u?  
👋 If your application doesn't work well with the context manager approach then you
can call this method directly to initiate a connection.

**Warning**: You must remember to close the connection with `.close()`.

```py
connection = await client.beta.realtime.connect(...).enter()
# ...
await connection.close()
```
r   rX   9You need to install `openai[realtime]` to use this methodNrU   paramsConnecting to %sConnection options: %sOpenAI-Betarealtime=v1user_agent_headeradditional_headers)websockets.asyncio.clientrX   ImportErrorr    r   r   auth_headersr   _configure_realtimer   _prepare_url	copy_withbase_urlr  r5   r   r   r   r\   
user_agentr!   r   r   r<   rX   excrO   r  urls         r=   
__aenter__)AsyncRealtimeConnectionManager.__aenter__T  s    	d9 ((}}11 //&*mm&G&GVa&b bC##%//mm,,33T\\ " 0 C 			$c*..II.0S0ST3C"&--":":#2&%} (($ 55 
    E  	dYZ`cc	d !csG   FE: A%F/F0C0F F!F:
FFFFFc                &   U R                   R                  b+  [        R                  " U R                   R                  5      nO#U R                   R                  R                  SS9nUR                  R                  S5      S-   nUR                  US9$ Nwss)scheme   /s	   /realtime)raw_path)r   websocket_base_urlhttpxURL	_base_urlr  r  rstripr<   r  merge_raw_paths      r=   r  +AsyncRealtimeConnectionManager._prepare_url  v    ==++7yy!A!ABH}}..888FH!**11$7,F!!>!::r@   c                p   #    U R                   b#  U R                   R                  5       I S h  vN   g g  N7fr9   )r   r   r<   exc_typer  exc_tbs       r=   	__aexit__(AsyncRealtimeConnectionManager.__aexit__  s3      (##))+++ )+s   +646__client__connection__extra_headers__extra_query__model__websocket_connection_optionsN)rT   r2   rU   r\   rO   r   rP   r   rQ   r+   r[   r   )r[   r   r[   z	httpx.URLr)  ztype[BaseException] | Noner  zBaseException | Noner*  zTracebackType | Noner[   r   )r^   r_   r`   ra   r   ry   r  enterr  r+  rb   rZ   r@   r=   rp   rp   0  s    &K K 	K
 K K 'AK 
K 1!f E;,2,9M,Wk,	,r@   rp   c                      \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   SS jrSS jrSS jrSS jr	SS jr
SSS.S S jjrS!S jrSrg)"RealtimeConnectioni  r   RealtimeSessionResourcer   RealtimeResponseResourcer    RealtimeInputAudioBufferResourcer   RealtimeConversationResourcer   $RealtimeTranscriptionSessionResourcer   WebsocketConnectionr   c                    Xl         [        U 5      U l        [        U 5      U l        [        U 5      U l        [        U 5      U l        [        U 5      U l
        g r9   )r   r9  r   r:  r   r;  r   r<  r   r=  r   r   s     r=   ry   RealtimeConnection.__init__  sG    %.t406"B4"H8>%I$%O"r@   c              #  Z   #    SSK Jn    U R                  5       v   M  ! U a     gf = f7fr   r   r   s     r=   __iter__RealtimeConnection.__iter__  s4     
 	=	iik! ! 		s   + (+(+c                @    U R                  U R                  5       5      $ )r   r   r;   s    r=   r   RealtimeConnection.recv  s      122r@   c                d    U R                   R                  SS9n[        R                  SU5        U$ )r   Fr   r   r   r   s     r=   r   RealtimeConnection.recv_bytes  s1     ""''u'5		2W=r@   c                    [        U[        5      (       a  UR                  SSSS9O#[        R                  " [        U[        5      5      nU R                  R                  U5        g r   )	r   r
   r   r   r   r   r/   r   r   r   s      r=   r   RealtimeConnection.send  sU     %++ MMtSWMXOE3KLM 	
 	d#r@   r   r   r   c               6    U R                   R                  XS9  g r   r   r   s      r=   r   RealtimeConnection.close  s    D8r@   c           
     ~    [        [        [        [        R                  " U5      [        [
        [        5      S95      $ r   r   r   s     r=   r   RealtimeConnection.parse_event  r   r@   r   N)r   r>  r[   r   )r[   zIterator[RealtimeServerEvent]r   r   r   r   r   )r^   r_   r`   ra   r   r   ry   rB  r   r   r   r   r   rb   rZ   r@   r=   r8  r8    sT    D$$&&88..??$$P3
$ $(r 9
r@   r8  c                  l    \ rS rSrSr            S	S jrS
S jr\rSS jr        SS jr	Sr
g)rV   i  a  
Context manager over a `RealtimeConnection` that is returned by `beta.realtime.connect()`

This context manager ensures that the connection will be closed when it exits.

---

Note that if your application doesn't work well with the context manager approach then you
can call the `.enter()` method directly to initiate a connection.

**Warning**: You must remember to close the connection with `.close()`.

```py
connection = client.beta.realtime.connect(...).enter()
# ...
connection.close()
```
c               N    Xl         X l        S U l        X0l        X@l        XPl        g r9   )"_RealtimeConnectionManager__client!_RealtimeConnectionManager__model&_RealtimeConnectionManager__connection'_RealtimeConnectionManager__extra_query)_RealtimeConnectionManager__extra_headers8_RealtimeConnectionManager__websocket_connection_optionsr   s         r=   ry   "RealtimeConnectionManager.__init__  s(     7;(,.J+r@   c                    SSK Jn  U R                  nU R
                  R                  n[        U R
                  5      (       a)  U R
                  R                  U R                  U5      u  pTOMU R                  5       R                  0 U R
                  R                  R                  ESU R                  0EUES9n[        R                  SU5        U R                   (       a   [        R                  SU R                   5        [#        U" [%        U5      4U R
                  R&                  [)        0 UES	S
0EU R*                  5      S.U R                   D65      U l        U R,                  $ ! [         a  n[        S5      UeSnAff = f)u3  
👋 If your application doesn't work well with the context manager approach then you
can call this method directly to initiate a connection.

**Warning**: You must remember to close the connection with `.close()`.

```py
connection = client.beta.realtime.connect(...).enter()
# ...
connection.close()
```
r   r   r  NrU   r  r  r  r  r  r  )websockets.sync.clientrX   r  r    rS  rP  r  r   r  rQ  r  r  r  r  r5   r   rU  r8  r\   r  r!   rT  rR  r  s         r=   	__enter__#RealtimeConnectionManager.__enter__  sr   	d6 ((}}114==)) $ A A$,,P[ \C##%//mm,,33T\\ " 0 C 			$c*..II.0S0ST.C"&--":":#2&%} (($ 55
    E  	dYZ`cc	ds   E( (
F2E>>Fc                &   U R                   R                  b+  [        R                  " U R                   R                  5      nO#U R                   R                  R                  SS9nUR                  R                  S5      S-   nUR                  US9$ r  )rP  r  r  r   r!  r  r  r"  r#  s      r=   r  &RealtimeConnectionManager._prepare_url=  r&  r@   c                T    U R                   b  U R                   R                  5         g g r9   )rR  r   r(  s       r=   __exit__"RealtimeConnectionManager.__exit__F  s'     (##% )r@   r-  N)rT   r1   rU   r\   rO   r   rP   r   rQ   r+   r[   r   )r[   r8  r4  r5  )r^   r_   r`   ra   r   ry   rY  r6  r  r^  rb   rZ   r@   r=   rV   rV     s    &K K 	K
 K K 'AK 
K 1!f E;&2&9M&Wk&	&r@   rV   c                      \ rS rSrSS jrSrg)BaseRealtimeConnectionResourceiM  c                    Xl         g r9   r   r   s     r=   ry   'BaseRealtimeConnectionResource.__init__N      %r@   rc  N)r   r8  r[   r   r^   r_   r`   ra   ry   rb   rZ   r@   r=   ra  ra  M      &r@   ra  c                  &    \ rS rSr\S.SS jjrSrg)r9  iR  event_idc               n    U R                   R                  [        [        [	        SXS.5      5      5        gu  
Send this event to update the session’s default configuration.
The client may send this event at any time to update any field,
except for `voice`. However, note that once a session has been
initialized with a particular `model`, it can’t be changed to
another model using `session.update`.

When the server receives a `session.update`, it will respond
with a `session.updated` event showing the full, effective configuration.
Only the fields that are present are updated. To clear a field like
`instructions`, pass an empty string.
zsession.updatetyper   rj  Nr   r   r   r/   r   r<   r   rj  s      r=   updateRealtimeSessionResource.updateS  s1     	()9g de	
r@   rZ   Nr   z"session_update_event_param.Sessionrj  str | NotGivenr[   r   r^   r_   r`   ra   r   rq  rb   rZ   r@   r=   r9  r9  R  s    `i 
 
r@   r9  c                  F    \ rS rSr\\S.     SS jjr\\S.S	S jjrSrg)
r:  ih  rj  r   c               n    U R                   R                  [        [        [	        SXS.5      5      5        ga  
This event instructs the server to create a Response, which means triggering
model inference. When in Server VAD mode, the server will create Responses
automatically.

A Response will include at least one Item, and may have two, in which case
the second will be a function call. These Items will be appended to the
conversation history.

The server will respond with a `response.created` event, events for Items
and content created, and finally a `response.done` event to indicate the
Response is complete.

The `response.create` event includes inference configuration like
`instructions`, and `temperature`. These fields will override the Session's
configuration for this Response only.
zresponse.create)rn  rj  r   Nro  r<   rj  r   s      r=   createRealtimeResponseResource.createi  s1    . 	(): gh	
r@   rj  response_idc               n    U R                   R                  [        [        [	        SXS.5      5      5        gzSend this event to cancel an in-progress response.

The server will respond
with a `response.cancelled` event or an error if there is no response to
cancel.
zresponse.cancel)rn  rj  r~  Nro  r<   rj  r~  s      r=   cancelRealtimeResponseResource.cancel  s1     	(): mn	
r@   rZ   Nrj  rt  r   z/response_create_event_param.Response | NotGivenr[   r   rj  rt  r~  rt  r[   r   r^   r_   r`   ra   r   r{  r  rb   rZ   r@   r=   r:  r:  h  s@     $-DM	
 !
 B	

 

< 4=\e 
 
r@   r:  c                  J    \ rS rSr\S.SS jjr\S.SS jjr\S.S	S jjrSrg)
r;  i  ri  c          
     n    U R                   R                  [        [        [	        SUS.5      5      5        gz}Send this event to clear the audio bytes in the buffer.

The server will
respond with an `input_audio_buffer.cleared` event.
zinput_audio_buffer.clearrn  rj  Nro  r<   rj  s     r=   clear&RealtimeInputAudioBufferResource.clear  s/     	)?D^lt;u+vw	
r@   c          
     n    U R                   R                  [        [        [	        SUS.5      5      5        ga"  
Send this event to commit the user input audio buffer, which will create a
new user message item in the conversation. This event will produce an error
if the input audio buffer is empty. When in Server VAD mode, the client does
not need to send this event, the server will commit the audio buffer
automatically.

Committing the input audio buffer will trigger input audio transcription
(if enabled in session configuration), but it will not create a response
from the model. The server will respond with an `input_audio_buffer.committed`
event.
zinput_audio_buffer.commitr  Nro  r  s     r=   commit'RealtimeInputAudioBufferResource.commit  s/     	)?D_mu;v+wx	
r@   c               n    U R                   R                  [        [        [	        SXS.5      5      5        gaS  Send this event to append audio bytes to the input audio buffer.

The audio
buffer is temporary storage you can write to and later commit. In Server VAD
mode, the audio buffer is used to detect speech and the server will decide
when to commit. When Server VAD is disabled, you must commit the audio buffer
manually.

The client may choose how much audio to place in each event up to a maximum
of 15 MiB, for example streaming smaller chunks from the client may allow the
VAD to be more responsive. Unlike made other client events, the server will
not send a confirmation response to this event.
zinput_audio_buffer.append)rn  audiorj  Nro  r<   r  rj  s      r=   append'RealtimeInputAudioBufferResource.append  s1     	()Du kl	
r@   rZ   Nrj  rt  r[   r   r  r\   rj  rt  r[   r   	r^   r_   r`   ra   r   r  r  r  rb   rZ   r@   r=   r;  r;    s%    2; 
 4= 
" @I 
 
r@   r;  c                  (    \ rS rSr\SS j5       rSrg)r<  i  c                ,    [        U R                  5      $ r9   ) RealtimeConversationItemResourcer   r;   s    r=   item!RealtimeConversationResource.item  s    /0@0@AAr@   rZ   N)r[   r  r^   r_   r`   ra   r   r  rb   rZ   r@   r=   r<  r<    s    B Br@   r<  c                  ~    \ rS rSr\S.S
S jjr\\S.       SS jjr\S.         SS jjr\S.S
S jjrSr	g	)r  i  ri  c               n    U R                   R                  [        [        [	        SXS.5      5      5        ga  Send this event when you want to remove any item from the conversation
history.

The server will respond with a `conversation.item.deleted` event,
unless the item does not exist in the conversation history, in which case the
server will respond with an error.
zconversation.item.deletern  item_idrj  Nro  r<   r  rj  s      r=   delete'RealtimeConversationItemResource.delete  s2     	()CPW no	
r@   rj  previous_item_idc               r    U R                   R                  [        [        [	        SUUUS.5      5      5        ga  
Add a new Item to the Conversation's context, including messages, function
calls, and function call responses. This event can be used both to populate a
"history" of the conversation and to add new items mid-stream, but has the
current limitation that it cannot populate assistant audio messages.

If successful, the server will respond with a `conversation.item.created`
event, otherwise an `error` event will be sent.
zconversation.item.create)rn  r  rj  r  Nro  r<   r  rj  r  s       r=   r{  'RealtimeConversationItemResource.create  s<      	( : $$,,<	
	
r@   c               t    U R                   R                  [        [        [	        SUUUUS.5      5      5        gu4  Send this event to truncate a previous assistant message’s audio.

The server
will produce audio faster than realtime, so this event is useful when the user
interrupts to truncate audio that has already been sent to the client but not
yet played. This will synchronize the server's understanding of the audio with
the client's playback.

Truncating audio will delete the server-side text transcript to ensure there
is not text in the context that hasn't been heard by the user.

If successful, the server will respond with a `conversation.item.truncated`
event.
zconversation.item.truncate)rn  audio_end_mscontent_indexr  rj  Nro  r<   r  r  r  rj  s        r=   truncate)RealtimeConversationItemResource.truncate  s?    " 	( <(4)6#*$,	
r@   c               n    U R                   R                  [        [        [	        SXS.5      5      5        ga  
Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.
The server will respond with a `conversation.item.retrieved` event,
unless the item does not exist in the conversation history, in which case the
server will respond with an error.
zconversation.item.retriever  Nro  r  s      r=   retrieve)RealtimeConversationItemResource.retrieve  s2     	()ERY pq	
r@   rZ   Nr  r\   rj  rt  r[   r   r  r.   rj  rt  r  rt  r[   r   
r  r   r  r   r  r\   rj  rt  r[   r   
r^   r_   r`   ra   r   r  r{  r  r  rb   rZ   r@   r=   r  r    s    AJ 
& $-+4
 $
 !	

 )
 

> bk
"
36
AD
P^
	
@ DM 
 
r@   r  c                  0    \ rS rSr\S.     SS jjrSrg)r=  i+  ri  c               n    U R                   R                  [        [        [	        SXS.5      5      5        gz2Send this event to update a transcription session.ztranscription_session.updaterm  Nro  rp  s      r=   rq  +RealtimeTranscriptionSessionResource.update,  s2     	()GT[ rs	
r@   rZ   Nr   z*transcription_session_update_param.Sessionrj  rt  r[   r   ru  rZ   r@   r=   r=  r=  +  '    aj	
D	
P^	
		
 	
r@   r=  c                      \ rS rSrSS jrSrg)#BaseAsyncRealtimeConnectionResourcei8  c                    Xl         g r9   rc  r   s     r=   ry   ,BaseAsyncRealtimeConnectionResource.__init__9  re  r@   rc  N)r   r   r[   r   rf  rZ   r@   r=   r  r  8  rg  r@   r  c                  0    \ rS rSr\S.     SS jjrSrg)r   i=  ri  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7frl  ro  rp  s      r=   rq  #AsyncRealtimeSessionResource.update>  s>      ##()9g de
 	
 	
   9AAArZ   Nrs  ru  rZ   r@   r=   r   r   =  s'    Yb
<
HV
	
 
r@   r   c                  F    \ rS rSr\\S.     SS jjr\\S.S	S jjrSrg)
r   iU  rw  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fry  ro  rz  s      r=   r{  $AsyncRealtimeResponseResource.createV  s>     . ##(): gh
 	
 	
r  r}  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fr  ro  r  s      r=   r  $AsyncRealtimeResponseResource.cancelt  s>      ##(): mn
 	
 	
r  rZ   Nr  r  r  rZ   r@   r=   r   r   U  sA     $-DM	
 !
 B	

 

< :Cbk 
 
r@   r   c                  J    \ rS rSr\S.SS jjr\S.SS jjr\S.S	S jjrSrg)
r   i  ri  c          
        #    U R                   R                  [        [        [	        SUS.5      5      5      I Sh  vN   g N7fr  ro  r  s     r=   r  +AsyncRealtimeInputAudioBufferResource.clear  s<      ##)?D^lt;u+vw
 	
 	
r  c          
        #    U R                   R                  [        [        [	        SUS.5      5      5      I Sh  vN   g N7fr  ro  r  s     r=   r  ,AsyncRealtimeInputAudioBufferResource.commit  s<      ##)?D_mu;v+wx
 	
 	
r  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fr  ro  r  s      r=   r  ,AsyncRealtimeInputAudioBufferResource.append  s>      ##()Du kl
 	
 	
r  rZ   Nr  r  r  rZ   r@   r=   r   r     s&    8A 
 :C 
" FO 
 
r@   r   c                  (    \ rS rSr\SS j5       rSrg)r   i  c                ,    [        U R                  5      $ r9   )%AsyncRealtimeConversationItemResourcer   r;   s    r=   r  &AsyncRealtimeConversationResource.item  s    4T5E5EFFr@   rZ   N)r[   r  r  rZ   r@   r=   r   r     s    G Gr@   r   c                  ~    \ rS rSr\S.S
S jjr\\S.       SS jjr\S.         SS jjr\S.S
S jjrSr	g	)r  i  ri  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fr  ro  r  s      r=   r  ,AsyncRealtimeConversationItemResource.delete  s?      ##()CPW no
 	
 	
r  r  c                  #    U R                   R                  [        [        [	        SUUUS.5      5      5      I Sh  vN   g N7fr  ro  r  s       r=   r{  ,AsyncRealtimeConversationItemResource.create  sI       ##( : $$,,<	

 	
 	
s   ;AAAc                  #    U R                   R                  [        [        [	        SUUUUS.5      5      5      I Sh  vN   g N7fr  ro  r  s        r=   r  .AsyncRealtimeConversationItemResource.truncate  sL     " ##( <(4)6#*$,
 	
 	
s   <AAAc                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fr  ro  r  s      r=   r  .AsyncRealtimeConversationItemResource.retrieve	  s?      ##()ERY pq
 	
 	
r  rZ   Nr  r  r  r  rZ   r@   r=   r  r    s    GP 
& $-+4
 $
 !	

 )
 

> bk
"
36
AD
P^
	
@ JS 
 
r@   r  c                  0    \ rS rSr\S.     SS jjrSrg)r   i  ri  c                  #    U R                   R                  [        [        [	        SXS.5      5      5      I Sh  vN   g N7fr  ro  rp  s      r=   rq  0AsyncRealtimeTranscriptionSessionResource.update  s?      ##()GT[ rs
 	
 	
r  rZ   Nr  ru  rZ   r@   r=   r   r     r  r@   r   )g
__future__r   r   loggingtypesr   typingr   r   r   r   typing_extensionsr	   r  pydanticr
   r>   r   r   r   r   r   r   _typesr   r   r   r   _utilsr   r   r   r   r   _compatr   _modelsr   	_resourcer   r   _exceptionsr    _base_clientr!   types.beta.realtimer"   r#   r$   rB   r%   r&   r'   r(   r)   r*   "types.websocket_connection_optionsr+   )types.beta.realtime.realtime_client_eventr,   )types.beta.realtime.realtime_server_eventr-   +types.beta.realtime.conversation_item_paramr.   /types.beta.realtime.realtime_client_event_paramr/   rX  r0   r>  r  r   r:   r1   r2   __all__	getLoggerr^   r5   r   r3   r4   rF   rj   rK   rm   r   rp   r8  rV   ra  r9  r:  r;  r<  r  r=  r  r   r   r   r   r  r   rZ   r@   r=   <module>r     s   #    5 5 +    ; :  ( 0 ; ' , 
  N M M Q XNV/
'''1^ 15
 5
p5
$ 5
p
[ 
[
` 
`
a 
a
f 
fH
 H
Vf, f,RH
 H
Vf& f&R& &

< 
,+
= +
\/
'E /
dB#A BZ
'E Z
z

+I 

& &

#F 
0+
$G +
\/
,O /
dG(K GZ
,O Z
z

0S 

r@   