Commit ·
5f8d745
1
Parent(s): 9d79d39
- Fixing bugs and errors
Browse files- Config_files/message_system_config.json +1 -1
- Messaging_system/CoreConfig.py +1 -0
- Messaging_system/Message_generator.py +11 -3
- Messaging_system/MultiMessage.py +19 -10
- app.py +1 -0
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 |
-
|
| 256 |
-
|
| 257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
:return: A string with top-level instructions for the model.
|
| 369 |
"""
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
""".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|