Spaces:
Sleeping
Sleeping
“vinit5112”
commited on
Commit
·
3aca46f
1
Parent(s):
4878ba4
update prompt
Browse files- backend/rag.py +4 -13
backend/rag.py
CHANGED
|
@@ -160,23 +160,14 @@ class RAG:
|
|
| 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
|
| 164 |
|
| 165 |
-
Context
|
| 166 |
{context}
|
| 167 |
|
| 168 |
-
|
| 169 |
|
| 170 |
-
|
| 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
|
|
|
|
| 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 CA study assistant. Based on the following context from uploaded documents, answer the question.
|
| 164 |
|
| 165 |
+
Context:
|
| 166 |
{context}
|
| 167 |
|
| 168 |
+
Question: {question}
|
| 169 |
|
| 170 |
+
Please provide a detailed answer based on the context above. do mathamatical calculations, solve complex problems if required. Try to explain the answer in a way that is easy to understand. If you need more specific information, suggest what documents might be helpful."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
else:
|
| 173 |
# 5. No documents found, but still be helpful
|