
    Cj
                     j    S SK JrJrJrJr  S SKrS SKr\(       a  S SKJr  S SK	J
r
Jr   " S S5      rg)    )TYPE_CHECKINGAnyOptionalUnionN)CustomStreamWrapper)ModelResponseTextCompletionResponsec                   2   \ rS rSr% Sr\\R                     \S'   S\	S\R                  SSS\S	\S
\S\	S\\\	4   S\S\S   4S jrS\	S\R                  SSS\S	\S
\S\	S\\\	4   S\S\S   4S jrS rS rS rS rS\\   4S jrS\4S jrS\4S jrSrg)BaseLLM   N_client_sessionmodelresponsemodel_responser   streamlogging_objoptional_paramsapi_keydatamessagesreturn)r   r   c                     U$ zN
Helper function to process the response across sync + async completion calls
 selfr   r   r   r   r   r   r   r   r   print_verboseencodings               c/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/litellm/llms/base.pyprocess_responseBaseLLM.process_response   
    "     r	   )r	   r   c                     U$ r   r   r   s               r    process_text_completion_response(BaseLLM.process_text_completion_response#   r"   r#   c                 ~    [         R                  (       a  [         R                  nU$ [        R                  " 5       nU$ N)litellmclient_sessionhttpxClient)r   r   s     r   create_client_sessionBaseLLM.create_client_session6   s1    !!%44O  $llnOr#   c                 ~    [         R                  (       a  [         R                  nU$ [        R                  " 5       nU$ r(   )r)   aclient_sessionr+   AsyncClient)r   _aclient_sessions     r   create_aclient_sessionBaseLLM.create_aclient_session>   s6    ""&66    %002r#   c                 x    [        U S5      (       a)  U R                  b  U R                  R                  5         g g g )Nr   )hasattrr   close)r   s    r   __exit__BaseLLM.__exit__F   s6    4*++0D0D0P  &&( 1Q+r#   c                 x   #    [        U S5      (       a#  U R                  R                  5       I S h  vN   g g  N7f)Nr2   )r6   r2   aclose)r   exc_typeexc_valexc_tbs       r   	__aexit__BaseLLM.__aexit__J   s3     4+,,''..000 -0s   /:8:c                     g r(   r   r   argskwargss      r   validate_environmentBaseLLM.validate_environmentN        r#   c                     g r(   r   rB   s      r   
completionBaseLLM.completionS   rG   r#   c                     g r(   r   rB   s      r   	embeddingBaseLLM.embeddingX   rG   r#   r   )__name__
__module____qualname____firstlineno__r   r   r+   r,   __annotations__strResponseboolr   dictr   listr    r%   r-   r3   r8   r?   rE   rI   rL   __static_attributes__r   r#   r   r   r      sH   .2OXell+2 .. (	
     D#I  
5	6& .. 1	
     D#I  
>	?& )1	#
	
	r#   r   )typingr   r   r   r   r+   r)   ,litellm.litellm_core_utils.streaming_handlerr   litellm.types.utilsr   r	   r   r   r#   r   <module>r\      s&    6 6  PIN Nr#   