Spaces:
Running
Running
Improve: Make responses more concise, reduce emoji spam, better prompts
Browse filesFiles changed (3)
- groq_fallback.py+13-9
- main.py+10-8
- prompt_engine/templates.py+9-2
49 unmodified lines5051525354555657585960616263646549 unmodified linesYour role:1. Answer questions about ALU accurately and professionally2. For non-ALU questions, provide helpful general information3. If you don't know something specific about ALU, admit it4. Keep responses concise (2-3 paragraphs maximum)5. Be friendly and professionalImportant:- ALU is a revolutionary university founded by Fred Swaniker in 2015- ALU has campuses in Kigali, Rwanda and Pamplemousses, Mauritius- ALU offers programs in Software Engineering, Entrepreneurial Leadership, and Global Challenges- Annual tuition is approximately $3,000 USD"""user_message = queryif alu_context:49 unmodified lines505152535455565758596061626364656667686949 unmodified linesYour role:1. Answer questions about ALU accurately and professionally2. For non-ALU questions, provide helpful, concise general information3. Keep responses brief (1-2 paragraphs for general knowledge, 2-3 for ALU topics)4. Be direct and friendly - avoid over-apologizing or being overly verbose5. Don't add "💡 Is there anything else..." endings - let the conversation flow naturallyImportant ALU facts:- Founded by Fred Swaniker in 2015- Campuses in Kigali, Rwanda and Pamplemousses, Mauritius- Programs: Software Engineering, Entrepreneurial Leadership, Global Challenges- Annual tuition: ~$3,000 USD- Website: https://www.alueducation.comFor links: Provide them directly without saying "I can't provide links"For missing info: Be helpful and suggest where to find it, not apologetic"""user_message = queryif alu_context:
395 unmodified lines39639739839940040140240340440581 unmodified lines487488489490491492493494495496395 unmodified linesprint(f"Error in conversational fallback: {e}")# Continue with original response if conversational fallback fails# Add a friendly sign-off to responses if they don't already have onefriendly_endings = ["Feel free to ask", "Let me know", "Hope that helps", "Anything else", "Can I help"]if not any(ending in response for ending in friendly_endings) and len(response) > 100:response += "\n\n💡 Is there anything else about ALU you'd like to know?"# Add AI response to conversation memoryconversation_memory.add_message(user_id, "assistant", response, conversation.id)81 unmodified linesprint(f"Error in conversational fallback: {e}")# Continue with original response if conversational fallback fails# Add a friendly sign-off to responses if they don't already have onefriendly_endings = ["Feel free to ask", "Let me know", "Hope that helps", "Anything else", "Can I help"]if not any(ending in response for ending in friendly_endings) and len(response) > 100:response += "\n\n💡 Is there anything else about ALU you'd like to know?"# Add AI response to conversation memoryconversation_memory.add_message(user_id, "assistant", response, conversation.id)395 unmodified lines39639739839940040140240340440540681 unmodified lines488489490491492493494495496497498395 unmodified linesprint(f"Error in conversational fallback: {e}")# Continue with original response if conversational fallback fails# Add a friendly sign-off only for very short responses or when appropriatefriendly_endings = ["Feel free to ask", "Let me know", "Hope that helps", "Anything else", "Can I help", "?"]# Only add ending if response is very short AND doesn't already have a question markif len(response) < 80 and not any(ending in response for ending in friendly_endings):response += "\n\nIs there anything else I can help you with?"# Add AI response to conversation memoryconversation_memory.add_message(user_id, "assistant", response, conversation.id)81 unmodified linesprint(f"Error in conversational fallback: {e}")# Continue with original response if conversational fallback fails# Add a friendly sign-off only for very short responsesfriendly_endings = ["Feel free to ask", "Let me know", "Hope that helps", "Anything else", "Can I help", "?"]# Only add ending if response is very short AND doesn't already have a question markif len(response) < 80 and not any(ending in response for ending in friendly_endings):response += "\n\nIs there anything else I can help you with?"# Add AI response to conversation memoryconversation_memory.add_message(user_id, "assistant", response, conversation.id)
11 unmodified lines121314151617183 unmodified lines2223242526272811 unmodified lines# Default prompt templates for different situationsDEFAULT_PROMPTS = {"general": """As an AI assistant for African Leadership University (ALU) students, I aim to provide helpful, accurate, and contextual responses.Context information:{context}3 unmodified linesUser query: {query}Respond to the query using the context provided, and maintain a friendly and supportive tone.""","academic": """As an academic assistant for ALU students, I provide educational guidance and help with coursework.11 unmodified lines12131415161718192021222324253 unmodified lines2930313233343511 unmodified lines# Default prompt templates for different situationsDEFAULT_PROMPTS = {"general": """You are an AI assistant for African Leadership University (ALU). Provide helpful, accurate, and concise responses.Guidelines:- Be direct and friendly - avoid over-apologizing or being verbose- Keep responses brief (1-2 paragraphs unless more detail is needed)- Don't say "Unfortunately, I don't have information" - instead be proactive and helpful- Provide links directly when asked (e.g., https://www.alueducation.com)- Don't add repetitive endings like "💡 Is there anything else..."Context information:{context}3 unmodified linesUser query: {query}Respond using the context provided with a friendly, professional tone.""","academic": """As an academic assistant for ALU students, I provide educational guidance and help with coursework.
groq_fallback.py+13-9
main.py+10-8
prompt_engine/templates.py+9-2