ó
    Ù^íh'  ã                   ób   • S SK JrJrJr  S SKrS SKJr   " S S\5      r\S   r/ SQr	S\
4S jrg)	é    )ÚLiteralÚOptionalÚUnionN)ÚBaseLLMExceptionc            
       ób   ^ • \ rS rSr SS\S\S\\\\	R                  4      4U 4S jjjrSrU =r$ )ÚHuggingfaceErroré   Ústatus_codeÚmessageÚheadersc                 ó"   >• [         TU ]  XUS9  g )N)r
   r   r   )ÚsuperÚ__init__)Úselfr
   r   r   Ú	__class__s       €Ú_/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/huggingface/common_utils.pyr   ÚHuggingfaceError.__init__	   s   ø€ ô 	‰Ñ [È7ÐÒSó    © )N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚintÚstrr   r   ÚdictÚhttpxÚHeadersr   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      sF   ø† ð
 9=ñ	TàðTð ðTð ˜%  e§m¡mÐ 3Ñ4Ñ5÷	Tö Tr   r   )ztext-generation-inferenceÚconversationalztext-classificationztext-generationÚgenerated_textc                 ó  • / SQnU Hw  nU R                  5       R                  U5      (       a  U R                  USS5      n U R                  U5      (       d  MR  U SSS2   R                  USSS2   SS5      SSS2   n My     U $ )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Ø+×3Ñ3°E¸2¸qÓAˆNØ×"Ñ" 5×)Ó)Ø+©D¨b¨DÑ1×9Ñ9¸%ÁÀ"À¹+ÀrÈ1ÓMÉdÐPRÈdÑSŠNñ	 &ð
 Ðr   )Útypingr   r   r   r   Ú)litellm.llms.base_llm.chat.transformationr   r   Úhf_tasksÚhf_task_listr   r-   r   r   r   Ú<module>r2      sD   ðß +Ñ +ã å FôTÐ'ô Tð ðñ€ò€ð #õ r   