Nexari-Research commited on
Commit
207f7b9
·
verified ·
1 Parent(s): 6813ba1

Update cognitive_engine.py

Browse files
Files changed (1) hide show
  1. cognitive_engine.py +14 -10
cognitive_engine.py CHANGED
@@ -1,7 +1,4 @@
1
- """
2
- cognitive_engine.py - thinking strategy with `detail` flag
3
- """
4
-
5
  from datetime import datetime
6
  import pytz
7
 
@@ -10,19 +7,26 @@ def get_time_context():
10
  now = datetime.now(IST)
11
  return f"### REAL-TIME INFO ###\nCurrent Time: {now.strftime('%I:%M %p')}\nDay: {now.strftime('%A')}\nDate: {now.strftime('%d %B %Y')}"
12
 
13
- def get_thinking_strategy(is_complex=False, detail=False):
14
  """
15
- If detail==True, instruct model to produce a numbered, stepwise, longer answer.
16
  """
17
  if is_complex or detail:
18
- return (
19
  "### STRATEGY: STRUCTURED & DETAILED ###\n"
20
  "If complex or user requested detail, provide a short '🧠 Plan:' (max 2 lines),\n"
21
  "then a numbered, step-by-step '💡 Answer:' with clear numbered lines. "
22
- "Aim for thorough coverage if requested by user. Do NOT leak chain-of-thought."
 
23
  )
24
  else:
25
- return (
26
  "### STRATEGY: CONCISE ###\n"
27
- "Keep responses friendly and brief. Offer a one-line suggestion and a follow-up question."
 
28
  )
 
 
 
 
 
 
1
+ # cognitive_engine.py - small enhancement to mention min-words when detail requested
 
 
 
2
  from datetime import datetime
3
  import pytz
4
 
 
7
  now = datetime.now(IST)
8
  return f"### REAL-TIME INFO ###\nCurrent Time: {now.strftime('%I:%M %p')}\nDay: {now.strftime('%A')}\nDate: {now.strftime('%d %B %Y')}"
9
 
10
+ def get_thinking_strategy(is_complex=False, detail=False, min_words_hint: int = None):
11
  """
12
+ Strategy that optionally includes a minimum word guideline.
13
  """
14
  if is_complex or detail:
15
+ base = (
16
  "### STRATEGY: STRUCTURED & DETAILED ###\n"
17
  "If complex or user requested detail, provide a short '🧠 Plan:' (max 2 lines),\n"
18
  "then a numbered, step-by-step '💡 Answer:' with clear numbered lines. "
19
+ "Aim for thorough coverage if requested by user. Do NOT leak chain-of-thought.\n"
20
+ "Style: Use natural phrasing, contractions where appropriate, and 0-2 emojis as suggested.\n"
21
  )
22
  else:
23
+ base = (
24
  "### STRATEGY: CONCISE ###\n"
25
+ "Keep responses friendly and brief but avoid single-sentence robotic replies. Offer a one-line suggestion and a follow-up question.\n"
26
+ "Style: Prefer natural phrasing and 0-2 emojis as suggested.\n"
27
  )
28
+
29
+ if min_words_hint:
30
+ base += f"MINIMUM_WORD_GOAL: Please aim for at least ~{min_words_hint} words unless user explicitly asks for 'short'.\n"
31
+
32
+ return base