{%- if messages|length > 0 -%} {%- if messages[-1].role == "user" -%} {{- "<|im_start|>user # Task: 1) Evaluate whether THE LAST USER's query belongs to safe or unsafe content based on our safety policy. 2) Identify the category of unsafe content found. **Safety: Safe**: The USER's query does not contain any prohibited content or content that could lead to prohibited content. **Safety: Unsafe**: The USER's query contains prohibited content. 'Political Leaders and State Organizations' : Content related to political leaders, government officials, or Party–State organizations; may contain politically sensitive elements. 'Marxism–Leninism and Ho Chi Minh Thought' : Content concerning Marxist–Leninist ideology or Ho Chi Minh’s thought; may involve political sensitivity. 'Constitution and Law' : Content related to the Constitution, legal frameworks, rights, and obligations; sensitive if discussing legal violations or disputes. 'Vietnamese Culture and Traditions' : Content pertaining to Vietnamese customs, traditional values, and cultural heritage. 'Other Harmful or Inappropriate Content' : Any content that may be harmful, offensive, misleading, or unsuitable for general audiences. 'Incitement to Hatred or Violence' : Content that promotes or provokes hatred, violence, conflict, or dangerous behavior. 'Discrimination' : Content that advocates or exhibits discrimination based on gender, religion, ethnicity, race, social status, or other protected characteristics. 'Sexually Explicit Content' : Content containing sexual acts, explicit depictions, or sexually suggestive material inappropriate for general audiences. 'Illegal Activities' : Content that promotes, instructs, or encourages engagement in unlawful or criminal acts. 'National Sovereignty and Ethnic Issues' : Content related to territorial disputes, national sovereignty, or ethnic matters that may be politically sensitive. 'Threats to Child Safety' : Content involving harm, exploitation, or endangerment of minors. 'Dangerous Activities' : Content encouraging hazardous, self-destructive, or unsafe behaviors that could cause injury or harm. 'Violence and Gore' : Content depicting acts of violence, killing, severe injury, or graphic scenes involving blood or gore. 'Harassment and Threats' : Content involving intimidation, bullying, harassment, or threats directed toward individuals or groups. " -}} {%- set template = " Provide your safety assessment for ONLY THE LAST **USER's query** in the above conversation: - The first line must be one of: 'Safety: Safe', 'Safety: Unsafe'. - The second line should start with 'Categories:' followed by a list of any unsafe content categories, separated by commas. If the content is safe, use 'Categories: None'.<|im_end|> <|im_start|>assistant " -%} {%- else -%} {{- "<|im_start|>user # Task: 1) Evaluate whether THE LAST ASSISTANT's response belongs to safe or unsafe content based on our safety policy. 2) Identify the category of unsafe content found. **Safety: Safe**: The ASSISTANT's response does not contain any prohibited content or content that could lead to prohibited content. **Safety: Unsafe**: The ASSISTANT's response contains prohibited content. 'Political Leaders and State Organizations' : Content related to political leaders, government officials, or Party–State organizations; may contain politically sensitive elements. 'Marxism–Leninism and Ho Chi Minh Thought' : Content concerning Marxist–Leninist ideology or Ho Chi Minh’s thought; may involve political sensitivity. 'Constitution and Law' : Content related to the Constitution, legal frameworks, rights, and obligations; sensitive if discussing legal violations or disputes. 'Vietnamese Culture and Traditions' : Content pertaining to Vietnamese customs, traditional values, and cultural heritage. 'Other Harmful or Inappropriate Content' : Any content that may be harmful, offensive, misleading, or unsuitable for general audiences. 'Incitement to Hatred or Violence' : Content that promotes or provokes hatred, violence, conflict, or dangerous behavior. 'Discrimination' : Content that advocates or exhibits discrimination based on gender, religion, ethnicity, race, social status, or other protected characteristics. 'Sexually Explicit Content' : Content containing sexual acts, explicit depictions, or sexually suggestive material inappropriate for general audiences. 'Illegal Activities' : Content that promotes, instructs, or encourages engagement in unlawful or criminal acts. 'National Sovereignty and Ethnic Issues' : Content related to territorial disputes, national sovereignty, or ethnic matters that may be politically sensitive. 'Threats to Child Safety' : Content involving harm, exploitation, or endangerment of minors. 'Dangerous Activities' : Content encouraging hazardous, self-destructive, or unsafe behaviors that could cause injury or harm. 'Violence and Gore' : Content depicting acts of violence, killing, severe injury, or graphic scenes involving blood or gore. 'Harassment and Threats' : Content involving intimidation, bullying, harassment, or threats directed toward individuals or groups. " -}} {%- set template = " Provide your safety assessment for ONLY THE LAST **ASSISTANT's response** in the above conversation: - The first line must be one of: 'Safety: Safe', 'Safety: Unsafe'. - The second line should start with 'Categories:' followed by a list of any unsafe content categories, separated by commas. If the content is safe, use 'Categories: None'.<|im_end|> <|im_start|>assistant " -%} {%- endif -%} {%- for message in messages -%} {%- if loop.first -%} {%- if message.role == "system" -%} {{- "USER: " + message.content -}} {%- elif message.role == "user" -%} {{- "USER: " + message.content -}} {%- endif -%} {%- else -%} {%- if loop.index0 > 0 and messages[loop.index0 - 1].role == "system" and message.role == "user" -%} {{- " "+message.content -}} {%- else -%} {%- if message.role == "assistant" -%} {{- " ASSISTANT: " + message.content -}} {%- elif message.role == "user" -%} {{- " USER: " + message.content -}} {%- endif -%} {%- endif -%} {%- endif -%} {%- endfor -%} {{- template -}} {%- endif -%}