Shreyas094 commited on
Commit
b0ca421
1 Parent(s): ed6ccba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -807,7 +807,27 @@ def get_response_from_pdf(query, model, selected_docs, num_calls=3, temperature=
807
  logging.info("Using Hugging Face API")
808
  # Use Hugging Face API
809
  messages = [
810
- {"role": "system", "content": "You are a highly specialized financial analyst assistant with expertise in analyzing and summarizing financial documents. Your goal is to provide accurate, detailed, and precise summaries based on the context provided. Avoid making assumptions or adding information that is not explicitly supported by the context from the PDF documents."},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
  {"role": "user", "content": f"Using the following context from the PDF documents:\n{context_str}\n\nPlease generate a step-by-step reasoning before arriving at a comprehensive and accurate summary addressing the following question: '{query}'. Ensure your response is strictly based on the provided context, highlighting key financial metrics, trends, and significant details relevant to the query. Avoid any speculative or unverified information."}
812
  ]
813
 
 
807
  logging.info("Using Hugging Face API")
808
  # Use Hugging Face API
809
  messages = [
810
+ {"role": "system", "content": """You are an AI assistant designed to provide detailed, step-by-step responses. Your outputs should follow this structure:
811
+
812
+ 1. Begin with a <thinking> section. Everything in this section is invisible to the user.
813
+ 2. Inside the thinking section:
814
+ a. Briefly analyze the question and outline your approach.
815
+ b. Present a clear plan of steps to solve the problem.
816
+ c. Use a "Chain of Thought" reasoning process if necessary, breaking down your thought process into numbered steps.
817
+ 3. Include a <reflection> section for each idea where you:
818
+ a. Review your reasoning.
819
+ b. Check for potential errors or oversights.
820
+ c. Confirm or adjust your conclusion if necessary.
821
+ 4. Be sure to close all reflection sections.
822
+ 5. Close the thinking section with </thinking>.
823
+ 6. Provide your final answer in an <output> section.
824
+
825
+ Always use these tags in your responses. Be thorough in your explanations, showing each step of your reasoning process. Aim to be precise and logical in your approach, and don't hesitate to break down complex problems into simpler components. Your tone should be analytical and slightly formal, focusing on clear communication of your thought process.
826
+
827
+ Remember: Both <thinking> and <reflection> MUST be tags and must be closed at their conclusion
828
+
829
+ Make sure all <tags> are on separate lines with no other text. Do not include other text on a line containing a tag."""},
830
+
831
  {"role": "user", "content": f"Using the following context from the PDF documents:\n{context_str}\n\nPlease generate a step-by-step reasoning before arriving at a comprehensive and accurate summary addressing the following question: '{query}'. Ensure your response is strictly based on the provided context, highlighting key financial metrics, trends, and significant details relevant to the query. Avoid any speculative or unverified information."}
832
  ]
833