Zekun Wu commited on
Commit
95a60e3
1 Parent(s): 5642940
Files changed (1) hide show
  1. app.py +22 -25
app.py CHANGED
@@ -339,33 +339,30 @@ def sidebar_components():
339
  chat_prompt_template = create_chat_prompt_template(st.session_state['analysis'],st.session_state['definition'])
340
  response = execute_query(index, chat_prompt_template, user_input)
341
 
342
- # Display the response
343
  st.sidebar.markdown(response)
344
 
345
- st.markdown("Provide feedback on the response:")
346
-
347
- # Feedback criteria
348
- st.sidebar.markdown("## Feedback Criteria")
349
- criteria = {
350
- "Faithfulness": "Are all claims made in the answer inferred from the given context, i.e., not hallucinated?",
351
- "Answer Relevancy": "Is the answer relevant to the question?",
352
- "Context Relevancy": "Is the context relevant to the question?",
353
- "Correctness": "Is the answer factually correct, based on the context?",
354
- "Clarity": "Is the answer explained clearly without the extensive jargon of the original document?",
355
- "Completeness": "Is the question answered fully, with all parts and subquestions being addressed?",
356
- }
357
- ratings = {}
358
- for criterion, description in criteria.items():
359
- ratings[criterion] = st.sidebar.slider(f"{criterion}: {description}", 0, 10, 5)
360
-
361
- # Ask for feedback
362
- feedback = st.sidebar.text_input("Provide additional feedback on the response:")
363
-
364
- #rating = st.sidebar.slider("Rate the response:", 0, 10, 5)
365
-
366
- if st.sidebar.button('Submit Feedback'):
367
- store_feedback(user_input, response, feedback, str(ratings), "wu981526092/feedback_coach")
368
- st.sidebar.success("Feedback submitted successfully!")
369
 
370
 
371
 
 
339
  chat_prompt_template = create_chat_prompt_template(st.session_state['analysis'],st.session_state['definition'])
340
  response = execute_query(index, chat_prompt_template, user_input)
341
 
 
342
  st.sidebar.markdown(response)
343
 
344
+ st.markdown("Provide feedback on the response:")
345
+
346
+ # Feedback criteria
347
+ st.sidebar.markdown("## Feedback Criteria")
348
+ criteria = {
349
+ "Faithfulness": "Are all claims made in the answer inferred from the given context, i.e., not hallucinated?",
350
+ "Answer Relevancy": "Is the answer relevant to the question?",
351
+ "Context Relevancy": "Is the context relevant to the question?",
352
+ "Correctness": "Is the answer factually correct, based on the context?",
353
+ "Clarity": "Is the answer explained clearly without the extensive jargon of the original document?",
354
+ "Completeness": "Is the question answered fully, with all parts and subquestions being addressed?",
355
+ }
356
+ ratings = {}
357
+ for criterion, description in criteria.items():
358
+ ratings[criterion] = st.sidebar.slider(f"{criterion}: {description}", 0, 10, 5)
359
+
360
+ # Ask for feedback
361
+ feedback = st.sidebar.text_input("Provide additional feedback on the response:")
362
+
363
+ if st.sidebar.button('Submit Feedback'):
364
+ store_feedback(user_input, response, feedback, str(ratings), "wu981526092/feedback_coach")
365
+ st.sidebar.success("Feedback submitted successfully!")
 
 
366
 
367
 
368