o
    ưi4                     @   sH   d 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
Support for OpenAI's `/v1/chat/completions` endpoint. 

Calls done in OpenAI/openai.py as TogetherAI is openai-compatible.

Docs: https://docs.together.ai/reference/completions-1
    )Optional)get_model_info)verbose_logger   )OpenAIGPTConfigc                
       sH   e Zd Zdedef fddZdededededef
 fdd	Z  Z	S )
TogetherAIConfigmodelreturnc              
      s   d}zt |dd}|dd}W n ty* } ztd|  W Y d}~nd}~ww t |}|durNtd |d	 |d
 |d |d |S )z
        Only some together models support response_format / tool calling

        Docs: https://docs.together.ai/docs/json-mode
        NZtogether_ai)Zcustom_llm_providersupports_function_callingFz'Error getting supported openai params: TzyOnly some together models support function calling/response_format. Docs - https://docs.together.ai/docs/function-callingZtoolsZtool_choiceZfunction_callresponse_format)r   get	Exceptionr   debugsuperget_supported_openai_paramsremove)selfr   r
   Z
model_infoeoptional_params	__class__ T/home/app/Keep/.python/lib/python3.10/site-packages/litellm/llms/together_ai/chat.pyr      s*   



z,TogetherAIConfig.get_supported_openai_paramsnon_default_paramsr   drop_paramsc                    s8   t  ||||}d|v r|d ddikr|d |S )Nr   typetext)r   map_openai_paramspop)r   r   r   r   r   Zmapped_openai_paramsr   r   r   r   -   s   

z"TogetherAIConfig.map_openai_params)
__name__
__module____qualname__strlistr   dictboolr   __classcell__r   r   r   r   r      s    r   N)
__doc__typingr   Zlitellm.utilsr   Zlitellm._loggingr   Zopenai.chat.gpt_transformationr   r   r   r   r   r   <module>   s    