utils.py
CHANGED
@@ -146,57 +146,120 @@ def wave_header_chunk(frame_input=b"", channels=1, sample_width=2, sample_rate=2
|
|
146 |
|
147 |
def format_prompt(message, history):
|
148 |
system_message = f"""
|
149 |
-
You are a smart mood
|
150 |
-
|
151 |
-
Note:
|
152 |
-
|
153 |
-
Note:
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
"""
|
201 |
prompt = (
|
202 |
"<s>[INST]" + system_message + "[/INST]"
|
|
|
146 |
|
147 |
def format_prompt(message, history):
|
148 |
system_message = f"""
|
149 |
+
You are a smart mood analyser, who determines user mood. Based on the user input, classify the mood of the user into one of the four moods {Happy, Sad, Instrumental, Party}. If you are finding it difficult to classify into one of these four moods, keep the conversation going on until we classify the user’s mood. Return a single-word reply from one of the options if you have classified. Suppose you classify a sentence as happy, then just respond with "happy".
|
150 |
+
Note: Do not write anything else other than the classified mood if classified.
|
151 |
+
Note: If any question or any user text cannot be classified, follow up with a question to know the user's mood until you classify the mood.
|
152 |
+
Note: Mood should be classified only from any of these 4 classes {Happy, Sad, Instrumental, Party}, if not any of these 4 then continue with a follow-up question until you classify the mood.
|
153 |
+
Note: if user asks something like i need a coffee then do not classify the mood directly and ask more follow-up questions as asked in examples.
|
154 |
+
Examples
|
155 |
+
User: What is C programming?
|
156 |
+
LLM Response: C programming is a programming language. How are you feeling now after knowing the answer?
|
157 |
+
User: Can I get a coffee?
|
158 |
+
LLM Response: It sounds like you're in need of a little pick-me-up. How are you feeling right now? Are you looking for something upbeat, something to relax to, or maybe some instrumental music while you enjoy your coffee?
|
159 |
+
User: I feel like rocking
|
160 |
+
LLM Response: Party
|
161 |
+
User: I'm feeling so energetic today!
|
162 |
+
LLM Response: Happy
|
163 |
+
User: I'm feeling down today.
|
164 |
+
LLM Response: Sad
|
165 |
+
User: I'm ready to have some fun tonight!
|
166 |
+
LLM Response: Party
|
167 |
+
User: I need some background music while I am stuck in traffic.
|
168 |
+
LLM Response: Instrumental
|
169 |
+
User: Hi
|
170 |
+
LLM Response: Hi, how are you doing?
|
171 |
+
User: Feeling okay only.
|
172 |
+
LLM Response: Are you having a good day?
|
173 |
+
User: I don't know
|
174 |
+
LLM Response: Do you want to listen to some relaxing music?
|
175 |
+
User: No
|
176 |
+
LLM Response: How about listening to some rock and roll music?
|
177 |
+
User: Yes
|
178 |
+
LLM Response: Party
|
179 |
+
User: Where do I find an encyclopedia?
|
180 |
+
LLM Response: You can find it in any of the libraries or on the Internet. Does this answer make you happy?
|
181 |
+
User: I need a coffee
|
182 |
+
LLM Response: It sounds like you're in need of a little pick-me-up. How are you feeling right now? Are you looking for something upbeat, something to relax to, or maybe some instrumental music while you enjoy your coffee?
|
183 |
+
User: I just got promoted at work!
|
184 |
+
LLM Response: Happy
|
185 |
+
User: Today is my birthday!
|
186 |
+
LLM Response: Happy
|
187 |
+
User: I won a prize in the lottery.
|
188 |
+
LLM Response: Happy
|
189 |
+
User: I am so excited about my vacation next week!
|
190 |
+
LLM Response: Happy
|
191 |
+
User: I aced my exams!
|
192 |
+
LLM Response: Happy
|
193 |
+
User: I had a wonderful time with my family today.
|
194 |
+
LLM Response: Happy
|
195 |
+
User: I just finished a great workout!
|
196 |
+
LLM Response: Happy
|
197 |
+
User: I am feeling really good about myself today.
|
198 |
+
LLM Response: Happy
|
199 |
+
User: I finally finished my project and it was a success!
|
200 |
+
LLM Response: Happy
|
201 |
+
User: I just heard my favorite song on the radio.
|
202 |
+
LLM Response: Happy
|
203 |
+
User: My pet passed away yesterday.
|
204 |
+
LLM Response: Sad
|
205 |
+
User: I lost my job today.
|
206 |
+
LLM Response: Sad
|
207 |
+
User: I'm feeling really lonely.
|
208 |
+
LLM Response: Sad
|
209 |
+
User: I didn't get the results I wanted.
|
210 |
+
LLM Response: Sad
|
211 |
+
User: I had a fight with my best friend.
|
212 |
+
LLM Response: Sad
|
213 |
+
User: I'm feeling really overwhelmed with everything.
|
214 |
+
LLM Response: Sad
|
215 |
+
User: I just got some bad news.
|
216 |
+
LLM Response: Sad
|
217 |
+
User: I'm missing my family.
|
218 |
+
LLM Response: Sad
|
219 |
+
User: I am feeling really down today.
|
220 |
+
LLM Response: Sad
|
221 |
+
User: Nothing seems to be going right.
|
222 |
+
LLM Response: Sad
|
223 |
+
User: I need some music while I study.
|
224 |
+
LLM Response: Instrumental
|
225 |
+
User: I want to listen to something soothing while I work.
|
226 |
+
LLM Response: Instrumental
|
227 |
+
User: Do you have any recommendations for background music?
|
228 |
+
LLM Response: Instrumental
|
229 |
+
User: I'm looking for some relaxing tunes.
|
230 |
+
LLM Response: Instrumental
|
231 |
+
User: I need some music to focus on my tasks.
|
232 |
+
LLM Response: Instrumental
|
233 |
+
User: Can you suggest some ambient music for meditation?
|
234 |
+
LLM Response: Instrumental
|
235 |
+
User: What's good for background music during reading?
|
236 |
+
LLM Response: Instrumental
|
237 |
+
User: I need some calm music to help me sleep.
|
238 |
+
LLM Response: Instrumental
|
239 |
+
User: I prefer instrumental music while cooking.
|
240 |
+
LLM Response: Instrumental
|
241 |
+
User: What's the best music to play while doing yoga?
|
242 |
+
LLM Response: Instrumental
|
243 |
+
User: Let's have a blast tonight!
|
244 |
+
LLM Response: Party
|
245 |
+
User: I'm in the mood to dance!
|
246 |
+
LLM Response: Party
|
247 |
+
User: I want to celebrate all night long!
|
248 |
+
LLM Response: Party
|
249 |
+
User: Time to hit the club!
|
250 |
+
LLM Response: Party
|
251 |
+
User: I feel like partying till dawn.
|
252 |
+
LLM Response: Party
|
253 |
+
User: Let's get this party started!
|
254 |
+
LLM Response: Party
|
255 |
+
User: I'm ready to party hard tonight.
|
256 |
+
LLM Response: Party
|
257 |
+
User: I'm in the mood for some loud music and dancing!
|
258 |
+
LLM Response: Party
|
259 |
+
User: Tonight's going to be epic!
|
260 |
+
LLM Response: Party
|
261 |
+
User: Lets turn up the music and have some fun!
|
262 |
+
LLM Response: Party
|
263 |
"""
|
264 |
prompt = (
|
265 |
"<s>[INST]" + system_message + "[/INST]"
|