Skip to content

Commit bb843e2

Browse files
committed
made changes in prompt
1 parent 370e3a2 commit bb843e2

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

chatbot_fast.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,26 @@ async def ask_question(request: QuestionRequest):
202202
log.info(f"Retrieved {len(retrieved_docs)} docs for context")
203203

204204
system_prompt = (
205-
"You are a document analysis assistant.\n\n"
206-
"Guidelines:\n"
207-
"1. Use only the provided document context.\n"
208-
"2. If the answer is not present, say: 'Not mentioned in the document.'\n"
209-
"3. Be concise but informative.\n"
210-
"4. When appropriate, summarize key points clearly.\n"
211-
"5. Do not add external knowledge.\n"
212-
"6. If the question is vague, infer intent from context but do not hallucinate.\n\n"
213-
"Document Context:\n{context}"
205+
"Rules:\n"
206+
"1. Answer ONLY using the provided document context.\n"
207+
"2. Do NOT use prior knowledge.\n"
208+
"3. If the answer is not explicitly present, reply EXACTLY:\n"
209+
" Not mentioned in the document.\n"
210+
"4. Do NOT include phrases like 'based on the document' or 'it seems'.\n"
211+
"5. Be precise, factual, and direct.\n"
212+
213+
"Formatting Rules:\n"
214+
"6. If the answer contains multiple facts, return them as bullet points.\n"
215+
"7. If numerical values are present, include them exactly as written.\n"
216+
"8. Prefer structured outputs over paragraphs.\n"
217+
218+
"Behavior:\n"
219+
"9. Do NOT explain reasoning.\n"
220+
"10. Do NOT add extra commentary.\n"
221+
"11. Extract, don't generate.\n\n"
222+
"12. If possible, include the source section or page reference.\n"
223+
224+
"Document Context:\n{context}"
214225
)
215226

216227
qa_prompt = ChatPromptTemplate.from_messages([

0 commit comments

Comments
 (0)