mtyrrell commited on
Commit
e8aa9fe
1 Parent(s): 98d2ba5

formatting

Browse files
Files changed (1) hide show
  1. app.py +22 -16
app.py CHANGED
@@ -10,8 +10,8 @@ from langchain.docstore.document import Document
10
  from openai import OpenAI
11
  import utils # Import the utils module
12
 
13
- # os.environ.pop("OPENAI_API_KEY", None)
14
- # load_dotenv()
15
 
16
  openai_api_key = os.environ["OPENAI_API_KEY"]
17
 
@@ -28,15 +28,17 @@ vector_store, embeddings = utils.initialize_vector_store(
28
 
29
  # Prompt template
30
  prompt_template = (
31
- "Answer the given question using the following documents. "
32
- "Formulate your answer in the style of an academic report. "
33
- "Provide example quotes and citations using extracted text from the documents. "
34
- "Use facts and numbers from the documents in your answer. "
35
- "ALWAYS include references for information used from documents at the end of each applicable sentence "
36
- "using the format: '[ref. #]', where '[ref. #]' is included in the text provided at the start of each document "
37
- "(demarcated by the pattern '- &&& [ref. #] document_name &&&:')'. "
38
- "Do not include page numbers in the references. "
39
- "If no relevant information to answer the question is present in the documents, just say you don't have enough information to answer."
 
 
40
  )
41
 
42
  # Dropdown options
@@ -129,9 +131,13 @@ if st.button('Submit'):
129
  # Display references
130
  st.markdown("----")
131
  st.markdown('**REFERENCES:**')
132
- st.markdown(
133
- 'References are based on text automatically extracted from climate policy documents. '
134
- 'These extracts may contain non-legible characters or disjointed text as an artifact of the extraction procedure',
135
- unsafe_allow_html=True
136
- )
 
 
 
 
137
  st.markdown(references, unsafe_allow_html=True)
 
10
  from openai import OpenAI
11
  import utils # Import the utils module
12
 
13
+ os.environ.pop("OPENAI_API_KEY", None)
14
+ load_dotenv()
15
 
16
  openai_api_key = os.environ["OPENAI_API_KEY"]
17
 
 
28
 
29
  # Prompt template
30
  prompt_template = (
31
+ """
32
+ Answer the given question in an academic tone using the following documents.
33
+ Provide example quotes and citations using extracted text from the documents.
34
+ Use facts and numbers from the documents in your answer.
35
+ ALWAYS include citations for information used from documents at the end of each applicable sentence \
36
+ using the format: '[ref. #]', where '[ref. #]' is included in the text provided at the start of each document \
37
+ (demarcated by the pattern '- &&& [ref. #] document_name &&&:')'.
38
+ Do not include page numbers in the citations.
39
+ Do not include a title, overall introduction or conclusion in your response.
40
+ If no relevant information to answer the question is present in the documents, just say you don't have enough information to answer.
41
+ """
42
  )
43
 
44
  # Dropdown options
 
131
  # Display references
132
  st.markdown("----")
133
  st.markdown('**REFERENCES:**')
134
+ with st.expander("ℹ️ - About References", expanded=False):
135
+ st.write(
136
+ """
137
+ *References are based on text automatically extracted from climate policy documents.
138
+ These extracts may contain non-legible characters or disjointed text as an artifact of the extraction procedure.*
139
+ """,
140
+ unsafe_allow_html=True
141
+ )
142
+
143
  st.markdown(references, unsafe_allow_html=True)