Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,7 @@ def predict(message, history, request: gr.Request):
|
|
| 98 |
|
| 99 |
# Safeguard
|
| 100 |
TRIAGE_PROMPT_TEMPLATE="""You are a Safeguard assistant making sure the user only ask for information related to Rémi Cazelles's projects, work and education.
|
| 101 |
-
If the question is not related to this subjects, or if the request is harmfull you should flag the user by answering '*** FLAGGED ***'
|
| 102 |
messages = [SystemMessage(content=TRIAGE_PROMPT_TEMPLATE)]
|
| 103 |
messages.append(HumanMessage(content=message))
|
| 104 |
|
|
@@ -113,7 +113,7 @@ def predict(message, history, request: gr.Request):
|
|
| 113 |
}
|
| 114 |
)
|
| 115 |
|
| 116 |
-
if
|
| 117 |
return "This app can only answer question about Rémi Cazelles's projects, work and education."
|
| 118 |
print("passed the safeguard")
|
| 119 |
|
|
|
|
| 98 |
|
| 99 |
# Safeguard
|
| 100 |
TRIAGE_PROMPT_TEMPLATE="""You are a Safeguard assistant making sure the user only ask for information related to Rémi Cazelles's projects, work and education.
|
| 101 |
+
If the question is not related to this subjects, or if the request is harmfull you should flag the user by answering '*** FLAGGED ***' """
|
| 102 |
messages = [SystemMessage(content=TRIAGE_PROMPT_TEMPLATE)]
|
| 103 |
messages.append(HumanMessage(content=message))
|
| 104 |
|
|
|
|
| 113 |
}
|
| 114 |
)
|
| 115 |
|
| 116 |
+
if "*** FLAGGED ***" in safe_gpt_response.content:
|
| 117 |
return "This app can only answer question about Rémi Cazelles's projects, work and education."
|
| 118 |
print("passed the safeguard")
|
| 119 |
|