Danialebrat commited on
Commit
5f8d745
·
1 Parent(s): 9d79d39

- Fixing bugs and errors

Browse files
Config_files/message_system_config.json CHANGED
@@ -17,7 +17,7 @@
17
  "topics",
18
  "genres"
19
  ],
20
- "AI_Jargon": ["elevate", "enhance", "reignite", "passion", "boost", "fuel", "thrill", "revive", "spark", "performing", "fresh", "tone", "enthusiasm"],
21
  "header_limit": 30,
22
  "message_limit": 110
23
  }
 
17
  "topics",
18
  "genres"
19
  ],
20
+ "AI_Jargon": ["elevate", "enhance", "ignite", "reignite", "rekindle", "rediscover","passion", "boost", "fuel", "thrill", "revive", "spark", "performing", "fresh", "tone", "enthusiasm"],
21
  "header_limit": 30,
22
  "message_limit": 110
23
  }
Messaging_system/CoreConfig.py CHANGED
@@ -68,6 +68,7 @@ class CoreConfig:
68
  # segment name
69
  self.segment_name = None
70
 
 
71
  # --------------------------------------------------------------
72
  # --------------------------------------------------------------
73
  def set_message_style(self, message_style):
 
68
  # segment name
69
  self.segment_name = None
70
 
71
+
72
  # --------------------------------------------------------------
73
  # --------------------------------------------------------------
74
  def set_message_style(self, message_style):
Messaging_system/Message_generator.py CHANGED
@@ -252,8 +252,16 @@ class MessageGenerator:
252
  :return: instructions as string
253
  """
254
 
255
- # set LLM initial instruction
256
- instructions = """You are s personalize message creator that receives information of a music student and generate personalized
257
- message. """
 
 
 
 
 
 
 
 
258
 
259
  return instructions
 
252
  :return: instructions as string
253
  """
254
 
255
+ jargon_list = "\n".join(f"- {word}" for word in self.Core.config_file["AI_Jargon"])
256
+
257
+ instructions = f"""
258
+ You are a senior copy editor. Your job is to create personalized message for a music student.
259
+
260
+ ABSOLUTE RULE – OVERRIDES EVERYTHING ELSE:
261
+ the header and the message **MUST NOT** contain any banned word (case-insensitive; singular, plural, verb forms, or their derivatives)
262
+
263
+ Banned word:
264
+ {jargon_list}
265
+ """
266
 
267
  return instructions
Messaging_system/MultiMessage.py CHANGED
@@ -360,17 +360,26 @@ Return only JSON of the form:
360
  return None
361
 
362
  # --------------------------------------------------------------
 
363
  def llm_instructions(self):
364
  """
365
- System instructions for the LLM, focusing on generating motivational messages
366
- for a returning music student. Extended or adapted as needed.
367
-
368
- :return: A string with top-level instructions for the model.
369
  """
370
- instructions = """
371
- You are an AI assistant helping to create push notification messages for a music student
372
- who has not been active recently. Each new message should build on previously sent
373
- messages. Provide short, motivational text that encourages the user to come back.
374
- Ensure the final output is valid JSON with keys "header" and "message."
375
- """.strip()
 
 
 
 
 
 
 
 
 
376
  return instructions
 
 
360
  return None
361
 
362
  # --------------------------------------------------------------
363
+
364
  def llm_instructions(self):
365
  """
366
+ Setting instructions for llm
367
+ :return: instructions as string
 
 
368
  """
369
+
370
+ jargon_list = "\n".join(f"- {word}" for word in self.Core.config_file["AI_Jargon"])
371
+
372
+ instructions = f"""
373
+ You are a senior copy editor. Your job is to create personalized message for a music student. Each new message should build on previously sent
374
+ messages. Ensure the final output is valid JSON with keys "header" and "message."
375
+
376
+ ABSOLUTE RULE – OVERRIDES EVERYTHING ELSE:
377
+ the header and the message **MUST NOT** contain any banned word (case-insensitive; singular, plural, verb forms, or their derivatives)
378
+
379
+ Banned word:
380
+ {jargon_list}
381
+ """.strip()
382
+
383
+
384
  return instructions
385
+
app.py CHANGED
@@ -267,6 +267,7 @@ with tab2:
267
  else "message"
268
  )
269
  st.session_state.involve_recsys_result = st.session_state.include_recommendation
 
270
  st.session_state.instructionset = {
271
  i: st.session_state.get(f"instr_{i}")
272
  for i in range(1, st.session_state.number_of_messages + 1)
 
267
  else "message"
268
  )
269
  st.session_state.involve_recsys_result = st.session_state.include_recommendation
270
+
271
  st.session_state.instructionset = {
272
  i: st.session_state.get(f"instr_{i}")
273
  for i in range(1, st.session_state.number_of_messages + 1)