
    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 )
Llama2ChatTemplatea
  
    Prompt template that formats chat data of human and system prompts with appropriate tags
    used in Llama2 pre-training. Taken from Meta's official `Llama inference
    repository <https://github.com/meta-llama/llama/blob/main/llama/generation.py>`_.

    .. code-block:: text

        "[INST] <<SYS>>
        You are a helpful, respectful and honest assistant.
        <</SYS>>"

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


    )z<<SYS>>
z
<</SYS>>

)z[INST] z	 [/INST] ) r   )systemuser	assistantipythonmessagesreturnc           
         g }g }|D ]}|j         dk    r8d| j        d         d         dg|j        z   d| j        d         d         dgz   }E|j         dk    r;d| j        d         d         dg|z   |j        z   d| j        d         d         dgz   }n|j         dk    r|j        }|                    t	          |j         ||j        |j        |j                             |S )	a  
        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
        r	   textr   )typecontent   r
   r   )roler   maskedr   eot)r   templater   appendr   r   r   r   )selfr   system_messageformatted_dialoguemessager   s         |/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchtune/models/llama2/_prompt_template.py__call__zLlama2ChatTemplate.__call__#   s?     	 	G|x''$x1H1KLLMo& &4=3J13MNNOP  ''$v1Fq1IJJK$%o& !'4=3H3KLLMN  ,,!/%% #">#O      "!    N)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r      sf         " 2(	 H/"w-/" 
g/" /" /" /" /" /"r   r   N)typingr   torchtune.datar   r   r   r$   r   r   <module>r'      sp          ; ; ; ; ; ; ; ;G" G" G" G" G"0 G" G" G" G" G"r   