
    (hsy                       S SK Jr  S SK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JrJr  SSKJrJr  SS	KJr  SS
KJrJr  SSKJrJrJrJ r J!r!J"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,J-r-  SSK.J/r/  SSK0J1r1  SSK2J3r3  SSK4J5r5  SSK6J7r7  SS/r8 " S S\5      r9 " S S\5      r: " S S5      r; " S S5      r< " S S5      r= " S S 5      r>g)!    )annotations)ListUnionOptional)LiteralN   )_legacy_response)BodyOmitQueryHeadersNoneTypeNotGivenomit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)StreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_streamed_response_wrapper"async_to_streamed_response_wrapper#to_custom_streamed_response_wrapper)async_to_custom_streamed_response_wrapper)make_request_options)call_refer_paramscall_accept_paramscall_create_paramscall_reject_params)ResponsePromptParam)RealtimeTruncationParam)RealtimeAudioConfigParam)RealtimeToolsConfigParam)RealtimeTracingConfigParam)RealtimeToolChoiceConfigParam)!RealtimeSessionCreateRequestParamCalls
AsyncCallsc                  x   \ rS rSr\SS j5       r\SS j5       r\SSS\S.             SS jjr	\\\\\\\\\\\SSS\S.                                   SS jjr
SSS\S	.           SS
 jjrSSS\S	.             SS jjr\SSS\S.             SS jjrSrg)r)   )   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
)CallsWithRawResponseselfs    O/root/34ku/venv/lib/python3.13/site-packages/openai/resources/realtime/calls.pywith_raw_responseCalls.with_raw_response*   s     $D))    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
)CallsWithStreamingResponser0   s    r2   with_streaming_responseCalls.with_streaming_response4   s     *$//r5   Nsessionextra_headersextra_query
extra_bodytimeoutc                   SS0U=(       d    0 EnU R                  S[        UUS.[        R                  5      [	        X4XVS9[
        R                  S9$ )  
Create a new Realtime API call over WebRTC and receive the SDP answer needed to
complete the peer connection.

Args:
  sdp: WebRTC Session Description Protocol (SDP) offer generated by the caller.

  session: Realtime session object configuration.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
Acceptapplication/sdp/realtime/callssdpr<   r=   r>   r?   r@   bodyoptionscast_to)_postr   r    CallCreateParamsr   r	   HttpxBinaryResponseContentr1   rG   r<   r=   r>   r?   r@   s          r2   createCalls.create=   sk    : "#4N9L"Nzz & #33 )+Q[ %??  
 	
r5   audioincludeinstructionsmax_output_tokensmodeloutput_modalitiesprompttool_choicetoolstracing
truncationr=   r>   r?   r@   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        UUUUUUUU	U
UUUS.[        R                  5      [        XUUS9[        S9$ )	  
Accept an incoming SIP call and configure the realtime session that will handle
it.

Args:
  type: The type of session to create. Always `realtime` for the Realtime API.

  audio: Configuration for input and output audio.

  include: Additional fields to include in server outputs.

      `item.input_audio_transcription.logprobs`: Include logprobs for input audio
      transcription.

  instructions: The default system instructions (i.e. system message) prepended to model calls.
      This field allows the client to guide the model on desired responses. The model
      can be instructed on response content and format, (e.g. "be extremely succinct",
      "act friendly", "here are examples of good responses") and on audio behavior
      (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
      instructions are not guaranteed to be followed by the model, but they provide
      guidance to the model on the desired behavior.

      Note that the server sets default instructions which will be used if this field
      is not set and are visible in the `session.created` event at the start of the
      session.

  max_output_tokens: Maximum number of output tokens for a single assistant response, inclusive of
      tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
      `inf` for the maximum available tokens for a given model. Defaults to `inf`.

  model: The Realtime model used for this session.

  output_modalities: The set of modalities the model can respond with. It defaults to `["audio"]`,
      indicating that the model will respond with audio plus a transcript. `["text"]`
      can be used to make the model respond with text only. It is not possible to
      request both `text` and `audio` at the same time.

  prompt: Reference to a prompt template and its variables.
      [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).

  tool_choice: How the model chooses tools. Provide one of the string modes or force a specific
      function/MCP tool.

  tools: Tools available to the model.

  tracing: Realtime API can write session traces to the
      [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
      tracing is enabled for a session, the configuration cannot be modified.

      `auto` will create a trace for the session with default values for the workflow
      name, group id, and metadata.

  truncation: Controls how the realtime conversation is truncated prior to model inference.
      The default is `auto`.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
6Expected a non-empty value for `call_id` but received rC   */*/realtime/calls//accepttyperT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   rH   rI   )
ValueErrorrM   r   r   CallAcceptParamsr   r   r1   call_idrf   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r=   r>   r?   r@   s                     r2   acceptCalls.acceptj   s    N UV]U`abb!5B]-@bBzzwiw/  "&$0):"):$#."&", #33" )+Q[el -  
 	
r5   rH   c          
         U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        X#XES9[        S9$ )I  
End an active Realtime API call, whether it was initiated over SIP or WebRTC.

Args:
  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
ra   rC   rb   rc   /hanguprH   rK   rL   rg   rM   r   r   r1   rj   r=   r>   r?   r@   s         r2   hangupCalls.hangup   se    . UV]U`abb!5B]-@bBzzwiw/(+Q[   
 	
r5   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        SU0[        R                  5      [        X4XVS9[        S9$ )	  
Transfer an active SIP call to a new destination using the SIP REFER verb.

Args:
  target_uri: URI that should appear in the SIP Refer-To header. Supports values like
      `tel:+14155550123` or `sip:agent@example.com`.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
ra   rC   rb   rc   /refer
target_urirH   rI   )rg   rM   r   r   CallReferParamsr   r   r1   rj   rx   r=   r>   r?   r@   s          r2   referCalls.refer  s{    6 UV]U`abb!5B]-@bBzzwiv. ,
!;=N=^=^_(+Q[   
 	
r5   status_coder=   r>   r?   r@   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        SU0[        R                  5      [        X4XVS9[        S9$ )	  
Decline an incoming SIP call by returning a SIP status code to the caller.

Args:
  status_code: SIP response code to send back to the caller. Defaults to `603` (Decline) when
      omitted.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
ra   rC   rb   rc   /rejectr~   rH   rI   )rg   rM   r   r!   CallRejectParamsr   r   r1   rj   r~   r=   r>   r?   r@   s          r2   rejectCalls.reject6  s{    6 UV]U`abb!5B]-@bBzzwiw/ -!=?Q?b?bc(+Q[   
 	
r5    )returnr/   )r   r8   rG   strr<   z(RealtimeSessionCreateRequestParam | Omitr=   Headers | Noner>   Query | Noner?   Body | Noner@   'float | httpx.Timeout | None | NotGivenr   z+_legacy_response.HttpxBinaryResponseContent$rj   r   rf   zLiteral['realtime']rT   zRealtimeAudioConfigParam | OmitrU   z?List[Literal['item.input_audio_transcription.logprobs']] | OmitrV   z
str | OmitrW   z!Union[int, Literal['inf']] | OmitrX   a  Union[str, Literal['gpt-realtime', 'gpt-realtime-2025-08-28', 'gpt-4o-realtime-preview', 'gpt-4o-realtime-preview-2024-10-01', 'gpt-4o-realtime-preview-2024-12-17', 'gpt-4o-realtime-preview-2025-06-03', 'gpt-4o-mini-realtime-preview', 'gpt-4o-mini-realtime-preview-2024-12-17', 'gpt-realtime-mini', 'gpt-realtime-mini-2025-10-06', 'gpt-audio-mini', 'gpt-audio-mini-2025-10-06']] | OmitrY   z%List[Literal['text', 'audio']] | OmitrZ   z$Optional[ResponsePromptParam] | Omitr[   z$RealtimeToolChoiceConfigParam | Omitr\   zRealtimeToolsConfigParam | Omitr]   z+Optional[RealtimeTracingConfigParam] | Omitr^   zRealtimeTruncationParam | Omitr=   r   r>   r   r?   r   r@   r   r   Nonerj   r   r=   r   r>   r   r?   r   r@   r   r   r   rj   r   rx   r   r=   r   r>   r   r?   r   r@   r   r   r   rj   r   r~   z
int | Omitr=   r   r>   r   r?   r   r@   r   r   r   __name__
__module____qualname____firstlineno__r   r3   r9   r   r   rQ   rk   rs   r{   r   __static_attributes__r   r5   r2   r)   r)   )   s   * * 0 0 =A )-$("&;D+
 +
 :	+
 &+
 "+
  +
 9+
 
5+
d 26SW#'?C$ CG7;<@15?C59 )-$("&;DMA
A
 "	A

 /A
 QA
 !A
 =A
A
6 A7A
8 59A
: :;A
< /=A
> =?A
@ 3AA
F &GA
H "IA
J  KA
L 9MA
N 
OA
R )-$("&;D 
 
 & 
 " 
   
 9 
 
 
R )-$("&;D%
%
 	%
 &%
 "%
  %
 9%
 
%
V #' )-$("&;D%
%
  	%
 &%
 "%
  %
 9%
 
%
 %
r5   c                  x   \ rS rSr\SS j5       r\SS j5       r\SSS\S.             SS jjr	\\\\\\\\\\\SSS\S.                                   SS jjr
SSS\S	.           SS
 jjrSSS\S	.             SS jjr\SSS\S.             SS jjrSrg)r*   i^  c                    [        U 5      $ r.   )AsyncCallsWithRawResponser0   s    r2   r3   AsyncCalls.with_raw_response_  s     )..r5   c                    [        U 5      $ r7   )AsyncCallsWithStreamingResponser0   s    r2   r9   "AsyncCalls.with_streaming_responsei  s     /t44r5   Nr;   c                  #    SS0U=(       d    0 EnU R                  S[        UUS.[        R                  5      I Sh  vN [	        X4XVS9[
        R                  S9I Sh  vN $  N& N7f)rB   rC   rD   rE   rF   NrH   rI   )rM   r   r    rN   r   r	   rO   rP   s          r2   rQ   AsyncCalls.creater  s     : "#4N9L"NZZ,& #33  )+Q[ %??   
 
 	

s!   <A)A%
!A) A'!A)'A)rS   c                 #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        UUUUUUUU	U
UUUS.[        R                  5      I Sh  vN [        XUUS9[        S	9I Sh  vN $  N N7f)
r`   ra   rC   rb   rc   rd   re   NrH   rI   )rg   rM   r   r   rh   r   r   ri   s                     r2   rk   AsyncCalls.accept  s     N UV]U`abb!5B]-@bBZZwiw/, "&$0):"):$#."&", #33 " )+Q[el -   
 
 	

s$   A B"B 
#B;B<BBrH   c          
        #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        X#XES9[        S9I Sh  vN $  N7f)	rn   ra   rC   rb   rc   ro   rH   rp   Nrq   rr   s         r2   rs   AsyncCalls.hangup"  sr     . UV]U`abb!5B]-@bBZZwiw/(+Q[    
 
 	
 
s   A
AAAc                  #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        SU0[        R                  5      I Sh  vN [        X4XVS9[        S	9I Sh  vN $  N N7f)
rv   ra   rC   rb   rc   rw   rx   NrH   rI   )rg   rM   r   r   ry   r   r   rz   s          r2   r{   AsyncCalls.referD  s     6 UV]U`abb!5B]-@bBZZwiv.,lJ-GIZIjIjkk(+Q[    
 
 	
k
$   AA8A4
A8/A60A86A8r}   c                  #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        SU0[        R                  5      I Sh  vN [        X4XVS9[        S	9I Sh  vN $  N N7f)
r   ra   rC   rb   rc   r   r~   NrH   rI   )rg   rM   r   r!   r   r   r   r   s          r2   r   AsyncCalls.rejectk  s     6 UV]U`abb!5B]-@bBZZwiw/,m[-IK]KnKnoo(+Q[    
 
 	
o
r   r   )r   r   )r   r   r   r   r   r   r   r   r   r5   r2   r*   r*   ^  s   / / 5 5 =A )-$("&;D+
 +
 :	+
 &+
 "+
  +
 9+
 
5+
d 26SW#'?C$ CG7;<@15?C59 )-$("&;DMA
A
 "	A

 /A
 QA
 !A
 =A
A
6 A7A
8 59A
: :;A
< /=A
> =?A
@ 3AA
F &GA
H "IA
J  KA
L 9MA
N 
OA
R )-$("&;D 
 
 & 
 " 
   
 9 
 
 
R )-$("&;D%
%
 	%
 &%
 "%
  %
 9%
 
%
V #' )-$("&;D%
%
  	%
 &%
 "%
  %
 9%
 
%
 %
r5   c                      \ rS rSrSS jrSrg)r/   i  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g N)_callsr	   to_raw_response_wrapperrQ   rk   rs   r{   r   r1   callss     r2   __init__CallsWithRawResponse.__init__  s    &>>LL
 '>>LL
 '>>LL
 &==KK

 '>>LL
r5   r   rk   rQ   rs   r{   r   Nr   r)   r   r   r   r   r   r   r   r   r   r5   r2   r/   r/         
r5   r/   c                      \ rS rSrSS jrSrg)r   i  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r   )r   r	   async_to_raw_response_wrapperrQ   rk   rs   r{   r   r   s     r2   r   "AsyncCallsWithRawResponse.__init__  s    &DDLL
 'DDLL
 'DDLL
 &CCKK

 'DDLL
r5   r   Nr   r*   r   r   r   r   r5   r2   r   r     r   r5   r   c                      \ rS rSrSS jrSrg)r8   i  c                   Xl         [        UR                  [        5      U l        [	        UR
                  5      U l        [	        UR                  5      U l        [	        UR                  5      U l        [	        UR                  5      U l        g r   )	r   r   rQ   r   r   rk   rs   r{   r   r   s     r2   r   #CallsWithStreamingResponse.__init__  sq    9LL%
 3LL
 3LL
 2KK

 3LL
r5   r   Nr   r   r   r5   r2   r8   r8         
r5   r8   c                      \ rS rSrSS jrSrg)r   i  c                   Xl         [        UR                  [        5      U l        [	        UR
                  5      U l        [	        UR                  5      U l        [	        UR                  5      U l        [	        UR                  5      U l        g r   )	r   r   rQ   r   r   rk   rs   r{   r   r   s     r2   r   (AsyncCallsWithStreamingResponse.__init__  sq    ?LL*
 9LL
 9LL
 8KK

 9LL
r5   r   Nr   r   r   r5   r2   r   r     r   r5   r   )?
__future__r   typingr   r   r   typing_extensionsr   httpx r	   _typesr
   r   r   r   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   r   r   _base_clientr   types.realtimer   r   r    r!   %types.responses.response_prompt_paramr"   (types.realtime.realtime_truncation_paramr#   *types.realtime.realtime_audio_config_paramr$   *types.realtime.realtime_tools_config_paramr%   ,types.realtime.realtime_tracing_config_paramr&   0types.realtime.realtime_tool_choice_config_paramr'   4types.realtime.realtime_session_create_request_paramr(   __all__r)   r*   r/   r   r8   r   r   r5   r2   <module>r      s    # ( ( %    U U U < & :  1  I O R R V ] eL
!r
O r
j	r
! r
j	
 
*
 
*
 
,
 
r5   