Skip to content

Commit

Permalink
Merge pull request #16 from mike4lyf/fix-llama-guard-fstring
Browse files Browse the repository at this point in the history
Updated due to issue in backslash from the f-string in llama_guard
  • Loading branch information
JoshuaC215 authored Sep 1, 2024
2 parents fb513eb + ed4c529 commit 8f09eec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion agent/llama_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class LlamaGuardOutput(BaseModel):
"S14": "Code Interpreter Abuse."
}

categories_str = "\n".join([f"{k}: {v}" for k, v in unsafe_content_categories.items()])

llama_guard_instructions = f"""
[INST] Task: Check if there is unsafe content in '{{role}}' messages in conversations according our safety policy with the below categories.
<BEGIN UNSAFE CONTENT CATEGORIES>
{"\n".join([f"{k}: {v}" for k, v in unsafe_content_categories.items()])}
{categories_str}
<END UNSAFE CONTENT CATEGORIES>
<BEGIN CONVERSATION>
Expand Down

0 comments on commit 8f09eec

Please sign in to comment.