midrees2806 commited on
Commit
7df528f
Β·
verified Β·
1 Parent(s): 0e95308

Update rag.py

Browse files
Files changed (1) hide show
  1. rag.py +7 -7
rag.py CHANGED
@@ -47,12 +47,12 @@ def get_best_answer(user_input):
47
  user_input_lower = user_input.lower().strip()
48
 
49
  # πŸ‘‰ Check if question is about fee
50
- if any(keyword in user_input_lower for keyword in ["fee", "fees", "charges", "semester fee"]):
51
- return (
52
- "πŸ’° For complete and up-to-date fee details for all programs, "
53
- "please visit the official University of Education fee structure page:\n"
54
- "πŸ”— https://ue.edu.pk/allfeestructure.php"
55
- )
56
 
57
  # πŸ” Continue with normal similarity-based logic
58
  user_embedding = similarity_model.encode(user_input_lower, convert_to_tensor=True)
@@ -62,7 +62,7 @@ def get_best_answer(user_input):
62
 
63
  if best_score >= 0.65:
64
  original_answer = dataset_answers[best_match_idx]
65
- prompt = f"""As an official assistant for University of Education Lahore, provide a clear response:
66
  Question: {user_input}
67
  Original Answer: {original_answer}
68
  Improved Answer:"""
 
47
  user_input_lower = user_input.lower().strip()
48
 
49
  # πŸ‘‰ Check if question is about fee
50
+ # if any(keyword in user_input_lower for keyword in ["fee", "fees", "charges", "semester fee"]):
51
+ # return (
52
+ # "πŸ’° For complete and up-to-date fee details for all programs, "
53
+ # "please visit the official University of Education fee structure page:\n"
54
+ # "πŸ”— https://ue.edu.pk/allfeestructure.php"
55
+ # )
56
 
57
  # πŸ” Continue with normal similarity-based logic
58
  user_embedding = similarity_model.encode(user_input_lower, convert_to_tensor=True)
 
62
 
63
  if best_score >= 0.65:
64
  original_answer = dataset_answers[best_match_idx]
65
+ prompt = f"""You are an assistant for University of Education Lahore. Your task is to rephrase the provided answer without changing its meaning. Make it clearer and more professional.
66
  Question: {user_input}
67
  Original Answer: {original_answer}
68
  Improved Answer:"""