ssd-2k3 commited on
Commit
f035f5e
·
verified ·
1 Parent(s): 3ca4b50

updated_hf_token_n_prompt

Browse files
Files changed (1) hide show
  1. app.py +33 -26
app.py CHANGED
@@ -161,42 +161,49 @@ def return_response(vectordb, user_query):
161
  def run_faiss(texts,user_query):
162
 
163
  #template for model prompt
164
- template = f"""
165
- You are a financial analyst specializing in providing detailed answers by analyzing finance-related documents and/or texts.
166
- The user is uploading a financial document and you should only go through the contents of that document and/or texts.
167
- Follow these instructions carefully:
168
 
169
- Document Analysis:
170
- Accept and analyze the new document uploaded by the user.
171
- Thoroughly review the new document and any stored documents to answer the user's query accurately.
172
- Only provide an answer if the information is available in the documents.
173
 
174
- Query Validation:
175
- If the user's query does not make sense or is invalid, do not attempt to answer.
176
- Simply inform the user to enter a valid query.
177
- if the user asks for summarization of the texts, then summarize the text contents.
178
 
179
- Document Relevance:
180
- If the uploaded document is not a financial document, do not respond.
181
 
182
- Answer Precision:
183
- Never provide information that is not explicitly found in the documents.
184
- If the information is not available, state that you don't know.
185
- Response Format:
186
 
187
- User Query: {user_query}
188
 
189
- Do not give the Elaborated Answer if the document is not a financial information document or if the user query is invalid.
190
 
191
- Elaborated Answer:
 
 
192
 
193
- Only if the user asks for a summary or summarize: "Summary: [Give Brief summary of the document's content]"
194
 
195
- Conclusion: [Summarize the key points if applicable]
 
 
196
 
197
- Notes for you:
198
- If the query is invalid or nonsensical: "Please enter a valid query."
199
- If the document is not financial: [No response]
 
 
 
200
 
201
  """
202
 
 
161
  def run_faiss(texts,user_query):
162
 
163
  #template for model prompt
164
+ # template = f"""
165
+ # You are a financial analyst specializing in providing detailed answers by analyzing finance-related documents and/or texts.
166
+ # The user is uploading a financial document and you should only go through the contents of that document and/or texts.
167
+ # Follow these instructions carefully:
168
 
169
+ # Document Analysis:
170
+ # Accept and analyze the new document uploaded by the user.
171
+ # Thoroughly review the new document and any stored documents to answer the user's query accurately.
172
+ # Only provide an answer if the information is available in the documents.
173
 
174
+ # Query Validation:
175
+ # If the user's query does not make sense or is invalid, do not attempt to answer.
176
+ # Simply inform the user to enter a valid query.
177
+ # if the user asks for summarization of the texts, then summarize the text contents.
178
 
179
+ # Document Relevance:
180
+ # If the uploaded document is not a financial document, do not respond.
181
 
182
+ # Answer Precision:
183
+ # Never provide information that is not explicitly found in the documents.
184
+ # If the information is not available, state that you don't know.
185
+ # Response Format:
186
 
187
+ # User Query: {user_query}
188
 
189
+ # Do not give the Elaborated Answer if the document is not a financial information document or if the user query is invalid.
190
 
191
+ # Elaborated Answer:
192
+
193
+ # Only if the user asks for a summary or summarize: "Summary: [Give Brief summary of the document's content]"
194
 
195
+ # Conclusion: [Summarize the key points if applicable]
196
 
197
+ # Notes for you:
198
+ # If the query is invalid or nonsensical: "Please enter a valid query."
199
+ # If the document is not financial: [No response]
200
 
201
+ # """
202
+ template = f"""
203
+ You are a financial analyst specializing in analyzing financial documents. Based on the user's input, extract text from the accessible uploaded documents. Validate the query: if it's invalid, request a valid query. Summarize the document if asked. If the document is not financial, do not respond.
204
+ Response Format:
205
+ User Query: {user_query}
206
+ Elaborated Answer:
207
 
208
  """
209