
    Pi	                     >    d dl mZ d dlmZmZ  G d de          ZdS )    )List)MessagePromptTemplateInterfacec                   H    e Zd ZdZdddddZdee         dee         fdZdS )	MistralChatTemplatea  
    Formats according to Mistral's `instruct model
    <https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1#instruction-format>`_.

    It is identical to :class:`~torchtune.data.Llama2ChatTemplate`, except it does not support system
    prompts.

    Note:
        This template is only recommended for Mistral's Instruct-v0.1 and Instruct-v0.2 models.
        Instruct-v0.3 adds additional tags for tool calls, which is not yet supported by this
        template.

    .. code-block:: text

        "[INST] I am going to Paris, what should I see? [/INST] Paris, the capital
        of France, is known for its stunning architecture..."

    N)z[INST] z	 [/INST] ) r   )systemuser	assistantipythonmessagesreturnc           
      @   g }|D ]}|j         dk    rt          d          d| j        |j                  d         dg|j        z   d| j        |j                  d         dgz   }|                    t          |j         ||j        |j        |j                             |S )aS  
        Format user and system messages with appropriate tags.

        Args:
            messages (List[Message]): a single conversation, structured as a list
                of `Message` objects

        Returns:
            The formatted list of messages

        Raises:
            ValueError: If system prompts are provided
        r	   z7System prompts are not supported in MistralChatTemplatetextr   )typecontent   )roler   maskedr   eot)	r   
ValueErrortemplater   appendr   r   r   r   )selfr   formatted_dialoguemessager   s        }/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchtune/models/mistral/_prompt_template.py__call__zMistralChatTemplate.__call__&   s    "   	 	G|x'' M  
 %w|1LQ1OPPQo& &4=3Nq3QRRST 
 %% #">#O      "!    )__name__
__module____qualname____doc__r   r   r   r    r   r   r   r      sf         ( (	 H&"w-&" 
g&" &" &" &" &" &"r   r   N)typingr   torchtune.datar   r   r   r$   r   r   <module>r'      sp          ; ; ; ; ; ; ; ;A" A" A" A" A"1 A" A" A" A" A"r   