Nexari-Research commited on
Commit
9e84f89
·
verified ·
1 Parent(s): fee11b4

Update cognitive_engine.py

Browse files
Files changed (1) hide show
  1. cognitive_engine.py +12 -25
cognitive_engine.py CHANGED
@@ -1,41 +1,28 @@
1
  """
2
- Nexari Cognitive Engine (UPDATED)
3
- Author: Piyush
4
- Improvements:
5
- - Safer 'thinking strategy' guidance (avoid raw chain-of-thought)
6
- - More explicit small-plan + answer structure
7
  """
8
 
9
  from datetime import datetime
10
  import pytz
11
 
12
  def get_time_context():
13
- """
14
- MODULE 1: Fetches Real-Time Data.
15
- """
16
  IST = pytz.timezone('Asia/Kolkata')
17
  now = datetime.now(IST)
18
- current_time = now.strftime("%I:%M %p")
19
- day_name = now.strftime("%A")
20
- date_full = now.strftime("%d %B %Y")
21
 
22
- return f"### REAL-TIME INFO ###\nCurrent Time: {current_time}\nDay: {day_name}\nDate: {date_full}"
23
-
24
- def get_thinking_strategy(is_complex=False):
25
  """
26
- MODULE 2: Sets the Thinking Strategy.
27
- Instead of leaking chain-of-thought, instruct the model to provide:
28
- - A 1-2 line '🧠 Plan:' (concise) when complex
29
- - Then a '💡 Answer:' block with final result
30
  """
31
- if is_complex:
32
  return (
33
- "### STRATEGY: STRUCTURED, SAFE THINKING ###\n"
34
- "This is a technical/complex request. Provide a very short plan prefixed with '🧠 Plan:' (1-2 lines), "
35
- "then provide the final result prefixed with '💡 Answer:'. Do NOT reveal internal chain-of-thought details."
 
36
  )
37
  else:
38
  return (
39
- "### STRATEGY: CONVERSATIONAL ###\n"
40
- "Keep responses natural, warm and concise. If helpful, provide a one-line suggestion and a gentle follow-up question."
41
- )
 
1
  """
2
+ cognitive_engine.py - thinking strategy with `detail` flag
 
 
 
 
3
  """
4
 
5
  from datetime import datetime
6
  import pytz
7
 
8
  def get_time_context():
 
 
 
9
  IST = pytz.timezone('Asia/Kolkata')
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
+ )