lekkalar commited on
Commit
c228e38
·
1 Parent(s): b68b73b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,12 +27,12 @@ def load_pdf_and_generate_embeddings(pdf_doc, open_ai_key):
27
  #Finally, we create the bot using the RetrievalQAChain class
28
  global pdf_qa
29
 
30
- prompt_template = """Use the following pieces of context to answer the question at the end. If you do not know the answer, just return the question followed by N/A. If you encounter a date, return it in mm/dd/yyyy format.
31
 
32
  {context}
33
 
34
  Question: {question}
35
- Return the key fields from the question followed by : and the answer :"""
36
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
37
  chain_type_kwargs = {"prompt": PROMPT}
38
  pdf_qa = RetrievalQA.from_chain_type(llm=ChatOpenAI(temperature=0, model_name="gpt-4"),chain_type="stuff", retriever=vectordb.as_retriever(search_kwargs={"k": 5}), chain_type_kwargs=chain_type_kwargs, return_source_documents=False)
 
27
  #Finally, we create the bot using the RetrievalQAChain class
28
  global pdf_qa
29
 
30
+ prompt_template = """Use the following pieces of context to answer the question at the end. If you do not know the answer, just return N/A. If you encounter a date, return it in mm/dd/yyyy format.
31
 
32
  {context}
33
 
34
  Question: {question}
35
+ Return just the answer :"""
36
  PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
37
  chain_type_kwargs = {"prompt": PROMPT}
38
  pdf_qa = RetrievalQA.from_chain_type(llm=ChatOpenAI(temperature=0, model_name="gpt-4"),chain_type="stuff", retriever=vectordb.as_retriever(search_kwargs={"k": 5}), chain_type_kwargs=chain_type_kwargs, return_source_documents=False)