Spaces:
Running
Running
Update rag.py
Browse files
rag.py
CHANGED
@@ -24,13 +24,6 @@ similarity_model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
|
|
24 |
HF_DATASET_REPO = "midrees2806/unmatched_queries"
|
25 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
26 |
|
27 |
-
# Greeting list
|
28 |
-
GREETINGS = [
|
29 |
-
"hi", "hello", "hey", "good morning", "good afternoon", "good evening",
|
30 |
-
"assalam o alaikum", "salam", "aoa", "hi there",
|
31 |
-
"hey there", "greetings"
|
32 |
-
]
|
33 |
-
|
34 |
# Load dataset (automatically using the path)
|
35 |
with open('dataset.json', 'r') as f:
|
36 |
dataset = json.load(f)
|
@@ -79,13 +72,6 @@ def get_best_answer(user_input):
|
|
79 |
return "Please enter a valid question."
|
80 |
user_input_lower = user_input.lower().strip()
|
81 |
|
82 |
-
if any(greet in user_input_lower for greet in GREETINGS):
|
83 |
-
greeting_response = query_groq_llm(
|
84 |
-
f"You are an official assistant for University of Education Lahore. "
|
85 |
-
f"Respond to this greeting in a friendly and professional manner: {user_input}"
|
86 |
-
)
|
87 |
-
return greeting_response if greeting_response else "Hello! How can I assist you today?"
|
88 |
-
|
89 |
# π Check if question is about fee
|
90 |
if any(keyword in user_input_lower for keyword in ["fee structure", "fees structure"]):
|
91 |
return (
|
|
|
24 |
HF_DATASET_REPO = "midrees2806/unmatched_queries"
|
25 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# Load dataset (automatically using the path)
|
28 |
with open('dataset.json', 'r') as f:
|
29 |
dataset = json.load(f)
|
|
|
72 |
return "Please enter a valid question."
|
73 |
user_input_lower = user_input.lower().strip()
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
# π Check if question is about fee
|
76 |
if any(keyword in user_input_lower for keyword in ["fee structure", "fees structure"]):
|
77 |
return (
|