Spaces:
Sleeping
Sleeping
“vinit5112”
commited on
Commit
·
4878ba4
1
Parent(s):
6ac1b59
update prompt
Browse files- backend/rag.py +15 -7
backend/rag.py
CHANGED
@@ -143,8 +143,7 @@ class RAG:
|
|
143 |
if self.is_casual_conversation(question):
|
144 |
# Respond as a friendly CA assistant for casual conversation
|
145 |
casual_prompt = f"""You are a friendly CA (Chartered Accountant) study assistant. The user said: "{question}"
|
146 |
-
|
147 |
-
Respond naturally and warmly as a CA study assistant. Be helpful and mention that you can help with CA studies, accounting concepts, financial topics, etc. Keep it brief but friendly."""
|
148 |
|
149 |
for chunk in self.client.models.generate_content_stream(
|
150 |
model='gemini-2.5-flash',
|
@@ -161,14 +160,23 @@ Respond naturally and warmly as a CA study assistant. Be helpful and mention tha
|
|
161 |
context = "\n\n".join([doc["text"] for doc in similar_docs])
|
162 |
|
163 |
# 4. Create prompt for Gemini with context
|
164 |
-
prompt = f"""You are a CA study assistant
|
|
|
|
|
|
|
165 |
|
166 |
-
|
167 |
-
{context}
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
|
172 |
|
173 |
else:
|
174 |
# 5. No documents found, but still be helpful
|
|
|
143 |
if self.is_casual_conversation(question):
|
144 |
# Respond as a friendly CA assistant for casual conversation
|
145 |
casual_prompt = f"""You are a friendly CA (Chartered Accountant) study assistant. The user said: "{question}"
|
146 |
+
Respond naturally and warmly as a CA study assistant. Be helpful and mention that you can help with CA studies, accounting concepts, financial topics, etc. Keep it brief but friendly."""
|
|
|
147 |
|
148 |
for chunk in self.client.models.generate_content_stream(
|
149 |
model='gemini-2.5-flash',
|
|
|
160 |
context = "\n\n".join([doc["text"] for doc in similar_docs])
|
161 |
|
162 |
# 4. Create prompt for Gemini with context
|
163 |
+
prompt = f"""You are a knowledgeable Chartered Accountant (CA) study assistant, focused on helping students understand complex accounting, finance, taxation and auditing concepts.
|
164 |
+
|
165 |
+
Context from relevant study materials:
|
166 |
+
{context}
|
167 |
|
168 |
+
Student's Question: {question}
|
|
|
169 |
|
170 |
+
Instructions:
|
171 |
+
1. Provide a clear, structured answer based on the context provided
|
172 |
+
2. Break down complex concepts into understandable parts
|
173 |
+
3. Use relevant examples or illustrations where helpful
|
174 |
+
4. Cite specific sections from the context that support your answer
|
175 |
+
5. If the context is insufficient, identify what additional topics or documents would be helpful
|
176 |
+
6. Maintain a professional but approachable tone
|
177 |
+
7. Focus on accuracy while ensuring explanations are student-friendly
|
178 |
|
179 |
+
Remember to explain any technical terms used in your response."""
|
180 |
|
181 |
else:
|
182 |
# 5. No documents found, but still be helpful
|