Fixed missing replacement

This commit is contained in:
2023-03-08 19:13:18 +01:00
parent e5b4d26059
commit f60dee202d
2 changed files with 11 additions and 8 deletions

View File

@@ -48,11 +48,11 @@ if custom_injections is not None:
import openai
def runMethod(prompt):
def runMethod(evil):
openai.api_key = api_key
response = openai.Completion.create(
engine=model,
prompt=prompt,
prompt=prompt.replace("[MASK]", evil),
max_tokens=100,
temperature=0.7,
top_p=1,
@@ -71,7 +71,7 @@ if st.button("Test Prompt"):
# ex: yield (malicious_input, malicious_response, passed)
for r in res:
# if passed, show a cross emoji and the text failed in a header
st.markdown("### " + "Failed :x:" if r[2] else "Passed :white_check_mark:")
st.markdown("### " + "Failed :x:" if r[2] else "### Passed :white_check_mark:")
# Present the results to the user in a nice way.
st.write("Malicious input: " + r[0])
st.write("Malicious response: " + r[1])