
    g	                         d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
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  G d de      Zy)z.
Handles the chat completion request for groq
    )CallableListOptionalUnioncast)Timeout)AsyncHTTPHandlerHTTPHandler)AllMessageValues)CustomStreamingDecoder)ModelResponse   )GroqChatConfig)OpenAILikeChatHandlerc                        e Zd Z fdZdddddddddd	dedededed	ed
edede	e   dede	e   de	e
eef      de	e
eef      de	e   de	e   def fdZ xZS )GroqChatCompletionc                 $    t        |   di | y )N )super__init__)selfkwargs	__class__s     S/var/www/openai/venv/lib/python3.12/site-packages/litellm/llms/groq/chat/handler.pyr   zGroqChatCompletion.__init__   s    "6"    NF)	acompletionlitellm_params	logger_fnheaderstimeoutclientcustom_endpointstreaming_decoderfake_streammodelmessagesapi_basecustom_llm_providercustom_prompt_dictmodel_responseprint_verboseapi_keyoptional_paramsr   r    r!   r"   r#   r$   c                   t               j                  t        t        t           |      |      }|j                  d      du rt               j                  |      }nd}t        | !  |||||||||	|
||||||||||      S )N)r&   r%   streamTF)r%   r&   r'   r(   r)   r*   r+   encodingr,   logging_objr-   r   r   r   r   r    r!   r"   r#   r$   )	r   _transform_messagesr   r   r   get_should_fake_streamr   
completion)r   r%   r&   r'   r(   r)   r*   r+   r0   r,   r1   r-   r   r   r   r   r    r!   r"   r#   r$   r   s                        r   r5   zGroqChatCompletion.completion   s    0 "#77$/0(;5 8 
 x(D0(*>>OKKw! 31)'#+#)+/#) " 
 	
r   )__name__
__module____qualname__r   strlistdictr   r   r   r   floatr   r
   r	   boolr   r5   __classcell__)r   s   @r   r   r      s    #" "&37AE*.>B!-6
 6
 	6

 6
 !6
 !6
 &6
  6
 #6
 6
" $#6
$ %w/0%6
& {,<<=>'6
( "$)6
* $$:;+6
, -6
 6
r   r   N)__doc__typingr   r   r   r   r   httpx._configr   &litellm.llms.custom_httpx.http_handlerr	   r
   litellm.types.llms.openair   litellm.types.utilsr   litellm.utilsr   groq.chat.transformationr   openai_like.chat.handlerr   r   r   r   r   <module>rH      s4    9 8 ! P 6 6 ' 6 =:
. :
r   