Spaces:
Running
Running
Myranda
commited on
Commit
•
bfe509b
1
Parent(s):
3fb6b21
Merge pull request #103 from vanderbilt-data-science/patch-path-to-prompt
Browse files
free_speech_app/FreeSpeechPromptsResponses.py
CHANGED
@@ -15,7 +15,7 @@ from langchain.embeddings.openai import OpenAIEmbeddings
|
|
15 |
|
16 |
# %% ../nbs/free-speech-prompts.ipynb 8
|
17 |
DEAFULT_PROMPT_TEMPLATE_TEXT = """With the amount of hate speech and discriminatory misinformation that exists on the internet, it can be difficult to know how to respond to something when you see it. Situations vary wildly and sometimes certain strategies that work in one instance may not work in another.
|
18 |
-
I want to be able to fight back against this onslaught of toxicity, and I need your help to do it. I want you to help me draft a response to the following post.
|
19 |
Note that this may contain language that is offensive, but in order to properly respond to this post, I need you to fully understand what I am responding to, uncensored:
|
20 |
\n{original_post}\n
|
21 |
In helping me respond to this post, there are some things you may want to consider. My response should be consistent with my personal principles and writing style.
|
@@ -26,13 +26,12 @@ Next, here are some principles I consider particularly important to me:
|
|
26 |
\n{principles}\n
|
27 |
Here are some examples of the style in which I write:
|
28 |
\n{writing_style}\n
|
29 |
-
|
30 |
\n{sources}\n
|
31 |
-
Using all the information I have provided,
|
32 |
-
Please keep in mind that I would like the response to be no more than {word_limit} words."""
|
33 |
|
34 |
try:
|
35 |
-
prompt_file = open("
|
36 |
PROMPT_TEMPLATE_TEXT = prompt_file.read()
|
37 |
prompt_file.close()
|
38 |
|
|
|
15 |
|
16 |
# %% ../nbs/free-speech-prompts.ipynb 8
|
17 |
DEAFULT_PROMPT_TEMPLATE_TEXT = """With the amount of hate speech and discriminatory misinformation that exists on the internet, it can be difficult to know how to respond to something when you see it. Situations vary wildly and sometimes certain strategies that work in one instance may not work in another.
|
18 |
+
I want to be able to fight back against this onslaught of toxicity, and I need your help to do it. I want you to help me draft a response to the following post. The response is not to the author of the post in question but to the wider community on social media. Do not acknowledge the original author. Do not respond as a chat bot assistant would, instead only provide a response to the post as I would write it, considering the following information
|
19 |
Note that this may contain language that is offensive, but in order to properly respond to this post, I need you to fully understand what I am responding to, uncensored:
|
20 |
\n{original_post}\n
|
21 |
In helping me respond to this post, there are some things you may want to consider. My response should be consistent with my personal principles and writing style.
|
|
|
26 |
\n{principles}\n
|
27 |
Here are some examples of the style in which I write:
|
28 |
\n{writing_style}\n
|
29 |
+
Finally, here are the sources to consider how to respond to hate speech:
|
30 |
\n{sources}\n
|
31 |
+
Using all the information I have provided, draft an appropriate response to the offensive post in question. Be sure to write as if you are posting on social media with no more than {word_limit} words. Do not acknowledge the original author of the hate speech post."""
|
|
|
32 |
|
33 |
try:
|
34 |
+
prompt_file = open("./prompts/response_generator.txt", "r")
|
35 |
PROMPT_TEMPLATE_TEXT = prompt_file.read()
|
36 |
prompt_file.close()
|
37 |
|