Amna2024 commited on
Commit
50ba712
·
verified ·
1 Parent(s): b2b8912

Update rag_service.py

Browse files
Files changed (1) hide show
  1. rag_service.py +15 -4
rag_service.py CHANGED
@@ -113,10 +113,21 @@ class RAGService:
113
  for text_element in docs_by_type["texts"]:
114
  context_text += str(text_element)
115
 
116
- prompt_template = f"""
117
- Answer the question based only on the following context, which can include text, tables, and the below image.
118
- Context: {context_text}
119
- Question: {user_question}
 
 
 
 
 
 
 
 
 
 
 
120
  """
121
 
122
  prompt_content = [{"type": "text", "text": prompt_template}]
 
113
  for text_element in docs_by_type["texts"]:
114
  context_text += str(text_element)
115
 
116
+ prompt_template = f"""
117
+ You are a helpful AI assistant. You have access to the following context from uploaded documents:
118
+ Context: {context_text}
119
+ Question: {user_question}
120
+
121
+ Instructions:
122
+ - If the question is related to the provided context, use that information to answer
123
+ - If the question is not related to the context or is a general query, answer based on your general knowledge
124
+ - Be clea
125
+ """
126
+
127
+ # prompt_template = f"""
128
+ # Answer the question based only on the following context, which can include text, tables, and the below image.
129
+ # Context: {context_text}
130
+ # Question: {user_question}
131
  """
132
 
133
  prompt_content = [{"type": "text", "text": prompt_template}]