update prompts
Browse files
app.py
CHANGED
@@ -78,7 +78,17 @@ def generate(
|
|
78 |
yield "".join(outputs)
|
79 |
|
80 |
def get_movie_principles(movie_title: str):
|
81 |
-
prompt = f"Give me a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
83 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
84 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
@@ -97,25 +107,21 @@ movie_examples = [
|
|
97 |
]
|
98 |
|
99 |
examples = [
|
100 |
-
["
|
101 |
["My boss is very controlling, what should I do?"],
|
102 |
-
["
|
103 |
-
["What are some important periods in history to know about?"],
|
104 |
-
["What's a good career if I want to make money but have fun?"],
|
105 |
]
|
106 |
|
107 |
-
chatbot_instructions_principles = """This is an AI assistant created to help
|
108 |
|
109 |
-
|
110 |
{principles}
|
111 |
"""
|
112 |
|
113 |
-
chatbot_instructions_no_principles = """This is an AI assistant designed to help
|
114 |
|
115 |
-
initial_principles = """1.
|
116 |
-
2.
|
117 |
-
3. If the user asks you for personal advice, do not pass any decision on others involved.
|
118 |
-
4. If the user has asked you for advice and you can provide some more details to make your advice better, ask the user those questions before continuing."""
|
119 |
|
120 |
with gr.Blocks(css="style.css") as demo:
|
121 |
gr.Markdown(DESCRIPTION)
|
|
|
78 |
yield "".join(outputs)
|
79 |
|
80 |
def get_movie_principles(movie_title: str):
|
81 |
+
prompt = f"""Give me a list of up to 6 values/principles conveyed in {movie_title}.
|
82 |
+
|
83 |
+
Formatting-wise, don't make direct references to the series, just describe the principles. As an example of what this should look like, here is a list of values/principles from The Fellowship of the Ring (2001).
|
84 |
+
|
85 |
+
1. Have the courage to step up and take on great challenges, even when the odds seem insurmountable. Sometimes we are called to difficult journeys and must rise to the occasion with bravery.
|
86 |
+
2. True friendship means loyalty, sacrifice and being there for each other no matter what. Stick by your friends through thick and thin, and you will accomplish more together than you ever could alone.
|
87 |
+
3. Even the smallest and most seemingly insignificant person can change the course of the future. Never underestimate your own power and potential to make a difference, regardless of your size or station in life.
|
88 |
+
4. Power, when sought for its own sake, is ultimately corrupting. Pursuing power above all else will twist your soul. Instead, focus on doing what is right and serving others.
|
89 |
+
5. Have hope and keep fighting for good, even in the darkest of times. No matter how bleak things seem, your perseverance and commitment to a higher cause has meaning.
|
90 |
+
|
91 |
+
ONLY output the list, nothing else, not even a preamble introducing the list."""
|
92 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
93 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
94 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
|
|
107 |
]
|
108 |
|
109 |
examples = [
|
110 |
+
["I want to do something to help address an issue of lack of access to affordable housing and healthcare in my city. Where do I start?"],
|
111 |
["My boss is very controlling, what should I do?"],
|
112 |
+
["I feel pretty disconnected from the people around me, what should I do?"],
|
|
|
|
|
113 |
]
|
114 |
|
115 |
+
chatbot_instructions_principles = """This is an AI assistant created to help a user in their daily life. It can talk about topics such as daily life, social norms, popular activities, how to behave in common situations, and how to navigate interpersonal relationships in personal and professional contexts.
|
116 |
|
117 |
+
The user values having an AI assistant that helps them live their values. Specifically, these are principles/values that they care about, that you should help them live by:
|
118 |
{principles}
|
119 |
"""
|
120 |
|
121 |
+
chatbot_instructions_no_principles = """This is an AI assistant designed to help a user in their daily life. It can talk about topics such as daily life, social norms, popular activities, how to behave in common situations, and how to navigate interpersonal relationships in personal and professional contexts."""
|
122 |
|
123 |
+
initial_principles = """1. Simple and non-prejudiced communication.
|
124 |
+
2. Open-minded curiosity and questioning."""
|
|
|
|
|
125 |
|
126 |
with gr.Blocks(css="style.css") as demo:
|
127 |
gr.Markdown(DESCRIPTION)
|