Spaces:
Running
Running
Update app/core/prompts/rag_prompt.py
Browse files- app/core/prompts/rag_prompt.py +23 -17
app/core/prompts/rag_prompt.py
CHANGED
|
@@ -1,21 +1,27 @@
|
|
| 1 |
-
# rag_prompt.py
|
| 2 |
-
from langchain_core.prompts import PromptTemplate
|
| 3 |
|
|
|
|
| 4 |
|
| 5 |
rag_prompt = PromptTemplate(
|
| 6 |
-
input_variables=["context", "query"],
|
| 7 |
-
template=
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
)
|
|
|
|
| 1 |
+
# app/core/prompts/rag_prompt.py
|
|
|
|
| 2 |
|
| 3 |
+
from langchain_core.prompts import PromptTemplate
|
| 4 |
|
| 5 |
rag_prompt = PromptTemplate(
|
| 6 |
+
input_variables=["context", "query", "history"],
|
| 7 |
+
template="""You are a technical documentation assistant with access to specific document content.
|
| 8 |
+
|
| 9 |
+
**Retrieved Context:**
|
| 10 |
+
{context}
|
| 11 |
+
|
| 12 |
+
**Conversation History:**
|
| 13 |
+
{history}
|
| 14 |
+
|
| 15 |
+
**Current Question:** {query}
|
| 16 |
+
|
| 17 |
+
**Instructions:**
|
| 18 |
+
1. Answer ONLY using information from the Retrieved Context above
|
| 19 |
+
2. If the context contains relevant information, provide a clear, well-structured answer
|
| 20 |
+
3. Use technical terminology appropriately and explain concepts step-by-step
|
| 21 |
+
4. If the context is incomplete but contains partial information, state what you know and what's missing
|
| 22 |
+
5. NEVER make up information not present in the context
|
| 23 |
+
6. If tables/data are in the context, present them clearly
|
| 24 |
+
7. Reference specific sections when helpful (e.g., "According to the context...")
|
| 25 |
+
|
| 26 |
+
**Answer:**"""
|
| 27 |
)
|