lekkalar commited on
Commit
1cfe121
·
1 Parent(s): be8b37c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -44,12 +44,12 @@ def load_pdf_and_generate_embeddings(pdf_doc, open_ai_key, relevant_pages):
44
  global pdf_qa
45
 
46
  #Configuring the Prompt Template is the key to getting the desired response in the desired format.
47
- prompt_template = """Use the following pieces of context to answer the question at the end. If you encounter a date, return it in mm/dd/yyyy format. If there is a Preface section in the document, extract the chapter# and the short description from the Preface section of the document. Chapter numbers are listed to the left in Preface and always start with an alphabet, for example A1-1
48
 
49
  {context}
50
 
51
  Question: {question}
52
- Return the answer. Where applicable, break the answer into bullet points. When the sentences are long, try and break them into sub sections and include all the information and do not skip any information. If there is an exception to the answer, please do include it in a 'Note:' section. If the document has a Preface section, include a 'For additional details refer to' section with chapter# and a short description. List only the chapters that contain information or skip this section altogether. Do not use page numbers as chapter numbers as they are different. If additional information is found in multiple pages within the same chapter, list the chapter only once. If chapter information cannot be extracted, include section# from the document"""
53
 
54
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
55
 
 
44
  global pdf_qa
45
 
46
  #Configuring the Prompt Template is the key to getting the desired response in the desired format.
47
+ prompt_template = """Use the following pieces of context to answer the question at the end. If you encounter a date, return it in mm/dd/yyyy format. If there is a Preface section in the document, extract the chapter# and the short description from the Preface. Chapter numbers are listed to the left in Preface and always start with an alphabet, for example A1-1
48
 
49
  {context}
50
 
51
  Question: {question}
52
+ Return the answer. Where applicable, break the answer into bullet points. When the sentences are long, try and break them into sub sections and include all the information and do not skip any information. If there is an exception to the answer, please do include it in a 'Note:' section. Include a 'For additional details refer to' section as needed. If the document has a Preface or 'Table of Contents' section, extract the chapter# and a short description and include the info under the 'For additional details refer to' section. List only the chapters that contain information or skip this section altogether. Do not use page numbers as chapter numbers as they are different. If additional information is found in multiple pages within the same chapter, list the chapter only once. If chapter information cannot be extracted, include any other information that will help the user to navigate to the relevant sections of the document. """
53
 
54
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
55