
    Mi`              >          S SK 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JrJr  S SKrS SKJr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJ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*  \(       a  S SK"J+r+  O\,r+S SK-7  S SK.J/r/  S SK0J1r1J2r2  \(       a  S SK3J4r5  O\r5SSK6J7r7  \" 5       r8\" 5       r9 SHS\,4S jjr:                       SIS\\,\&4   S\,S\\
\%      S\\,   S\\;   S\\#   S\\\,\4      S\\<   S\\,   S\\$   S \\<   S!\\<   S"\\<   S#\\=   S$\S%   S&\\)   S'\\	\*      S(\\=   S)\\S*      S+\\,   S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\(\74   44S2 jjr?\2                          SJS\\,\&4   S\,S\\
\%      S\\,   S\\;   S\\#   S\\\,\4      S\\<   S\\,   S\\$   S \\<   S!\\<   S"\\<   S#\\=   S$\S%   S3\\\S4   \@4      S&\\)   S'\\	\*      S(\\=   S)\\S*      S+\\,   S5\\,   S6\\,   S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\(\74   4:S7 jj5       rA\2                           SKS\\,\&4   S\,S\\
\%      S\\,   S\\;   S\\#   S\\\,\4      S\\<   S\\,   S\\$   S \\<   S!\\<   S"\\<   S#\\=   S$\S%   S3\\\S4   \@4      S&\\)   S'\\	\*      S(\\=   S)\\S*      S+\\,   S5\\,   S6\\,   S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S8\\
\,      S0\\,   4:S9 jj5       rB\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\C4S; jj5       rD\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\C\\\\C4   4   4S< jj5       rE\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\(4S= jj5       rF\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\(\\\\(4   4   4S> jj5       rG\2        SMS:\,S?\\,   S@\\,   S\\
\,      SA\;SB\SC   S,\\\,\4      S/\\\=\R|                  4      S0\\,   S1\4SD jj5       rH\2        SMS:\,S?\\,   S@\\,   S\\
\,      SA\;SB\SC   S,\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\\\\\4   4   4SE jj5       rI\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\(4SF jj5       rJ\2     SLS:\,S,\\\,\4      S-\\\,\4      S.\\\,\4      S/\\\=\R|                  4      S0\\,   S1\\(\\\\(4   4   4SG jj5       rKg)N    N)partial)
TYPE_CHECKINGAny	CoroutineDictIterableListLiteralOptionalTypeUnion)	BaseModel)verbose_logger)request_timeout)Logging)BaseResponsesAPIConfig)BaseLLMHTTPHandler)&LiteLLMCompletionTransformationHandler)ResponsesAPIRequestUtils)PromptObject	ReasoningResponseIncludableResponseInputParam!ResponsesAPIOptionalRequestParamsResponsesAPIResponse
ToolChoice	ToolParam)ResponseText)*)GenericLiteLLMParams)ProviderConfigManagerclient)Tool   )!BaseResponsesAPIStreamingIteratormock_responsec                     [        S,0 0 SS_SS_SS_SS_S	S _S
S _SS _SS _SS_SSSSSSU / S./S./_SS_SS _SS S S._SS_SS_SSS S00_S!S"_/ SS#S$S%S&0S'S(S&0S)S*.S 0 S+.ED6$ )-Nid5resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795bobjectresponse
created_atigstatus	completederrorincomplete_detailsinstructionsmax_output_tokensmodelzgpt-4.1-2025-04-14outputmessage4msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b	assistantoutput_text)typetextannotations)r9   r(   r-   rolecontentparallel_tool_callsTprevious_response_id	reasoning)effortsummarystoretemperatureg      ?r:   formatr9   tool_choiceautodisabled$   cached_tokensr   W   reasoning_tokens{   )input_tokensinput_tokens_detailsoutput_tokensoutput_tokens_detailstotal_tokens)toolstop_p
truncationusageusermetadata )r   r&   s    p/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/litellm/responses/main.pymock_responses_api_responser\   @   sU      .,
I,
j,
 *,
 k	,

 T,
 !$,
 D,
  ,
 ),
 %P)' %2$1+- ,
2 "43,
4 #D5,
6 DT:7,
8 T9,
: 3;,
< X/0=,
> 6?,
@ $ ")8!(<!#*<a)@ # W,
. .    inputr3   includer1   r2   promptrX   r>   r?   r@   rC   
backgroundstreamrD   r:   r   rF   rS   rT   rU   )rG   rH   rW   extra_headersextra_query
extra_bodytimeoutcustom_llm_providerreturnc                   #    SSK Jn  UR                  U5      u  nnUR                  S5      nUR	                  UUS9I Sh  vN u  nnUR                  U5      n U (       d  U(       a  U U-   OSn!0 SU_SU_SU_S	U_S
U_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_UUUUS.EUEn"U(       a_  U(       aX  SSKJn#  SSKJ	n$  SU#R                  5       R                  SS  3n%U$" UUU%US9I Sh  vN n&UR                  " S/U UU!UU&U"UUS.UD6$ [        U5      =(       a    UR                  US9n'UR                  U"U'S9n([!        S/U UU!US .U(D6I Sh  vN n)["        R$                  " S!U)5        U'(       Ga]  ['        U)[(        5      (       GaG  UR+                  U)S"9n*U*(       Ga0  UR                  S#0 5      R                  S5      nUR-                  UU*US$9I Sh  vN n+U+(       a  UR/                  U)U+U S%9n,UR1                  U"U=(       d    S&S'9n-/ n.U(       a  UR3                  U*U+S(9n.UR4                  " S/U,UU!U)R6                  S).U-D6I Sh  vN n/U(       a9  U.(       a2  [9        U/S*5      (       d  [9        U/S+5      (       a  SS,KJn0  U0" UU/U.S-9n/U/$ ['        U/[(        5      (       a,  UR	                  UUS9I Sh  vN u  n1n2UR=                  U/U1U+S.9n/U/$ U)$  GN GN GN GN N N*7f)0aa  
Async version of responses API with MCP integration.

When MCP tools with server_url="litellm_proxy" are provided, this function will:
1. Get available tools from the MCP server manager
2. Insert the tools into the messages/input
3. Call the standard responses API
4. If require_approval="never" and tool calls are returned, automatically execute them
r   LiteLLM_Proxy_MCP_Handleruser_api_key_auth)rl   mcp_tools_with_litellm_proxyNr_   r1   r2   r`   rX   r>   r@   rC   ra   rb   rD   r:   rF   rT   rU   rW   rc   )rd   re   rf   rg   )uuid)create_mcp_list_tools_eventsmcp_   )rm   rl   base_item_idpre_processed_mcp_tools)r^   r3   	all_toolsrm   mcp_discovery_eventscall_paramsr?   tool_server_map)rm   )rv   should_auto_execute)r^   r3   rS   r?   zInitial response %s)r+   litellm_metadata)rw   
tool_callsrl   )r+   tool_resultsoriginal_inputF)rv   original_stream_setting)rz   r{   )follow_up_inputr3   rt   response_id	__aiter____iter__)MCPEnhancedStreamingIterator)rw   base_iterator
mcp_events)r+   mcp_tools_fetchedr{   rY   )/litellm.responses.mcp.litellm_proxy_mcp_handlerrk   _parse_mcp_toolsget+_process_mcp_tools_without_openai_transform_transform_mcp_tools_to_openailitellm._uuidrn   ,litellm.responses.mcp.mcp_streaming_iteratorro   uuid4hex_create_mcp_streaming_responsebool_should_auto_execute_tools_prepare_initial_call_params
aresponsesr   debug
isinstancer   !_extract_tool_calls_from_response_execute_tool_calls_create_follow_up_input_prepare_follow_up_call_params_create_tool_execution_events_make_follow_up_callr(   hasattrr   $_add_mcp_output_elements_to_response)3r^   r3   r_   r1   r2   r`   rX   r>   r?   r@   rC   ra   rb   rD   r:   rF   rS   rT   rU   rW   rc   rd   re   rf   rg   kwargsrk   rm   other_toolsrl   original_mcp_toolsrw   openai_toolsrt   rv   rn   ro   rr   ru   rx   initial_call_paramsr+   rz   r{   r~   follow_up_call_paramstool_execution_eventsfinal_responser   mcp_tools_for_output_s3                                                      r[   aresponses_api_with_mcpr   t   s    P 	"2259$ 

#67 (SS+%A T  	
 -KKL
 0<{{*QUI7 	. 	&	
 	H 	2 	Y 	 	j 	& 	{ 	 	{ 	 	j  	!" 	#$ # 2+, -K4 .&	
 djjl..r234%A)E/%$6	&
  
 )GG 

)E!5#!5+

 

 
	
 $ 
#
>
>%A ?   4PP5H Q    1	
  H .9 z&    /PP Q 

  &

+=r B F F#! ";!N!N /%"3 "O " L ";"S"S%LQV #T # .LL$/SX M  & )+%1OO'1 P  * (A'U'U ($3' (	(
 ,( " -<<">:>> &B(7&4#8&N. &%!  0DEE
 8cc*;5Q d  , 2VV%3.B)5 W  # &%Oe	\ 
D26"Bsp   ?K*KB1K*3K4A#K*K BK*K#A2K*K&A,K*=K(>K*K* K*#K*&K*(K*text_formatr   service_tiersafety_identifierc           	      z  #    [        5       n [        R                  " 5       nSUS'   [        R                  " XS9nUb  UUS'   Uc*  [
        R                  " UUR                  SS5      S9u  nn  n[        [        40 SU _S	U_S
U_SU_SU_SU_SU_SU_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_S U_S!U_UD6n [        R                  " 5       n![        U!R                  U 5      n"UR                  SU"5      I Sh  vN n#[        R                  " U#5      (       a  U#I Sh  vN n$OU#n$[        U$[         5      (       a&  [        R"                  " U$UR                  S"0 5      US#9n$U$c  [%        S$U$ 35      eU$$  Nz NW! [&         a  n%[
        R(                  " UUU%UUS%9eSn%A%ff = f7f)&zK
Async: Handles responses API requests by reusing the synchronous function
Tr   r   r:   Nr:   base_url)r3   api_baser^   r3   r_   r1   r2   r`   rX   r>   r?   r@   rC   ra   rb   rD   rF   rS   rT   rU   rW   rc   rd   re   rf   rg   r   r   ry   responses_api_responsery   rg   z8Got an unexpected None response from the Responses API: r3   rg   original_exceptioncompletion_kwargsextra_kwargs)localsasyncioget_event_loopr   !convert_text_format_to_text_paramlitellmget_llm_providerr   r   	responsescontextvarscopy_contextrunrun_in_executoriscoroutiner   r   /_update_responses_api_response_id_with_model_id
ValueError	Exceptionexception_type)&r^   r3   r_   r1   r2   r`   rX   r>   r?   r@   rC   ra   rb   rD   r:   r   rF   rS   rT   rU   rW   r   r   rc   rd   re   rf   rg   r   
local_varsloopr   funcctxfunc_with_contextinit_responser+   es&                                         r[   r   r   b  s    L JP
%%'#| (II#
 !%Jv &+2+C+CjnnZ&F,(A"Aq 

 
 	

 &
 0
 
 
 !4
 "6
  
 
 "
 
 $
  !
" $#
$ %
& '
( ")
* +
, (-
. $/
0 "1
2 3
4 !45
6 &7
8 0;
@ &&(#CGGT2"2249JKK}--**H$H h 455/__'/!',>!C$7H J8*U  ) L +$  
$$ 3 (
 	

sN   F;DF F$F 7F8AF F;F F 
F8F33F88F;allowed_openai_paramsc                    [        5       nSSKJn   UR                  S5      n UR	                  SS5      n!UR                  SS5      SL n"[
        R                  " XS	9nUb  UUS
'   [        S20 UD6n#U#R                  (       a2  [        U#R                  [        5      (       a  [        U#R                  S9$ [        R                  " UUU#R                  U#R                  S9u  nnn$n%UR!                  US9(       aV  [#        S20 SU _SU_SU_SU_SU_SU_SU_SU_SU_SU	_SU
_SU_SU_SU_S
U_SU_SU_SU_SU_S U_S!U_S"U_S#U_S$U_S%U_UD6$ [$        R&                  " U[        R(                  " U5      S&9n&UR+                  U5        [
        R,                  " U5      n'U&c  [.        R0                  " S2UU U'UU"UUS'.UD6$ [
        R2                  " UU&U'US(9n(U R5                  UU[7        U(5      0 U(EU!US).EUS*9  [8        R1                  UU U&U(UU#U UUU=(       d    [:        U"UR	                  S+5      U&R=                  XUS,9UR	                  S-0 5      UR	                  S.5      S/9n)[        U)[>        5      (       a&  [
        R@                  " U)UR	                  S-0 5      US09n)U)$ ! [B         a  n*[        RD                  " UUU*UUS19eSn*A*ff = f)3z_
Synchronous version of the Responses API.
Uses the synchronous HTTP handler to make requests.
r   rj   litellm_logging_objlitellm_call_idNr   FTr   r:   rZ   )r3   rg   r   api_key)rS   r^   r3   r_   r1   r2   r`   rX   r>   r?   r@   rC   ra   rb   rD   rF   rS   rT   rU   rW   rc   rd   re   rf   rg   r3   provider)r3   r^   responses_api_requestrg   	_is_asyncrb   rc   )r3   responses_api_provider_configresponse_api_optional_paramsr   )r   rX   )r3   rW   optional_paramslitellm_paramsrg   r"   )r3   rb   rg   ry   shared_session)r3   r^   r   $response_api_optional_request_paramsrg   r   logging_objrc   re   rf   r   r"   fake_streamry   r   r   r   rY   )#r   r   rk   popr   r   r   r    r&   r   strr\   r   r   r   r   _should_use_litellm_mcp_gatewayr   r!   !get_provider_responses_api_configLlmProvidersupdate)get_requested_response_api_optional_param)litellm_completion_transformation_handlerresponse_api_handler!get_optional_params_responses_apiupdate_environment_variablesdictbase_llm_http_handlerr   should_fake_streamr   r   r   r   )+r^   r3   r_   r1   r2   r`   rX   r>   r?   r@   rC   ra   rb   rD   r:   r   rF   rS   rT   rU   rW   r   r   rc   rd   re   rf   r   rg   r   r   rk   r   r   r   r   dynamic_api_keydynamic_api_baser   r   responses_api_request_paramsr+   r   s+                                              r[   r   r     s   P J^
17<Q1R)/4Et)LJJ|U3t;	 (II#
 !%Jv .77
 ''J((#-
 -
 /,::  $$ 3#,,"**	
	
 %DD5DQ*    *	
 #4  " %8 &: $  &  (   (!" #$ %& &'( )* ,+, (-. &/0  12 %85 > "CC --.AB 	& 	&! %NN 	% )0<QQ 	&B$7#+	 	 	 %FF.K-I&;	 	% 	88 !=>.#2$
 !4 	9 
	
 )==*G1M 3)+'!.::h'5HH@S I  $ZZ(:B?!::&67# > 
* h 455/__'/!',>!C$7H  
$$ 3 (
 	

s-   B J 3BJ A0J >C J 
K)KKr   c           
      N  #    [        5       n [        R                  " 5       nSUS'   [        R                  " U S9n	U	R                  S5      =(       d    U n U	R                  S5      =(       d    Un[        [        4U UUUUUS.UD6n
[        R                  " 5       n[        UR                  U
5      nUR                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)	zn
Async version of the DELETE Responses API

DELETE /v1/responses/{response_id} endpoint in the responses API

Tadelete_responsesr   r   rg   r   rg   rc   rd   re   rf   Nr   )r   r   r   r   !_decode_responses_api_response_idr   r   delete_responsesr   r   r   r   r   r   r   r   r   rc   rd   re   rf   rg   r   r   r   decoded_response_idr   r   r   r   r+   r   s                   r[   r   r     F    & J*
%%'&*"# %FF' 	
 *--m<K##$9:Q>Q 	 	
# 3'#!	
 	
 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

Y   D%B9C; C7$C; ,C9-C; 2D%3C; 6D%7C; 9C; ;
D"DD""D%c                    [        5       n UR                  S5      nUR                  SS5      n	UR                  SS5      SL n
[        S0 UD6n[        R
                  " U S9nUR                  S5      =(       d    U n UR                  S	5      =(       d    UnUc  [        S
5      e[        R                  " S[        R                  " U5      S9nUc  [        SU 35      eUR                  U5        UR                  SSU 0SU	0US9  [        R                  U UUUUUUU=(       d    [        U
UR                  S5      UR                  S5      S9nU$ ! [          a  n[        R"                  " SUUUUS9eSnAff = f)zt
Synchronous version of the DELETE Responses API

DELETE /v1/responses/{response_id} endpoint in the responses API

r   r   Nr   FTr   r   rg   2custom_llm_provider is required but passed as Noner   z&DELETE responses is not supported for r3   r   r   rg   r"   r   r   rg   r   r   r   rc   re   rf   r   r"   r   r   rY   )r   r   r   r    r   r   r   r!   r   r   r   r   r   r   delete_response_api_handlerr   r   r   r   rc   rd   re   rf   rg   r   r   r   r   r   r   r   r   r+   r   s                   r[   r   r        & JH
17<Q1R)/4Et)LJJ2E:dB	 .77 %FF' 	
 *--m<K##$9:Q>Q 	 &QRR "CC --.AB 	& )089L8MN  	&! 	88{ "? !4 	9 		
 )DD# 3*G)+'!.::h'!::&67 E 
  
$$ 3 (
 	

   EE 
E6E11E6c           
        #    [        5       n [        R                  " 5       nSUS'   [        R                  " U S9n	U	R                  S5      =(       d    U n U	R                  S5      =(       d    Un[        [        4U UUUUUS.UD6n
[        R                  " 5       n[        UR                  U
5      nUR                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nOUn[        U[        5      (       a&  [        R                  " UUR                  S0 5      US	9nU$  Ni NF! [          a  n["        R$                  " SUUUUS
9eSnAff = f7f)aX  
Async: Fetch a response by its ID.

GET /v1/responses/{response_id} endpoint in the responses API

Args:
    response_id: The ID of the response to fetch.
    custom_llm_provider: Optional provider name. If not specified, will be decoded from response_id.

Returns:
    The response object with complete information about the stored response.
Taget_responsesr   r   rg   r   Nry   r   r   )r   r   r   r   r   r   r   get_responsesr   r   r   r   r   r   r   r   r   r   r   r   s                   r[   r  r  J  st    2 J2
%%'#'  %FF' 	
 *--m<K##$9:Q>Q 	 	
# 3'#!	
 	
 &&(#CGGT2"2249JKK}--**H$H h 455/__'/!',>!C$7H
  L +  
$$ 3 (
 	

sN   EB9D5 D1$D5 ,D3-AD5 0E1D5 3D5 5
E?EEEc                 h   [        5       n UR                  S5      nUR                  SS5      n	UR                  SS5      SL n
[        S0 UD6n[        R
                  " U S9nUR                  S5      =(       d    U n UR                  S	5      =(       d    UnUc  [        S
5      e[        R                  " S[        R                  " U5      S9nUc  [        SU 35      eUR                  U5        UR                  SSU 0SU	0US9  [        R                  U UUUUUUU=(       d    [        U
UR                  S5      UR                  S5      S9n[!        U["        5      (       a&  [        R$                  " UUR                  S0 5      US9nU$ ! [&         a  n[        R(                  " SUUUUS9eSnAff = f)aQ  
Fetch a response by its ID.

GET /v1/responses/{response_id} endpoint in the responses API

Args:
    response_id: The ID of the response to fetch.
    custom_llm_provider: Optional provider name. If not specified, will be decoded from response_id.

Returns:
    The response object with complete information about the stored response.
r   r   Nr  FTr   r   rg   r   r   z#GET responses is not supported for r   r"   r   r   ry   r   r   rY   )r   r   r   r    r   r   r   r!   r   r   r   r   r   r   r  r   r   r   r   r   r   r   s                   r[   r  r    s   2 JP
17<Q1R)/4Et)LJJ/74?	 .77 %FF' 	
 *--m<K##$9:Q>Q 	 &QRR "CC --.AB 	& )056I5JK  	&! 	88{ "? !4 	9 		
 )66# 3*G)+'!.::h'!::&67 7 
 h 455/__'/!',>!C$7H  
$$ 3 (
 	

s   E=F
 

F1F,,F1afterbeforelimitorder)ascdescc	                 T  #    [        5       n
 [        R                  " 5       nSU	S'   [        R                  " U S9nUR                  S5      =(       d    U n UR                  S5      =(       d    Un[        [        4U UUUUUUUUS.	U	D6n[        R                  " 5       n[        UR                  U5      nUR                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUU
U	S9eSnAff = f7f)	z&Async: List input items for a responseTalist_input_itemsr   r   rg   )	r   r  r  r_   r  r  rc   rf   rg   Nr   )r   r   r   r   r   r   r   list_input_itemsr   r   r   r   r   r   r   r   )r   r  r  r_   r  r  rc   rf   rg   r   r   r   r   r   r   r   r   r+   r   s                      r[   r  r    sO     J,
%%'&*"# %FF' 	
 *--m<K##$9:Q>Q 	 
#' 3
 
 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

sY   D(B<C> 
C:$C> /C<0C> 5D(6C> 9D(:C> <C> >
D%D  D%%D(c	                    [        5       n
 U	R                  S5      nU	R                  SS5      nU	R                  SS5      SL n[        S0 U	D6n[        R
                  " U S9nUR                  S5      =(       d    U n UR                  S	5      =(       d    UnUc  [        S
5      e[        R                  " S[        R                  " U5      S9nUc  [        SU 35      eU
R                  U	5        UR                  SSU 0SU0US9  [        R                  U UUUUUUUUUUU=(       d    [        UU	R                  S5      U	R                  S5      S9nU$ ! [          a  n[        R"                  " SUUU
U	S9eSnAff = f)zList input items for a responser   r   Nr  FTr   r   rg   r   r   z&list_input_items is not supported for r   r"   r   )r   rg   r   r   r   r  r  r_   r  r  rc   rf   r   r"   r   r   rY   )r   r   r   r    r   r   r   r!   r   r   r   r   r   r   list_responses_input_itemsr   r   r   )r   r  r  r_   r  r  rc   rf   rg   r   r   r   r   r   r   r   r   r+   r   s                      r[   r  r  D  s    JC
17<Q1R)/4Et)LJJ2E:dB	-77 %FF' 	
 *--m<K##$9:Q>Q 	 &QRR "CC --.AB 	& )089L8MN  	&!88*K8-? 3	 	9 	
 )CC# 3*G)+'.::h'!::&67 D 
$  
$$ 3 (
 	

s   EE 
E:E55E:c           
      N  #    [        5       n [        R                  " 5       nSUS'   [        R                  " U S9n	U	R                  S5      =(       d    U n U	R                  S5      =(       d    Un[        [        4U UUUUUS.UD6n
[        R                  " 5       n[        UR                  U
5      nUR                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)	zx
Async version of the POST Cancel Responses API

POST /v1/responses/{response_id}/cancel endpoint in the responses API

Tacancel_responsesr   r   rg   r   Nr   )r   r   r   r   r   r   r   cancel_responsesr   r   r   r   r   r   r   r   r   s                   r[   r  r    r   r   c                    [        5       n UR                  S5      nUR                  SS5      n	UR                  SS5      SL n
[        S0 UD6n[        R
                  " U S9nUR                  S5      =(       d    U n UR                  S	5      =(       d    UnUc  [        S
5      e[        R                  " S[        R                  " U5      S9nUc  [        SU 35      eUR                  U5        UR                  SSU 0SU	0US9  [        R                  U UUUUUUU=(       d    [        U
UR                  S5      UR                  S5      S9nU$ ! [          a  n[        R"                  " SUUUUS9eSnAff = f)zw
Synchronous version of the POST Responses API

POST /v1/responses/{response_id}/cancel endpoint in the responses API

r   r   Nr  FTr   r   rg   r   r   z&CANCEL responses is not supported for r   r"   r   r   r   rY   )r   r   r   r    r   r   r   r!   r   r   r   r   r   r   cancel_response_api_handlerr   r   r   r   s                   r[   r  r    r   r   )a  In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.)NNNNNNNNNNNNNNNNNNNNNNN)NNNNNNNNNNNNNNNNNNNNNNNNNN)NNNNNNNNNNNNNNNNNNNNNNNNNNN)NNNNN)NNN   r
  NNN)Lr   r   	functoolsr   typingr   r   r   r   r   r	   r
   r   r   r   httpxpydanticr   r   litellm._loggingr   litellm.constantsr   *litellm.litellm_core_utils.litellm_loggingr   LiteLLMLoggingObj.litellm.llms.base_llm.responses.transformationr   *litellm.llms.custom_httpx.llm_http_handlerr   ;litellm.responses.litellm_completion_transformation.handlerr   litellm.responses.utilsr   litellm.types.llms.openair   r   r   r   r   r   r   r   r   r   litellm.types.responses.mainlitellm.types.routerr    litellm.utilsr!   r"   	mcp.typesr#   MCPToolstreaming_iteratorr%   r   r   r\   intr   floatTimeoutr   r   r   r   DeleteResponseResultr   r   r  r  r  r  r  r  rY   r]   r[   <module>r-     s           + - S Q I =	 	 	 6L * 5 7)G A +, ,R,T )
 o11n 37"&'+%))-*.*.%) !%!#'%)(,+/!8< /3,0+/59)-9k(()kk d-./k 3-	k
  }k \"k tCH~&k "$k #3-k 	"k D>k k TNk %k >
"k  *%!k" HY'(#k$ E?%k& !345'k( 3-)k. DcN+/k0 $sCx.)1k2 c3h(3k4 eE5==0125k8 "#9k< !BBC=k\  37"&'+%))-*.*.%) !%!#'%)<@(,+/!8<"&'+ /3,0+/59)-?v
(()v
v
 d-./v
 3-	v

  }v
 \"v
 tCH~&v
 "$v
 #3-v
 	"v
 D>v
 v
 TNv
 %v
 >
"v
  %[ 14 789!v
" *%#v
$ HY'(%v
& E?'v
( !345)v
* 3-+v
, 3--v
.  }/v
4 DcN+5v
6 $sCx.)7v
8 c3h(9v
: eE5==012;v
> "#?v
B !BBCCv
 v
r  37"&'+%))-*.*.%) !%!#'%)<@(,+/!8<"&'+ /3,0+/5915)-AJ
(()J
J
 d-./J
 3-	J

  }J
 \"J
 tCH~&J
 "$J
 #3-J
 	"J
 D>J
 J
 TNJ
 %J
 >
"J
  %[ 14 789!J
" *%#J
$ HY'(%J
& E?'J
( !345)J
* 3-+J
, 3--J
.  }/J
4 DcN+5J
6 $sCx.)7J
8 c3h(9J
: eE5==012;J
> $DI.?J
@ "#AJ
 J
Z 
 /3,0+/59)-=
=
 DcN+	=

 $sCx.)=
 c3h(=
 eE5==012=
 "#=
 =
 =
@ 
 /3,0+/59)-[
[
 DcN+	[

 $sCx.)[
 c3h([
 eE5==012[
 "#[
 35I+I!JJK[
 [
| 
 /3,0+/59)-K
K
 DcN+	K

 $sCx.)K
 c3h(K
 eE5==012K
 "#K
 K
 K
\ 
 /3,0+/59)-i
i
 DcN+	i

 $sCx.)i
 c3h(i
 eE5==012i
 "#i
 35I+I!JJKi
 i
X    #'$*.259)-:
:
C=:
 SM:
 d3i 	:

 :
 =!:
 DcN+:
 eE5==012:
 "#:
 
:
 :
z    #'$*.259)-Q
Q
C=Q
 SMQ
 d3i 	Q

 Q
 =!Q
 DcN+Q
 eE5==012Q
 "#Q
 43T>**+Q
 Q
h 
 /3,0+/59)-=
=
 DcN+	=

 $sCx.)=
 c3h(=
 eE5==012=
 "#=
 =
 =
@ 
 /3,0+/59)-[
[
 DcN+	[

 $sCx.)[
 c3h([
 eE5==012[
 "#[
 35I+I!JJK[
 [
r]   