Zekun Wu commited on
Commit
f290ec9
1 Parent(s): 073e8e0
Files changed (1) hide show
  1. app.py +34 -4
app.py CHANGED
@@ -189,10 +189,24 @@ def main_app():
189
  st.markdown(st.session_state['analysis'])
190
 
191
  feedback = st.text_input("Provide your feedback on the response:")
192
- rating = st.slider("Rate the response:", 0, 10, 5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  if st.button('Submit Feedback'):
195
- store_feedback(str(generate_prompt_from_profile(profile, version=st.session_state['version'])), st.session_state['analysis'], feedback, rating, "wu981526092/feedback_report")
196
 
197
 
198
 
@@ -330,10 +344,26 @@ def sidebar_components():
330
 
331
  # Ask for feedback
332
  feedback = st.sidebar.text_input("Provide your feedback on the response:")
333
- rating = st.sidebar.slider("Rate the response:", 0, 10, 5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  if st.sidebar.button('Submit Feedback'):
336
- store_feedback(user_input, response, feedback, rating, "wu981526092/feedback_report")
337
  st.sidebar.success("Feedback submitted successfully!")
338
 
339
 
 
189
  st.markdown(st.session_state['analysis'])
190
 
191
  feedback = st.text_input("Provide your feedback on the response:")
192
+
193
+ criteria = {
194
+ "Faithfulness": "Are all claims made in the answer inferred from the given context, i.e., not hallucinated?",
195
+ "Answer Relevancy": "Is the answer relevant to the question?",
196
+ "Context Relevancy": "Is the context relevant to the question?",
197
+ "Correctness": "Is the answer factually correct, based on the context?",
198
+ "Clarity": "Is the answer explained clearly without the extensive jargon of the original document?",
199
+ "Completeness": "Is the question answered fully, with all parts and subquestions being addressed?",
200
+ "Legal Reasoning": "Is legal reasoning and clear logical application of principles applied, if required?"
201
+ }
202
+
203
+ ratings = {}
204
+ for criterion, description in criteria.items():
205
+ ratings[criterion] = st.sidebar.slider(f"{criterion}: {description}", 1, 5, 3)
206
+ #rating = st.slider("Rate the response:", 0, 10, 5)
207
 
208
  if st.button('Submit Feedback'):
209
+ store_feedback(str(generate_prompt_from_profile(profile, version=st.session_state['version'])), st.session_state['analysis'], feedback, str(ratings), "wu981526092/feedback_report")
210
 
211
 
212
 
 
344
 
345
  # Ask for feedback
346
  feedback = st.sidebar.text_input("Provide your feedback on the response:")
347
+
348
+ # Feedback criteria
349
+ st.sidebar.markdown("## Feedback Criteria")
350
+ criteria = {
351
+ "Faithfulness": "Are all claims made in the answer inferred from the given context, i.e., not hallucinated?",
352
+ "Answer Relevancy": "Is the answer relevant to the question?",
353
+ "Context Relevancy": "Is the context relevant to the question?",
354
+ "Correctness": "Is the answer factually correct, based on the context?",
355
+ "Clarity": "Is the answer explained clearly without the extensive jargon of the original document?",
356
+ "Completeness": "Is the question answered fully, with all parts and subquestions being addressed?",
357
+ "Legal Reasoning": "Is legal reasoning and clear logical application of principles applied, if required?"
358
+ }
359
+ ratings = {}
360
+ for criterion, description in criteria.items():
361
+ ratings[criterion] = st.sidebar.slider(f"{criterion}: {description}", 1, 5, 3)
362
+
363
+ #rating = st.sidebar.slider("Rate the response:", 0, 10, 5)
364
 
365
  if st.sidebar.button('Submit Feedback'):
366
+ store_feedback(user_input, response, feedback, str(ratings), "wu981526092/feedback_coach")
367
  st.sidebar.success("Feedback submitted successfully!")
368
 
369