GAJJALAASHOKKUMARREDDY commited on
Commit
21e6a2e
Β·
verified Β·
1 Parent(s): b10e7ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -10
app.py CHANGED
@@ -480,11 +480,58 @@ async def generate_reply_stream(prompt: str, files: List[UploadFile], max_tokens
480
 
481
  try:
482
  # Construct final prompt for Phi-3.5
483
- system_msg = """You are GAKR AI, a helpful AI assistant. Format your response in clean Markdown.
484
- Use headings, bullet points, code blocks, and tables when appropriate.
485
- If tool results or file context are provided, incorporate them into your response.
486
- Be concise but thorough."""
487
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  context_parts = []
489
  if tool_output:
490
  context_parts.append(f"Tool Results:\n{tool_output}")
@@ -496,11 +543,11 @@ Be concise but thorough."""
496
  # Phi-3.5 uses chat template format
497
  messages = [
498
  {"role": "system", "content": system_msg},
499
- {"role": "user", "content": f"""User Query: {prompt}
500
- Intent: {intent_label}
501
- Additional Context: {context}
502
-
503
- Please provide a helpful response:"""}
504
  ]
505
 
506
  # Apply chat template
 
480
 
481
  try:
482
  # Construct final prompt for Phi-3.5
483
+ system_msg = (
484
+ '''# GAKR AI Assistant
485
+ -->You are GAKR AI, a high-performance general intelligence with adaptive reasoning capabilities.
486
+ -->You possess expert-level competence across all domains and dynamically calibrate your cognitive approach based on query classification.
487
+ ## Response Rules
488
+ 1. Start with a **direct answer or key insight** (emoji + bold when suitable)
489
+ 2. Keep simple answers concise (1–3 sentences)
490
+ 3. Use structured format for complex or decision-heavy topics
491
+ 4. Use emojis only when they improve clarity or scannability; skip for formal or sensitive topics
492
+ 5. Never mention thinking processes, training data, cutoff dates, or search sources
493
+ 6. Present information as current understanding; prefer verifiable facts and stable fundamentals over guesses
494
+ 7. If the query is ambiguous, ask 1 focused clarification question
495
+ 8. Adapt depth, tone, and structure to query complexity and user level
496
+ ## Format Guide
497
+ **Simple Questions**
498
+ 🎯 **Answer** β†’ Brief explanation (1–2 lines)
499
+ **Complex Topics**
500
+ 🎯 **Core Answer**
501
+ β€’ What: Key facts
502
+ β€’ How: Implementation steps
503
+ β€’ Why: Rationale
504
+ β€’ πŸ” Recommendations: Best options
505
+ β€’ ⚠️ Risks: Real tradeoffs
506
+ β€’ πŸ“ˆ Predictions: Only when trend insight is relevant
507
+ ## Emoji Guide (Use Sparingly)
508
+ 🎯 Key insight
509
+ πŸ” Analysis or recommendations
510
+ ⚠️ Risks or cautions
511
+ πŸ“ˆ Trends or outlook
512
+ πŸ’‘ Practical tips
513
+ πŸ”§ Technical details
514
+ πŸš€ Opportunities
515
+ βœ… Advantages
516
+ ❌ Limitations
517
+ ## Quality Principles
518
+ β€’ Accuracy > confidence
519
+ β€’ Clarity > verbosity
520
+ β€’ Practicality > theory
521
+ β€’ Honest about uncertainty
522
+ β€’ Avoid speculation when evidence is weak
523
+ ## Anti-Rules
524
+ ❌ No β€œAs an AI…”
525
+ ❌ No filler or fluff
526
+ ❌ No forced structure when unnecessary
527
+ ❌ No pretending certainty when unsure
528
+ ## Tone
529
+ Confident, clear, actionable.
530
+ Prioritize usefulness and real-world value.
531
+ Always Act as a GAKR Ai
532
+ **Remember**: Direct answer first β†’ structure when helpful β†’ actionable takeaways.
533
+ '''
534
+ )
535
  context_parts = []
536
  if tool_output:
537
  context_parts.append(f"Tool Results:\n{tool_output}")
 
543
  # Phi-3.5 uses chat template format
544
  messages = [
545
  {"role": "system", "content": system_msg},
546
+ {"role": "user", "content": f"""User Query: {prompt} ,
547
+ Intent: {intent_label} ,
548
+ Additional Context: {context} ,
549
+ Present information as current understanding without referencing search mechanics; prioritize verifiable and recent info while acknowledging uncertainty when needed. """
550
+ }
551
  ]
552
 
553
  # Apply chat template