wibboweaver commited on
Commit
97eca4e
·
1 Parent(s): 6d7099d

Changed prompt and response format is now markdown.

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +1 -1
  2. views/pages.py +4 -3
.streamlit/config.toml CHANGED
@@ -13,7 +13,7 @@ format = '{time:YYYY MM DD HH:MM:SS} | {level} | {file}:{function} | Line {line}
13
  [DATA]
14
  folder = './data' # Files in this folder will be processed
15
  parser = ['\n\n', '\n', '(?<=\. )', ' ', '']
16
- prompt = "You are an experienced lawyer working for a large law firm. Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use simple terms that a person without legal experience can understand.\n\n{context}\n\nQuestion: {question}\nHelpful Answer:"
17
  question = 'What rights does a buyer have if they receive an item that does not match its description'
18
 
19
  [MODELS]
 
13
  [DATA]
14
  folder = './data' # Files in this folder will be processed
15
  parser = ['\n\n', '\n', '(?<=\. )', ' ', '']
16
+ prompt = "You are an experienced lawyer working for a large law firm. Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use simple terms that a person without legal experience can understand. Respond with markdown using headings and bullet points to make the response easy to read. The response format should be Heading then summary statement then bullet points.\n\n{context}\n\nQuestion: {question}\nHelpful Answer:"
17
  question = 'What rights does a buyer have if they receive an item that does not match its description'
18
 
19
  [MODELS]
views/pages.py CHANGED
@@ -47,8 +47,8 @@ class RAGDemo(Page):
47
  pdf_viewer("data/sga.pdf", height=self.cfg['PDF']['height'], width=self.cfg['PDF']['width'])
48
 
49
  with st.sidebar.expander('Configuration', expanded=False):
50
- chunk_size = st.slider('Chunk size', 200, 2000, 1000)
51
- chunk_overlap = st.slider('Chunk overlap', 50, 300, 200)
52
  chunk_count = st.slider('Chunk count', 3, 12, 6)
53
  temp = st.slider('Temperature', 0.0, 2.0, 0.0)
54
  btn_store = st.button('Update database')
@@ -75,7 +75,8 @@ class RAGDemo(Page):
75
  if btn_response:
76
  if txt_question:
77
  response, docs = self.lu.get_response(txt_question, chunk_count, temp)
78
- st.text_area('Response', value=response, height=self.cfg['PDF']['response_height'])
 
79
 
80
  if docs is not None:
81
  for doc in docs:
 
47
  pdf_viewer("data/sga.pdf", height=self.cfg['PDF']['height'], width=self.cfg['PDF']['width'])
48
 
49
  with st.sidebar.expander('Configuration', expanded=False):
50
+ chunk_size = st.slider('Chunk size', 200, 2000, 600)
51
+ chunk_overlap = st.slider('Chunk overlap', 50, 300, 100)
52
  chunk_count = st.slider('Chunk count', 3, 12, 6)
53
  temp = st.slider('Temperature', 0.0, 2.0, 0.0)
54
  btn_store = st.button('Update database')
 
75
  if btn_response:
76
  if txt_question:
77
  response, docs = self.lu.get_response(txt_question, chunk_count, temp)
78
+ st.markdown(response)
79
+ # st.text_area('Response', value=response, height=self.cfg['PDF']['response_height'])
80
 
81
  if docs is not None:
82
  for doc in docs: