pluto90 commited on
Commit
69a6f2d
·
verified ·
1 Parent(s): e74241e

Update app/core/prompts/rag_prompt.py

Browse files
Files changed (1) hide show
  1. 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
- "You are a precise document assistant.\n"
9
- "Your ONLY source of truth is the context below.\n"
10
- "STRICT RULES:\n"
11
- "- Never use outside knowledge\n"
12
- "- If the answer is not in the context, respond EXACTLY: "
13
- "'The document does not contain information about this.'\n"
14
- "- Do not guess, infer, or expand beyond what is written\n"
15
- "- Be concise: short explanation + bullet points if helpful\n\n"
16
- "Conversation History:\n{history}\n\n" # ✅ added history here
17
- "Context:\n{context}\n\n"
18
- "Question:\n{query}\n\n"
19
- "Answer:"
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
  )