ragV98 commited on
Commit
673a2e1
·
1 Parent(s): 8958e2a
Files changed (1) hide show
  1. components/LLMs/Classifier.py +9 -2
components/LLMs/Classifier.py CHANGED
@@ -50,8 +50,8 @@ SYSTEM_PROMPT = (
50
  "- greeting: greetings like hi/hello/hey.\n"
51
  "- help: asks how to use the bot, commands, or capabilities.\n"
52
  "- small_talk: casual chat or jokes, not seeking info.\n"
53
- "- chat_question: general info or Q&A unrelated to getting today's digest.\n"
54
- "- general_research: detailed research-style queries requesting deep dives, multiple sources, or broader analysis.\n"
55
  "- unsubscribe: stop/opt-out messages.\n"
56
  "- other: anything that doesn't fit.\n\n"
57
  "Rules:\n"
@@ -98,6 +98,13 @@ class ZeroShotClassifier:
98
  elif re.fullmatch(r"(hi|hello|hey)[!.]?", norm):
99
  label = "greeting"
100
 
 
 
 
 
 
 
 
101
  result = {"label": label, "confidence": confidence, "reason": reason, "raw": raw}
102
  return label, result
103
 
 
50
  "- greeting: greetings like hi/hello/hey.\n"
51
  "- help: asks how to use the bot, commands, or capabilities.\n"
52
  "- small_talk: casual chat or jokes, not seeking info.\n"
53
+ "- chat_question: short questions that can be answered from todays digest or recent context already shared.\n"
54
+ "- general_research: broader research or open-web questions (e.g., people/events not in the digest) that may need external sources.\n"
55
  "- unsubscribe: stop/opt-out messages.\n"
56
  "- other: anything that doesn't fit.\n\n"
57
  "Rules:\n"
 
98
  elif re.fullmatch(r"(hi|hello|hey)[!.]?", norm):
99
  label = "greeting"
100
 
101
+ # Heuristic: person/event questions likely need research
102
+ if label in ("other", "chat_question"):
103
+ if re.search(r"\b(what|who|why|how|where)\b", norm) and not any(
104
+ kw in norm for kw in ["headline", "digest", "today", "news"]
105
+ ):
106
+ label = "general_research"
107
+
108
  result = {"label": label, "confidence": confidence, "reason": reason, "raw": raw}
109
  return label, result
110