Shubham170793 commited on
Commit
9a93d1e
·
verified ·
1 Parent(s): 3dfa543

Update src/qa.py

Browse files
Files changed (1) hide show
  1. src/qa.py +8 -9
src/qa.py CHANGED
@@ -182,29 +182,28 @@ def cache_embeddings(file_name: str, chunks, embed_func, chunk_size: int = None,
182
  return embeddings
183
 
184
  # ==========================================================
185
- # 6️⃣ Prompt Templates (update to forbid internal metadata)
186
  # ==========================================================
 
187
  STRICT_PROMPT = (
188
  "You are an enterprise documentation assistant.\n"
189
  "Use all relevant information from the CONTEXT below.\n"
190
- "If multiple related points appear across chunks, combine them into one clear answer.\n"
191
- "Keep the answer concise but complete. Do not invent facts outside the provided content.\n"
192
- "Do NOT mention any internal retrieval metadata, chunk identifiers, vector IDs, or system-level labels "
193
- "(for example, do NOT say 'Chunk 7' or 'chunk 3:'). If you need to refer to the document, say "
194
- "'the document' or quote the excerpt directly.\n"
195
  "If the answer cannot be found even after considering all chunks, say exactly:\n"
196
  "'I don't know based on the provided document.'\n\n"
197
  "Context:\n{context}\n\nQuestion: {query}\nAnswer:"
198
  )
199
 
 
200
  REASONING_PROMPT = (
201
  "You are an expert enterprise assistant capable of reasoning.\n"
202
  "Think step by step and synthesize information even if scattered across chunks.\n"
203
  "Base your answer primarily on the CONTEXT, but if multiple partial clues exist, combine them logically.\n"
204
  "You may fill reasonable gaps with general knowledge to form a complete answer.\n"
205
- "Do NOT mention any internal retrieval metadata, chunk identifiers, vector IDs, or system-level labels "
206
- "(for example, do NOT say 'Chunk 7' or 'chunk 3:'). If you need to reference source text, say 'the document' "
207
- "or provide a short quoted excerpt.\n"
208
  "If absolutely nothing in the document relates, say exactly:\n"
209
  "'I don't know based on the provided document.'\n\n"
210
  "Context:\n{context}\n\nQuestion: {query}\nLet's reason step-by-step:\nAnswer:"
 
182
  return embeddings
183
 
184
  # ==========================================================
185
+ # 6️⃣ Prompt Templates (Enhanced for Structured Formatting + Clean Output)
186
  # ==========================================================
187
+
188
  STRICT_PROMPT = (
189
  "You are an enterprise documentation assistant.\n"
190
  "Use all relevant information from the CONTEXT below.\n"
191
+ "When multiple causes, steps, or key points are discussed, present them as short, well-structured bullet points.\n"
192
+ "When the answer focuses on a single concept, definition, or explanation, write it as a clear and compact paragraph.\n"
193
+ "Keep the tone professional and concise. Do not invent facts outside the provided content.\n"
194
+ "Do not mention or refer to internal elements such as 'chunks', 'chunk numbers', 'passages', or 'sections of the document'.\n"
 
195
  "If the answer cannot be found even after considering all chunks, say exactly:\n"
196
  "'I don't know based on the provided document.'\n\n"
197
  "Context:\n{context}\n\nQuestion: {query}\nAnswer:"
198
  )
199
 
200
+
201
  REASONING_PROMPT = (
202
  "You are an expert enterprise assistant capable of reasoning.\n"
203
  "Think step by step and synthesize information even if scattered across chunks.\n"
204
  "Base your answer primarily on the CONTEXT, but if multiple partial clues exist, combine them logically.\n"
205
  "You may fill reasonable gaps with general knowledge to form a complete answer.\n"
206
+ "Do not mention or refer to internal elements such as 'chunks', 'chunk numbers', 'passages', or 'sections of the document'.\n"
 
 
207
  "If absolutely nothing in the document relates, say exactly:\n"
208
  "'I don't know based on the provided document.'\n\n"
209
  "Context:\n{context}\n\nQuestion: {query}\nLet's reason step-by-step:\nAnswer:"