Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
31 |
|
32 |
{context}
|
33 |
|
34 |
Question: {question}
|
35 |
-
Return
|
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)
|