
    ^h;                         S r SSKJrJrJrJrJrJr  SSK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   " S	 S
\5      r " S S\5      rS\S\\   S\4S jrg)z:
- completion
- acompletion
- streaming
- async_streaming
    )AnyAsyncIteratorCallableIteratorOptionalUnionN)AsyncHTTPHandlerHTTPHandler)GenericStreamingChunk)ImageResponseModelResponse   )BaseLLMc                   (   ^  \ rS rSrU 4S jrSrU =r$ )CustomLLMError   c                 P   > Xl         X l        [        TU ]  U R                  5        g N)status_codemessagesuper__init__)selfr   r   	__class__s      Q/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/custom_llm.pyr   CustomLLMError.__init__   s$    
 'LL	
    )r   r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r      s    	
 	
r   r   c                     ^  \ rS rSrSU 4S jjrSSS0 SS4S\S\S\S\S	\S
\	S\S\
\\\R                  4      S\
\   S\4S jjrSSS0 SS4S\S\S\S\S	\S
\	S\S\
\\\R                  4      S\
\   S\\   4S jjrSSS0 SS4S\S\S\S\S	\S
\	S\S\
\\\R                  4      S\
\   S\4S jjrSSS0 SS4S\S\S\S\S	\S
\	S\S\
\\\R                  4      S\
\   S\\   4S jjr  SS\S\S\
\   S\
\   S	\S\S\S\
\\\R                  4      S\
\   S\4S jjr  SS\S\S	\S\
\   S\
\   S\S\S\
\\\R                  4      S\
\   S\4S jjrSrU =r$ )	CustomLLM#   returnNc                 "   > [         TU ]  5         g r   )r   r   )r   r   s    r   r   CustomLLM.__init__$   s    r   modelmessagesapi_basecustom_prompt_dictmodel_responseprint_verboseoptional_paramstimeoutclientc                     [        SSS9eNi  zNot implemented yet!)r   r   r   r   r+   r,   r-   r.   r/   r0   encodingapi_keylogging_objr1   acompletionlitellm_params	logger_fnheadersr2   r3   s                    r   
completionCustomLLM.completion'       & 6LMMr   c                     [        SSS9er5   r6   r7   s                    r   	streamingCustomLLM.streaming<   rA   r   c                    #    [        SSS9e7fr5   r6   r7   s                    r   r;   CustomLLM.acompletionQ        & 6LMM   c                    #    [        SSS9e7fr5   r6   r7   s                    r   
astreamingCustomLLM.astreamingf   rG   rH   promptr9   r:   c
                     [        SSS9er5   r6   )
r   r+   rL   r9   r-   r/   r1   r:   r2   r3   s
             r   image_generationCustomLLM.image_generation{   s     6LMMr   c
                    #    [        SSS9e7fr5   r6   )
r   r+   rL   r/   r9   r-   r1   r:   r2   r3   s
             r   aimage_generationCustomLLM.aimage_generation   s       6LMMrH    )r(   N)NN)r   r   r    r!   r   strlistdictr   r   r   r   floathttpxTimeoutr
   r?   r   r   rC   r	   r;   r   rJ   r   r   rN   rQ   r"   r#   r$   s   @r   r&   r&   #   s    9=(,#NN N 	N
 !N &N  N N  %u}} 456!N" %#N$ 
%NB 9=(,#NN N 	N
 !N &N  N N  %u}} 456!N" %#N$ 
'	(%NB 9=-1#NN N 	N
 !N &N  N N  %u}} 456!N" )*#N$ 
%NB 9=-1#NN N 	N
 !N &N  N N  %u}} 456!N" )*#N$ 
,	-%N< :>(,NN N #	N
 3-N &N N N %u}} 456N %N 
N6 :>-1NN N &	N
 
N 
N N N %u}} 456N )*N 
N Nr   r&   async_fnstream
custom_llmc                     U (       a  U(       a  UR                   $ UR                  $ U(       a  UR                  $ UR                  $ )z
Routes call to CustomLLM completion/acompletion/streaming/astreaming functions, based on call type

Validates if response is in expected format
)rJ   r;   rC   r?   )rZ   r[   r\   s      r   custom_chat_llm_routerr^      s=     (((%%%###   r   )__doc__typingr   r   r   r   r   r   rX   &litellm.llms.custom_httpx.http_handlerr	   r
   litellm.types.utilsr   litellm.utilsr   r   baser   	Exceptionr   r&   boolr^   rS   r   r   <module>rg      s`    K J  P 5 6 

Y 

vN vNr!!$TN!8A!r   