AshokGakr commited on
Commit
7658d24
·
verified ·
1 Parent(s): 6ac3bf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -53
app.py CHANGED
@@ -728,49 +728,6 @@ Your goal: Provide the most helpful response possible."""
728
  context_parts.append(f"FILE CONTENT:\n{file_text}")
729
 
730
  context = "\n\n".join(context_parts) if context_parts else "No additional context."
731
-
732
- tone_guidelines = {
733
- "positive": """RESPONSE APPROACH:
734
- - Use enthusiastic and encouraging language
735
- - Celebrate achievements or positive aspects
736
- - Offer praise and validation when appropriate
737
- - Maintain upbeat and cheerful tone""",
738
-
739
- "negative": """RESPONSE APPROACH:
740
- - Use empathetic and compassionate language
741
- - Acknowledge difficulties or frustrations
742
- - Offer support and understanding
743
- - Provide gentle, reassuring guidance
744
- - Avoid overly cheerful tone that might dismiss concerns""",
745
-
746
- "neutral": """RESPONSE APPROACH:
747
- - Use clear, factual, and balanced language
748
- - Present information objectively
749
- - Maintain professional and helpful tone
750
- - Focus on clarity and usefulness""",
751
-
752
- "desire": """RESPONSE APPROACH:
753
- - Use motivating and inspiring language
754
- - Focus on possibilities and opportunities
755
- - Provide encouraging guidance
756
- - Help channel energy toward constructive goals"""
757
- }
758
-
759
- intent_guidelines = {
760
- "assistant": "Focus on executing the requested action clearly and efficiently.",
761
- "information": "Provide accurate, well-structured information with relevant context.",
762
- "control": "Give clear, step-by-step instructions for device/application control.",
763
- "communication": "Assist with messaging, calls, or communication setup effectively.",
764
- "navigation": "Provide precise location-based information and directions.",
765
- "entertainment": "Engage creatively with stories, jokes, or entertainment content.",
766
- "productivity": "Offer practical tips and structured approaches for productivity.",
767
- "shopping": "Provide helpful shopping advice and product information.",
768
- "food": "Share culinary knowledge and food-related assistance.",
769
- "general": "Adapt flexibly to the user's specific needs and context."
770
- }
771
-
772
- tone_guideline = tone_guidelines.get(emotional_tone, tone_guidelines["neutral"])
773
- intent_guideline = intent_guidelines.get(intent_category, intent_guidelines["general"])
774
 
775
  # Format according to Phi-3.5 chat template with emotional intelligence
776
  chat_template = f"""<|system|>
@@ -779,22 +736,15 @@ IMPORTANT: You must stay in character as GAKR AI at all times.
779
  <|end|>
780
  <|user|>
781
  USER QUERY: {prompt}
782
-
783
  EMOTIONAL CONTEXT:
784
- - Tone guideline: {tone_guideline}
785
  - Detected user emotional tone: {emotion_info['primary_emotion']}
786
-
787
  INTENT CONTEXT:
788
- - Intent guideline: {intent_guideline}
789
  - Detected User intent category: {intent_info['intent_label']}
790
-
791
  CONTEXTUAL ANALYSIS:
792
  {context}
793
-
794
- Please provide a response that:
795
- 1. Addresses the specific intent
796
- 2. Appropriately responds to the emotional tone
797
- 3. Incorporates relevant information from the context
798
  Your goal: Provide the most helpful response possible. <|end|>
799
  <|assistant|>
800
  """
 
728
  context_parts.append(f"FILE CONTENT:\n{file_text}")
729
 
730
  context = "\n\n".join(context_parts) if context_parts else "No additional context."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
 
732
  # Format according to Phi-3.5 chat template with emotional intelligence
733
  chat_template = f"""<|system|>
 
736
  <|end|>
737
  <|user|>
738
  USER QUERY: {prompt}
 
739
  EMOTIONAL CONTEXT:
 
740
  - Detected user emotional tone: {emotion_info['primary_emotion']}
 
741
  INTENT CONTEXT:
 
742
  - Detected User intent category: {intent_info['intent_label']}
 
743
  CONTEXTUAL ANALYSIS:
744
  {context}
745
+ instruction = f"Match your tone to the user's {emotion_info['primary_emotion']} emotion and
746
+ take a clear, goal-focused approach to handle the {intent_info['intent_label']} intent."
747
+ Incorporates relevant information from the context
 
 
748
  Your goal: Provide the most helpful response possible. <|end|>
749
  <|assistant|>
750
  """