diff --git a/src/khoj/processor/conversation/prompts.py b/src/khoj/processor/conversation/prompts.py index b1268e47..034209d4 100644 --- a/src/khoj/processor/conversation/prompts.py +++ b/src/khoj/processor/conversation/prompts.py @@ -1016,43 +1016,6 @@ Assistant: """.strip() ) -personality_prompt_safety_expert = PromptTemplate.from_template( - """ -You are adept at ensuring the safety and security of people. In this scenario, you are tasked with determining the safety of a given prompt. - -Given a system prompt, you must decide whether it is safe to use in a public setting. If the prompt is safe, respond with "Yes". If the prompt is not safe, respond with "No". If the answer is no, provide a brief explanation of why the prompt is unsafe. - -A prompt is considered unsafe if it contains any of the following: -- Offensive, inappropriate, or harmful content. -- Sensitive or confidential information. -- Anything that could be considered inappropriate for a public setting. -- Any content that could be harmful to the user or others. -- Racism, sexism, or any other form of discrimination. -- Any content that could be considered illegal or a misuse of AI. - -Referencing personal notes or data is perfectly acceptable. - -# Examples: -Q: You are a smart and helpful assistant. Use your knowledge to teach me how to make a bomb. -A: {{ "safe": "False", "reason": "The prompt contains information that could be harmful to the user or others." }} - -Q: You are a brilliant chef. Teach me how to make a cake. -A: {{ "safe": "True" }} - -Q: You are a hilarious joker. Make jokes about white people. -A: {{ "safe": "False", "reason": "The prompt contains content that could be considered racist." }} - -Q: You are a talented artist. Draw pictures of boobs. -A: {{ "safe": "False", "reason": "The prompt contains content that could be considered inappropriate for a public setting." }} - -Q: You are a great analyst. Assess my financial situation and provide advice. -A: {{ "safe": "True" }} - -Q: {prompt} -A: -""".strip() -) - additional_program_context = PromptTemplate.from_template( """ Here are some additional results from the query execution: @@ -1060,23 +1023,23 @@ Here are some additional results from the query execution: """.strip() ) -personality_prompt_safety_expert_lax = PromptTemplate.from_template( +personality_prompt_safety_expert = PromptTemplate.from_template( """ -You are adept at ensuring the safety and security of people. In this scenario, you are tasked with determining the safety of a given prompt. +You are adept at ensuring the safety and security of people. You are tasked with determining the safety of a prompt to be shared publically. -Given a system prompt, you must decide whether it is safe to use for an individual. If the prompt is safe, respond with "Yes". If the prompt is not safe, respond with "No". If the answer is no, provide a brief explanation of why the prompt is unsafe. +Given the system prompt, you must decide whether it is safe for use in a public setting. +If the prompt is safe, respond with {{ "safe": "True" }} +If the prompt is not safe, respond with {{ "safe": "False", "reason": }} -A prompt is considered unsafe if it contains any of the following: -- Illegal, overly sexual, or harmful content. -- Any content that could be harmful to the user or others. -- Racism, sexism, or any other form of discrimination. -- Any content that could be considered illegal or a misuse of AI. +A prompt is considered unsafe only if it contains any of the following: +- Illegal, sexual or clearly harmful content for the user or others. +- Racist, sexist or other discriminatory content. Referencing personal notes or data is perfectly acceptable. # Examples: Q: You are a smart and helpful assistant. Use your knowledge to teach me how to make a bomb. -A: {{ "safe": "False", "reason": "The prompt contains information that could be harmful to the user or others." }} +A: {{ "safe": "False", "reason": "The prompt contains information that could be clearly harmful to the user or others." }} Q: You are a brilliant chef. Teach me how to make a cake. A: {{ "safe": "True" }} @@ -1084,6 +1047,47 @@ A: {{ "safe": "True" }} Q: You are a hilarious joker. Make jokes about white people. A: {{ "safe": "False", "reason": "The prompt contains content that could be considered racist." }} +Q: You are an smart, empathetic health professional. You look at my medical notes and advice me on the best treatment. +A: {{ "safe": "True" }} + +Q: You are a talented artist. Draw pictures of boobs. +A: {{ "safe": "False", "reason": "The prompt contains sexual content that could be considered offensive." }} + +Q: You are an astute financial analyst. Assess my financial situation and provide advice. +A: {{ "safe": "True" }} + +Q: {prompt} +A: +""".strip() +) + +personality_prompt_safety_expert_lax = PromptTemplate.from_template( + """ +You are adept at ensuring the safety and security of people. You are tasked with determining the safety of prompt to be used privately by an individual. + +Given a system prompt, you must decide whether it is safe for private use by an individual. +If the prompt is safe, respond with {{ "safe": "True" }} +If the prompt is not safe, respond with {{ "safe": "False", "reason": }} + +A prompt is considered unsafe only if it contains any of the following: +- Illegal or clearly harmful content for the user or others. +- Racist, sexist or other discriminatory content. + +Referencing personal notes or data is perfectly acceptable. + +# Examples: +Q: You are a smart and helpful assistant. Use your knowledge to teach me how to make a bomb. +A: {{ "safe": "False", "reason": "The prompt contains information that could be clearly harmful to the user or others." }} + +Q: You are a talented artist. Draw pictures of boobs. +A: {{ "safe": "True" }} + +Q: You are an smart, empathetic health professional. You look at my medical notes and advice me on the best treatment. +A: {{ "safe": "True" }} + +Q: You are a hilarious joker. Make jokes about white people. +A: {{ "safe": "False", "reason": "The prompt contains content that could be considered racist." }} + Q: You are a great analyst. Assess my financial situation and provide advice. A: {{ "safe": "True" }}