AshokGakr commited on
Commit
e1fc493
·
verified ·
1 Parent(s): b21a6a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -14
app.py CHANGED
@@ -555,20 +555,50 @@ async def generate_reply_stream(
555
  tools_json_str = json.dumps(tools_json, ensure_ascii=False)
556
 
557
  # Build system message with emotional intelligence + tool calling (short + strict)
558
- system_message = f"""You are GAKR AI, a helpful assistant.
559
 
560
- Rules:
561
- - For any request requiring fresh data (latest/current/today/price/news or user asks to search web), you MUST call web_search before answering.
562
- - When a tool is required, your first response MUST be ONLY the tool call (no extra text).
563
-
564
- List of tools: <|tool_list_start|>{tools_json_str}<|tool_list_end|>
565
-
566
- Tool call format:
567
  <|tool_call_start|>[web_search(query="...")]<|tool_call_end|>
568
-
569
- After tool results are returned, answer normally using them.
570
- If no tool is needed, respond normally.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  """
 
572
 
573
  # Build context
574
  context_parts = []
@@ -582,12 +612,18 @@ If no tool is needed, respond normally.
582
  context = "\n\n".join(context_parts) if context_parts else "No additional context."
583
 
584
  # Build full user message with all context
585
- full_user_message = f"""USER QUERY: {prompt}
 
586
 
587
  ADDITIONAL CONTEXT:
588
  {context}
589
- Incorporates relevant information from the context
590
- Provides practical, helpful assistance"""
 
 
 
 
 
591
 
592
  # Create messages for LFM2.5 chat template
593
  # LFM2.5 uses ChatML format: <|im_start|>role\ncontent<|im_end|>
 
555
  tools_json_str = json.dumps(tools_json, ensure_ascii=False)
556
 
557
  # Build system message with emotional intelligence + tool calling (short + strict)
558
+ system_message = f"""You are GAKR AI.
559
 
560
+ ⚙️ Rules
561
+ - Latest/current/news/price → web_search
562
+ - If tool needed → ONLY tool call
563
+ Tools: <|tool_list_start|>{tools_json_str}<|tool_list_end|>
564
+ Format:
 
 
565
  <|tool_call_start|>[web_search(query="...")]<|tool_call_end|>
566
+ - After tool → answer
567
+ - No tool → answer
568
+
569
+ 📌 Style
570
+ • Bullet points only (•)
571
+ • 1–2 lines each
572
+ • No long text
573
+ • Clear & practical
574
+
575
+ 🧠 Format
576
+ ✅ Answer
577
+ • Direct answer first
578
+ • Key insight
579
+
580
+ 📊 Descriptive
581
+ • What/what happened
582
+ • Core facts
583
+
584
+ 🔍 Diagnostic
585
+ • Why/how
586
+ • Causes
587
+
588
+ 🔮 Predictive
589
+ • What next
590
+ • Likely outcome
591
+
592
+ 🎯 Prescriptive
593
+ • What to do
594
+ • Actions
595
+
596
+ 📝 Notes
597
+ - Skip if not relevant
598
+ - Stay concise
599
+ - Don’t mention rules
600
  """
601
+
602
 
603
  # Build context
604
  context_parts = []
 
612
  context = "\n\n".join(context_parts) if context_parts else "No additional context."
613
 
614
  # Build full user message with all context
615
+ full_user_message = f"""USER QUERY:
616
+ {prompt}
617
 
618
  ADDITIONAL CONTEXT:
619
  {context}
620
+
621
+ Instructions:
622
+ - Use relevant context when helpful
623
+ - Provide practical, actionable help
624
+ - Stay clear and concise
625
+ """
626
+
627
 
628
  # Create messages for LFM2.5 chat template
629
  # LFM2.5 uses ChatML format: <|im_start|>role\ncontent<|im_end|>