dobinyim commited on
Commit
73bc015
·
verified ·
1 Parent(s): 52ceaf7

Upload midterm.py

Browse files
Files changed (1) hide show
  1. midterm.py +5 -2
midterm.py CHANGED
@@ -21,7 +21,7 @@ OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
21
  openai.api_key = OPENAI_API_KEY
22
 
23
  # Load PDF
24
- loader = PyMuPDFLoader("AirBnB10Q.pdf")
25
  documents = loader.load()
26
 
27
  # Split Document
@@ -46,7 +46,10 @@ retriever = qdrant_vector_store.as_retriever()
46
  # Pull LangChain QA Prompt Template
47
  retrieval_qa_prompt = hub.pull("langchain-ai/retrieval-qa-chat")
48
 
49
- template = """Answer the question based only on the following context. If you cannot answer the question with the context, please respond with 'I don't know':
 
 
 
50
 
51
  Context:
52
  {context}
 
21
  openai.api_key = OPENAI_API_KEY
22
 
23
  # Load PDF
24
+ loader = PyMuPDFLoader("./AirBnB10Q.pdf")
25
  documents = loader.load()
26
 
27
  # Split Document
 
46
  # Pull LangChain QA Prompt Template
47
  retrieval_qa_prompt = hub.pull("langchain-ai/retrieval-qa-chat")
48
 
49
+ template = """You are a helpful assistant. Use only the context available in the file. The file is a PDF and is a company filing submitted to the SEC.
50
+ Pages include company information and detailed reports about financial performance. Pages contain tables, where some key information is found.
51
+ Table columns include name, title, and shares owned. Do not make up any information that is not in the file.
52
+ Use the context provided in the file to answer the questions. Explain your answer by describing how you arrived at the answer:
53
 
54
  Context:
55
  {context}