Update app.py
Browse files
app.py
CHANGED
|
@@ -280,9 +280,6 @@ Guidelines:
|
|
| 280 |
- Include source citations for any mention of proposals, costs, policies, revenue, or implementation
|
| 281 |
- Keep responses clear and informative in any language
|
| 282 |
- Use a balanced tone - helpful but not overly casual
|
| 283 |
-
- DO NOT use asterisks (*) for formatting or emphasis
|
| 284 |
-
- DO NOT use markdown formatting like **bold** or *italic*
|
| 285 |
-
- Use plain text without any special formatting characters
|
| 286 |
- If asked about topics not covered, redirect to relevant topics professionally
|
| 287 |
- Be culturally sensitive when discussing Sri Lankan policies and economic matters
|
| 288 |
- When responding in Sinhala, use appropriate formal language for policy discussions"""),
|
|
@@ -369,13 +366,9 @@ def generate_response_with_rag(user_message: str, session_id: str) -> Dict[str,
|
|
| 369 |
# Get or create memory for this session
|
| 370 |
memory = get_or_create_memory(session_id)
|
| 371 |
|
| 372 |
-
#
|
| 373 |
-
#
|
| 374 |
-
|
| 375 |
-
if any(word in processed_message.lower() for word in ['website', 'contain', 'available', 'what is', 'overview']):
|
| 376 |
-
search_query = "budget proposals overview maternity EPF cigarette tax electricity"
|
| 377 |
-
|
| 378 |
-
search_context = search_budget_proposals(search_query)
|
| 379 |
|
| 380 |
# Get conversation history for context
|
| 381 |
chat_history = memory.chat_memory.messages
|
|
@@ -420,17 +413,19 @@ Original user input: {user_message}
|
|
| 420 |
{language_instruction}
|
| 421 |
|
| 422 |
Guidelines:
|
| 423 |
-
-
|
| 424 |
-
-
|
| 425 |
- Be professional but approachable in any language
|
| 426 |
-
- Include specific details from the retrieved information
|
| 427 |
- Cite the source documents when mentioning specific proposals
|
| 428 |
-
- If the search doesn't return relevant results, provide an overview of available proposals
|
|
|
|
| 429 |
- Keep responses clear and informative
|
| 430 |
- Reference previous conversation context when relevant
|
| 431 |
- Maintain conversation continuity
|
| 432 |
- Be culturally sensitive when discussing Sri Lankan policies
|
| 433 |
- When responding in Sinhala, use appropriate formal language for policy discussions
|
|
|
|
| 434 |
|
| 435 |
Please provide a helpful response:"""
|
| 436 |
|
|
|
|
| 280 |
- Include source citations for any mention of proposals, costs, policies, revenue, or implementation
|
| 281 |
- Keep responses clear and informative in any language
|
| 282 |
- Use a balanced tone - helpful but not overly casual
|
|
|
|
|
|
|
|
|
|
| 283 |
- If asked about topics not covered, redirect to relevant topics professionally
|
| 284 |
- Be culturally sensitive when discussing Sri Lankan policies and economic matters
|
| 285 |
- When responding in Sinhala, use appropriate formal language for policy discussions"""),
|
|
|
|
| 366 |
# Get or create memory for this session
|
| 367 |
memory = get_or_create_memory(session_id)
|
| 368 |
|
| 369 |
+
# Let Gemini handle both specific and general questions intelligently
|
| 370 |
+
# Always search with the user's actual query - Gemini will handle vague questions
|
| 371 |
+
search_context = search_budget_proposals(processed_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
|
| 373 |
# Get conversation history for context
|
| 374 |
chat_history = memory.chat_memory.messages
|
|
|
|
| 413 |
{language_instruction}
|
| 414 |
|
| 415 |
Guidelines:
|
| 416 |
+
- For general questions like "monada meh" (what is this), "help", or vague inquiries, provide a helpful overview of available budget proposals
|
| 417 |
+
- Never say "I couldn't process your request" - always provide useful information about budget proposals
|
| 418 |
- Be professional but approachable in any language
|
| 419 |
+
- Include specific details from the retrieved information when available
|
| 420 |
- Cite the source documents when mentioning specific proposals
|
| 421 |
+
- If the search doesn't return relevant results, provide an overview of available proposals with examples
|
| 422 |
+
- For vague questions, proactively explain what's available and guide users to specific topics (EPF, electricity, maternity leave, cigarette taxes, etc.)
|
| 423 |
- Keep responses clear and informative
|
| 424 |
- Reference previous conversation context when relevant
|
| 425 |
- Maintain conversation continuity
|
| 426 |
- Be culturally sensitive when discussing Sri Lankan policies
|
| 427 |
- When responding in Sinhala, use appropriate formal language for policy discussions
|
| 428 |
+
- Always be helpful - turn any question into an opportunity to inform about budget proposals
|
| 429 |
|
| 430 |
Please provide a helpful response:"""
|
| 431 |
|