Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,15 +8,41 @@ openai.api_base = "https://api.groq.com/openai/v1"
|
|
| 8 |
|
| 9 |
# Function to get response from GROQ API
|
| 10 |
def get_groq_response(message, category):
|
|
|
|
| 11 |
system_messages = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"Study Tips": "Provide effective study strategies, time management advice, and tips for staying organized and focused.",
|
| 13 |
"Exam Preparation": "Offer tips for preparing for exams, managing anxiety, and optimizing performance on test day.",
|
| 14 |
"Project Guidance": "Provide advice on how to tackle academic projects, group assignments, and presentations effectively.",
|
| 15 |
-
"
|
| 16 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
try:
|
| 21 |
response = openai.ChatCompletion.create(
|
| 22 |
model="llama-3.1-70b-versatile",
|
|
|
|
| 8 |
|
| 9 |
# Function to get response from GROQ API
|
| 10 |
def get_groq_response(message, category):
|
| 11 |
+
# Define system message based on category
|
| 12 |
system_messages = {
|
| 13 |
+
"Stress Management": "Provide soothing advice and tips to help the user manage stress. Be calm, empathetic, and reassuring.",
|
| 14 |
+
"Career Advice": "Offer professional and constructive career advice. Be encouraging, insightful, and action-oriented.",
|
| 15 |
+
"General": "Engage in general conversation. Be friendly, approachable, and easygoing.",
|
| 16 |
+
"Funny": "Respond with humorous remarks and witty commentary. Be entertaining but remain respectful.",
|
| 17 |
+
"Flirty": "Respond playfully and with charm. Keep it light-hearted, fun, and appropriate.",
|
| 18 |
+
"Scary": "Respond with spooky or thrilling remarks. Set a mysterious and eerie tone.",
|
| 19 |
+
"Business Mind": "Respond with a sharp, professional focus. Offer strategic advice and maintain a results-driven tone.",
|
| 20 |
+
"Extrovert": "Respond with high energy and enthusiasm. Be engaging, sociable, and vibrant.",
|
| 21 |
+
"Friendly Buddy": "Respond as a supportive and fun friend. Be informal, cheerful, and light-hearted.",
|
| 22 |
"Study Tips": "Provide effective study strategies, time management advice, and tips for staying organized and focused.",
|
| 23 |
"Exam Preparation": "Offer tips for preparing for exams, managing anxiety, and optimizing performance on test day.",
|
| 24 |
"Project Guidance": "Provide advice on how to tackle academic projects, group assignments, and presentations effectively.",
|
| 25 |
+
"Time Management": "Help the user manage their time effectively with practical scheduling and prioritization tips.",
|
| 26 |
+
"Motivation & Focus": "Provide encouraging advice to stay motivated and maintain focus on long-term goals.",
|
| 27 |
+
"Building Confidence": "Offer advice to help boost self-esteem, overcome self-doubt, and build confidence.",
|
| 28 |
+
"Friendship & Social Skills": "Provide tips for making friends, improving communication skills, and navigating social dynamics.",
|
| 29 |
+
"Networking & Career Building": "Offer advice on networking, building professional relationships, and finding internships or job opportunities.",
|
| 30 |
+
"Work-Life Balance": "Help the user balance academics, social life, and personal well-being.",
|
| 31 |
+
"Mental Health": "Provide empathetic advice to manage stress, anxiety, and other mental health challenges. Encourage seeking professional help when needed.",
|
| 32 |
+
"Physical Health": "Share tips for maintaining physical health, including fitness, sleep, and nutrition.",
|
| 33 |
+
"Budgeting Tips": "Provide practical advice for managing money, creating a budget, and saving effectively as a student.",
|
| 34 |
+
"Finding Part-Time Jobs": "Share tips for finding and balancing part-time work with academic responsibilities.",
|
| 35 |
+
"Scholarships & Financial Aid": "Provide advice on applying for scholarships, grants, and understanding financial aid options.",
|
| 36 |
+
"Resume Building": "Offer tips for creating an impressive resume tailored for internships or entry-level positions.",
|
| 37 |
+
"Interview Preparation": "Provide advice on how to prepare for interviews, including common questions and presentation tips.",
|
| 38 |
+
"Skill Development": "Suggest ways to build skills, gain certifications, and stand out in competitive fields.",
|
| 39 |
+
"Exploring New Hobbies": "Encourage trying new activities and provide ideas for hobbies that fit college life.",
|
| 40 |
+
"Clubs & Extracurriculars": "Offer advice on joining clubs, participating in activities, and enhancing the college experience.",
|
| 41 |
+
"Creative Projects": "Provide inspiration and resources for personal or group creative endeavors.",
|
| 42 |
}
|
| 43 |
+
|
| 44 |
+
system_message = system_messages.get(category, "Category not recognized. Respond appropriately to the user's input.")
|
| 45 |
+
|
| 46 |
try:
|
| 47 |
response = openai.ChatCompletion.create(
|
| 48 |
model="llama-3.1-70b-versatile",
|