
    g'                     `    d dl mZmZmZ d dlZd dlmZ  G d de      Zed   Zg dZ	de
fdZy)	    )LiteralOptionalUnionN)BaseLLMExceptionc            
       T     e Zd Z	 ddededeeeej                  f      f fdZ
 xZS )HuggingfaceErrorstatus_codemessageheadersc                 *    t         |   |||       y )N)r	   r
   r   )super__init__)selfr	   r
   r   	__class__s       Z/var/www/openai/venv/lib/python3.12/site-packages/litellm/llms/huggingface/common_utils.pyr   zHuggingfaceError.__init__	   s     	['7S    )N)__name__
__module____qualname__intstrr   r   dicthttpxHeadersr   __classcell__)r   s   @r   r   r      sF    
 9=	TT T %emm 345	T Tr   r   )ztext-generation-inferenceconversationalztext-classificationztext-generationgenerated_textc                     g d}|D ]k  }| j                         j                  |      r| j                  |dd      } | j                  |      sG| ddd   j                  |ddd   dd      ddd   } m | S )z
    Parse the output text to remove any special characters. In our current approach we just check for ChatML tokens.

    Initial issue that prompted this - https://github.com/BerriAI/litellm/issues/763
    )z<|assistant|>z
<|system|>z<|user|>z<s>z</s>    N)strip
startswithreplaceendswith)r   chat_template_tokenstokens      r   output_parserr(   !   s     V%!,,U3+33E2qAN""5)+DbD199%"+r1MdPRdSN	 &
 r   )typingr   r   r   r   )litellm.llms.base_llm.chat.transformationr   r   hf_taskshf_task_listr   r(    r   r   <module>r.      sD    + +  FT' T # r   