
    j`              >          d dl Z d dlZd dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZ d dlZd dlmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dl m!Z! d dl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* erd dl"m+Z+ ne,Z+d dl- d dl.m/Z/ d dl0m1Z1m2Z2 erd dl3m4Z5 neZ5ddl6m7Z7  e       Z8 e       Z9	 dHde,fdZ:	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dIdee,e&f   de,dee
e%      dee,   dee;   dee#   deee,ef      dee<   dee,   dee$   d ee<   d!ee<   d"ee<   d#ee=   d$ed%   d&ee)   d'ee	e*      d(ee=   d)eed*      d+ee,   d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1ee(e7f   f4d2Z?e2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dJdee,e&f   de,dee
e%      dee,   dee;   dee#   deee,ef      dee<   dee,   dee$   d ee<   d!ee<   d"ee<   d#ee=   d$ed%   d3eeed4   e@f      d&ee)   d'ee	e*      d(ee=   d)eed*      d+ee,   d5ee,   d6ee,   d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1ee(e7f   f:d7       ZAe2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dKdee,e&f   de,dee
e%      dee,   dee;   dee#   deee,ef      dee<   dee,   dee$   d ee<   d!ee<   d"ee<   d#ee=   d$ed%   d3eeed4   e@f      d&ee)   d'ee	e*      d(ee=   d)eed*      d+ee,   d5ee,   d6ee,   d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d8ee
e,      d0ee,   f:d9       ZBe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1eCfd;       ZDe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1eeCeeeeCf   f   fd<       ZEe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1e(fd=       ZFe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1ee(eeee(f   f   fd>       ZGe2	 	 	 	 	 	 	 	 dMd:e,d?ee,   d@ee,   dee
e,      dAe;dBedC   d,eee,ef      d/eee=ej|                  f      d0ee,   d1efdD       ZHe2	 	 	 	 	 	 	 	 dMd:e,d?ee,   d@ee,   dee
e,      dAe;dBedC   d,eee,ef      d/eee=ej|                  f      d0ee,   d1eeeeeef   f   fdE       ZIe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1e(fdF       ZJe2	 	 	 	 	 dLd:e,d,eee,ef      d-eee,ef      d.eee,ef      d/eee=ej|                  f      d0ee,   d1ee(eeee(f   f   fdG       ZKy)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                     t        d,i i ddddddddd	d d
d dd dd dddddddd| g dgdgdddd dd d dddddddd diid!d"g dd#d$d%d&id'd(d&id)d*d i d+S )-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    o/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/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                 |  K   ddl m} |j                  |      \  }}|j                  d      }|j	                  ||       d{   \  }}|j                  |      } | s|r| |z   nd}!i d|d|d|d	|d
|d|d|	d|
d|d|d|d|d|d|d|d|d|||||d|}"|r]|r[ddlm}# ddlm	}$ d|#j                         j                  dd  }% |$|||%|       d{   }& |j                  d/| ||!||&|"||d|S t        |      xr |j                  |      }'|j                  |"|'      }(t!        d/| ||!|d |( d{   })t#        j$                  d!|)       |'rCt'        |)t(              r2|j+                  |)"      }*|*r|j                  d#i       j                  d      }|j-                  ||*|$       d{   }+|+r|j/                  |)|+| %      },|j1                  |"|xs d&'      }-g }.|r|j3                  |*|+(      }. |j4                  d/|,||!|)j6                  d)|- d{   }/|r-|.r+t9        |/d*      st9        |/d+      rdd,lm}0  |0||/|.-      }/|/S t'        |/t(              r2|j	                  ||       d{   \  }1}2|j=                  |/|1|+.      }/|/S |)S 7 i7 7 i7 7 7 ,w)0a}  
    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	&
  
 H(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  * (V'@'U'U ($3' (	(
 ,( " -<">:> &B(7&4#8&N. &%!  0DE
 8cc*;5Q d  , 2VV%3.B)5 W  # &%Oe	\ 
D26"Bsq   AJ<J-B J<%J0&A$J<
J3A;J<J6A,J<3J84AJ<J: J<0J<3J<6J<8J<:J<text_formatr   service_tiersafety_identifierc                 j  K   t               }	 t        j                         }d|d<   t        j                  ||      }|||d<   |,t        j                  ||j                  dd            \  }}}}t        t        fi d| d	|d
|d|d|d|d|d|d|d|	d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d |d!||} t        j                         }!t        |!j                  |       }"|j                  d|"       d{   }#t        j                  |#      r|# d{   }$n|#}$t        |$t               r(t        j"                  |$|j                  d"i       |#      }$|$t%        d$|$       |$S 7 p7 S# t&        $ r}%t        j(                  |||%||%      d}%~%ww xY ww)&zS
    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/__'/!',>!C$7H J8*U  ) L +$  
$$ 3 (
 	

sN   F3DF FF 2F3AF F3F F 	F0F++F00F3allowed_openai_paramsc                    t               }ddlm} 	 |j                  d      } |j	                  dd      }!|j                  dd      du }"t        j                  ||	      }|||d
<   t        d2i |}#|#j                  r0t        |#j                  t              rt        |#j                        S t        j                  |||#j                  |#j                        \  }}}$}%|j!                  |      rVt#        d2i d| d|d|d|d|d|d|d|d|d|	d|
d|d|d|d
|d|d|d|d|d |d!|d"|d#|d$|d%||S t%        j&                  |t        j(                  |      &      }&|j+                  |       t        j,                  |      }'|&t/        j0                  d2|| |'||"||d'|S t        j2                  ||&|'|(      }(| j5                  ||t7        |(      i |(|!|d)|*       t8        j1                  || |&|(||#| |||xs t:        |"|j	                  d+      |&j=                  |||,      |j	                  d-i       |j	                  d.      /      })t        |)t>              r(t        j@                  |)|j	                  d-i       |0      })|)S # tB        $ r}*t        jD                  |||*||1      d}*~*ww xY w)3zk
    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F@S I  $ZZ(:B?!::&67# > 
* h 45/__'/!',>!C$7H  
$$ 3 (
 	

s-   BJ .BJ A.J 7C$J 	K%J??Kr   c           
      0  K   t               }	 t        j                         }d|d<   t        j                  |       }	|	j                  d      xs | } |	j                  d      xs |}t        t        f| |||||d|}
t        j                         }t        |j                  |
      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)	zz
    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     E    & J*
%%'&*"# %FF' 	
 *--m<K##$9:Q>Q 	 	
# 3'#!	
 	
 &&(#CGGT2"2249JKK}-**H  %H L +  
$$ 3 (
 	

Y   DB/C+ =C'>C+ C)C+ "D#C+ &D'C+ )C+ +	D4DDDc                    t               }	 |j                  d      }|j                  dd      }	|j                  dd      du }
t        di |}t	        j
                  |       }|j                  d      xs | } |j                  d	      xs |}|t        d
      t        j                  dt        j                  |            }|t        d|       |j                  |       |j                  dd| id|	i|       t        j                  | |||||||xs t        |
|j                  d      |j                  d            }|S # t         $ r}t        j"                  d||||      d}~ww xY w)z
    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 (
 	

   D:E 	E/E**E/c           
        K   t               }	 t        j                         }d|d<   t        j                  |       }	|	j                  d      xs | } |	j                  d      xs |}t        t        f| |||||d|}
t        j                         }t        |j                  |
      }|j                  d|       d{   }t        j                  |      r| d{   }n|}t        |t              r(t        j                  ||j                  di       |	      }|S 7 `7 C# t         $ r}t#        j$                  d||||
      d}~ww xY ww)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  sp    2 J2
%%'#'  %FF' 	
 *--m<K##$9:Q>Q 	 	
# 3'#!	
 	
 &&(#CGGT2"2249JKK}-**H$H h 45/__'/!',>!C$7H
  L +  
$$ 3 (
 	

sN   EB/D" =D>D" D A D" ED"  D" "	E
+EE

Ec                 T   t               }	 |j                  d      }|j                  dd      }	|j                  dd      du }
t        di |}t	        j
                  |       }|j                  d      xs | } |j                  d	      xs |}|t        d
      t        j                  dt        j                  |            }|t        d|       |j                  |       |j                  dd| id|	i|       t        j                  | |||||||xs t        |
|j                  d      |j                  d            }t!        |t"              r(t	        j$                  ||j                  di       |      }|S # t&        $ r}t        j(                  d||||      d}~ww xY w)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/__'/!',>!C$7H  
$$ 3 (
 	

s   E2E? ?	F'F""F'afterbeforelimitorder)ascdescc	                 6  K   t               }
	 t        j                         }d|	d<   t        j                  |       }|j                  d      xs | } |j                  d      xs |}t        t        f| ||||||||d	|	}t        j                         }t        |j                  |      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d|||
|	      d}~ww xY ww)	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    sN     J,
%%'&*"# %FF' 	
 *--m<K##$9:Q>Q 	 
#' 3
 
 &&(#CGGT2"2249JKK}-**H  %H L +  
$$ 3 (
 	

sY   DB2C.  C*C. C, C. %D&C. )D*C. ,C. .	D7DDDc	                    t               }
	 |	j                  d      }|	j                  dd      }|	j                  dd      du }t        di |	}t	        j
                  |       }|j                  d      xs | } |j                  d	      xs |}|t        d
      t        j                  dt        j                  |            }|t        d|       |
j                  |	       |j                  dd| id|i|       t        j                  | |||||||||||xs t        ||	j                  d      |	j                  d            }|S # t         $ r}t        j"                  d|||
|	      d}~ww xY w)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   D>E 	E3E..E3c           
      0  K   t               }	 t        j                         }d|d<   t        j                  |       }	|	j                  d      xs | } |	j                  d      xs |}t        t        f| |||||d|}
t        j                         }t        |j                  |
      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)	z
    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                    t               }	 |j                  d      }|j                  dd      }	|j                  dd      du }
t        di |}t	        j
                  |       }|j                  d      xs | } |j                  d	      xs |}|t        d
      t        j                  dt        j                  |            }|t        d|       |j                  |       |j                  dd| id|	i|       t        j                  | |||||||xs t        |
|j                  d      |j                  d            }|S # t         $ r}t        j"                  d||||      d}~ww xY w)z
    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]   