o
    ưi	                     @   s   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 deZdS )z.
Handles the chat completion request for groq
    )CallableListOptionalUnioncast)Timeout)AsyncHTTPHandlerHTTPHandler)AllMessageValues)CustomStreamingDecoder)ModelResponse   )GroqChatConfig)OpenAILikeChatHandlerc                       s   e Zd Z fd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dZ  ZS )GroqChatCompletionc                    s   t  jdi | d S )N )super__init__)selfkwargs	__class__r   U/home/app/Keep/.python/lib/python3.10/site-packages/litellm/llms/groq/chat/handler.pyr      s   zGroqChatCompletion.__init__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                   s   t  jttt ||d}|ddu rt  |}nd}t jdi d|d|d|d|d	|d
|d|d|d|	d|
d|d|d|d|d|d|d|d|d|d|S )N)r#   r"   streamTFr"   r#   r$   r%   r&   r'   r(   encodingr)   logging_objr*   r   r   r   r   r   r   r   r    r!   r   )	r   Z_transform_messagesr   r   r
   getZ_should_fake_streamr   
completion)r   r"   r#   r$   r%   r&   r'   r(   r,   r)   r-   r*   r   r   r   r   r   r   r   r    r!   r   r   r   r/      s^   	
zGroqChatCompletion.completion)__name__
__module____qualname__r   strlistdictr   r   r   r   floatr   r	   r   boolr   r/   __classcell__r   r   r   r   r      sT    	r   N)__doc__typingr   r   r   r   r   Zhttpx._configr   Z&litellm.llms.custom_httpx.http_handlerr   r	   Zlitellm.types.llms.openair
   Zlitellm.types.utilsr   Zlitellm.utilsr   Zgroq.chat.transformationr   Zopenai_like.chat.handlerr   r   r   r   r   r   <module>   s    