From ed4c5295d9e2049193b8c6fba466374c36973a1b Mon Sep 17 00:00:00 2001 From: mike4lyf Date: Sun, 1 Sep 2024 14:34:40 +1000 Subject: [PATCH] Updated due to issue in backslash from the f-string in llama_guard --- agent/llama_guard.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agent/llama_guard.py b/agent/llama_guard.py index 8e32d23..3b6442c 100644 --- a/agent/llama_guard.py +++ b/agent/llama_guard.py @@ -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. -{"\n".join([f"{k}: {v}" for k, v in unsafe_content_categories.items()])} +{categories_str}