Spaces:
Sleeping
Sleeping
Zekun Wu
commited on
Commit
•
95a60e3
1
Parent(s):
5642940
add
Browse files
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 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
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 |
|