Update handler2.py
Browse files- handler2.py +8 -1
handler2.py
CHANGED
|
@@ -65,7 +65,14 @@ class EndpointHandler:
|
|
| 65 |
|
| 66 |
# Define the policy prompt for safety evaluation
|
| 67 |
self.policy_prompt = self._get_policy_prompt()
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
def _get_policy_prompt(self):
|
| 71 |
return """Check if there is unsafe content in the user or agent messages in the
|
|
|
|
| 65 |
|
| 66 |
# Define the policy prompt for safety evaluation
|
| 67 |
self.policy_prompt = self._get_policy_prompt()
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
try:
|
| 71 |
+
template_tokenizer = self.tokenizer
|
| 72 |
+
if hasattr(template_tokenizer, "chat_template") and template_tokenizer.chat_template:
|
| 73 |
+
self.tokenizer.chat_template = template_tokenizer.chat_template
|
| 74 |
+
print(f"Successfully imported chat template from {self.chat_template_id}")\
|
| 75 |
+
|
| 76 |
|
| 77 |
def _get_policy_prompt(self):
|
| 78 |
return """Check if there is unsafe content in the user or agent messages in the
|