TTsamurai
commited on
Commit
·
cb737b4
1
Parent(s):
0c66821
change the dataset schema
Browse files
app.py
CHANGED
@@ -55,9 +55,9 @@ SUMMARIZATION_PROMPT_FILE = os.path.join(STATIC_FILE, "txt/system_summarization_
|
|
55 |
|
56 |
uuid_this_session = str(uuid.uuid4())
|
57 |
feedback_file_interaction = Path("user_feedback/") / f"data_{uuid_this_session}.json"
|
58 |
-
|
59 |
-
|
60 |
-
)
|
61 |
feedback_folder = feedback_file_interaction.parent
|
62 |
feedback_folder.mkdir(parents=True, exist_ok=True) # Ensure the directory exists
|
63 |
|
@@ -251,9 +251,9 @@ def add_user_profile_to_system_instruction(
|
|
251 |
save_feedback(
|
252 |
user_id,
|
253 |
uuid_this_session,
|
254 |
-
"
|
255 |
{"summarization": summ},
|
256 |
-
|
257 |
)
|
258 |
# print(f"Preference Summary:{summ}")
|
259 |
system_instruction += f"\nPrevious Conversations with the Customer about the User Profile: {user_preference_elicitation_data['summary_history']}\n"
|
@@ -679,14 +679,14 @@ def create_demo():
|
|
679 |
save_feedback(
|
680 |
user_id,
|
681 |
uuid_this_session,
|
682 |
-
"
|
683 |
{"type": tab_name, "role": "user", "content": message},
|
684 |
feedback_file_interaction,
|
685 |
)
|
686 |
save_feedback(
|
687 |
user_id,
|
688 |
uuid_this_session,
|
689 |
-
"
|
690 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
691 |
feedback_file_interaction,
|
692 |
)
|
@@ -700,14 +700,14 @@ def create_demo():
|
|
700 |
user_id,
|
701 |
uuid_this_session,
|
702 |
"Interaction",
|
703 |
-
{"type": "
|
704 |
feedback_file_interaction,
|
705 |
)
|
706 |
save_feedback(
|
707 |
user_id,
|
708 |
uuid_this_session,
|
709 |
"Interaction",
|
710 |
-
{"type": "
|
711 |
feedback_file_interaction,
|
712 |
)
|
713 |
# log_action(user_id, "User_Elicitation", "User Message", message)
|
@@ -763,14 +763,14 @@ def create_demo():
|
|
763 |
save_feedback(
|
764 |
user_id,
|
765 |
uuid_this_session,
|
766 |
-
"
|
767 |
{"type": tab_name, "role": "user", "content": first_message},
|
768 |
feedback_file_interaction,
|
769 |
)
|
770 |
save_feedback(
|
771 |
user_id,
|
772 |
uuid_this_session,
|
773 |
-
"
|
774 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
775 |
feedback_file_interaction,
|
776 |
)
|
@@ -783,15 +783,15 @@ def create_demo():
|
|
783 |
save_feedback(
|
784 |
user_id,
|
785 |
uuid_this_session,
|
786 |
-
"
|
787 |
-
{"type": "
|
788 |
feedback_file_interaction,
|
789 |
)
|
790 |
save_feedback(
|
791 |
user_id,
|
792 |
uuid_this_session,
|
793 |
"Interaction",
|
794 |
-
{"type": "
|
795 |
feedback_file_interaction,
|
796 |
)
|
797 |
# log_action(user_id, "User_Elicitation", "User Message", first_message)
|
@@ -848,7 +848,7 @@ def create_demo():
|
|
848 |
save_feedback(
|
849 |
user_id,
|
850 |
uuid_this_session,
|
851 |
-
"
|
852 |
{
|
853 |
"type": tab_name,
|
854 |
"role": "user",
|
@@ -859,7 +859,7 @@ def create_demo():
|
|
859 |
save_feedback(
|
860 |
user_id,
|
861 |
uuid_this_session,
|
862 |
-
"
|
863 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
864 |
feedback_file_interaction,
|
865 |
)
|
@@ -873,15 +873,15 @@ def create_demo():
|
|
873 |
save_feedback(
|
874 |
user_id,
|
875 |
uuid_this_session,
|
876 |
-
"
|
877 |
-
{"type": "
|
878 |
feedback_file_interaction,
|
879 |
)
|
880 |
save_feedback(
|
881 |
user_id,
|
882 |
uuid_this_session,
|
883 |
-
"
|
884 |
-
{"type": "
|
885 |
feedback_file_interaction,
|
886 |
)
|
887 |
# log_action(user_id, "User_Elicitation", "Response", outputs_text)
|
@@ -894,7 +894,7 @@ def create_demo():
|
|
894 |
|
895 |
# dropdown, readon_button, multi-evaluator
|
896 |
print(f"Tab: {tab_name}\nEvaluation: {evals}")
|
897 |
-
save_feedback(user_id, uuid_this_session, "
|
898 |
# log_action(user_id, tab_name, "Round Evaluation", "Following")
|
899 |
# for key, value in evals.items():
|
900 |
# log_action(user_id, tab_name, key, value)
|
@@ -939,7 +939,7 @@ def create_demo():
|
|
939 |
save_feedback(
|
940 |
user_id,
|
941 |
uuid_this_session,
|
942 |
-
"
|
943 |
{
|
944 |
first_comp: ranking_first_comp,
|
945 |
second_comp: ranking_second_comp,
|
@@ -947,7 +947,7 @@ def create_demo():
|
|
947 |
fourth_comp: ranking_fourth_comp,
|
948 |
fifth_comp: ranking_fifth_comp,
|
949 |
},
|
950 |
-
|
951 |
)
|
952 |
# log_action(user_id, "Final_Ranking", first_comp, ranking_first_comp)
|
953 |
# log_action(user_id, "Final_Ranking", second_comp, ranking_second_comp)
|
|
|
55 |
|
56 |
uuid_this_session = str(uuid.uuid4())
|
57 |
feedback_file_interaction = Path("user_feedback/") / f"data_{uuid_this_session}.json"
|
58 |
+
feedback_file_summarization = Path("user_feedback/") / f"summarization_{uuid_this_session}.json"
|
59 |
+
feedback_file_round_evaluation = Path("user_feedback/") / f"round_evaluation_{uuid_this_session}.json"
|
60 |
+
feedback_file_final_ranking = Path("user_feedback/") / f"final_ranking_{uuid_this_session}.json"
|
61 |
feedback_folder = feedback_file_interaction.parent
|
62 |
feedback_folder.mkdir(parents=True, exist_ok=True) # Ensure the directory exists
|
63 |
|
|
|
251 |
save_feedback(
|
252 |
user_id,
|
253 |
uuid_this_session,
|
254 |
+
"preference_elicitation_summarization",
|
255 |
{"summarization": summ},
|
256 |
+
feedback_file_summarization,
|
257 |
)
|
258 |
# print(f"Preference Summary:{summ}")
|
259 |
system_instruction += f"\nPrevious Conversations with the Customer about the User Profile: {user_preference_elicitation_data['summary_history']}\n"
|
|
|
679 |
save_feedback(
|
680 |
user_id,
|
681 |
uuid_this_session,
|
682 |
+
"interaction",
|
683 |
{"type": tab_name, "role": "user", "content": message},
|
684 |
feedback_file_interaction,
|
685 |
)
|
686 |
save_feedback(
|
687 |
user_id,
|
688 |
uuid_this_session,
|
689 |
+
"interaction",
|
690 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
691 |
feedback_file_interaction,
|
692 |
)
|
|
|
700 |
user_id,
|
701 |
uuid_this_session,
|
702 |
"Interaction",
|
703 |
+
{"type": "user_elicitation", "role": "user", "content": message},
|
704 |
feedback_file_interaction,
|
705 |
)
|
706 |
save_feedback(
|
707 |
user_id,
|
708 |
uuid_this_session,
|
709 |
"Interaction",
|
710 |
+
{"type": "user_elicitation", "role": "assistant", "content": outputs_text},
|
711 |
feedback_file_interaction,
|
712 |
)
|
713 |
# log_action(user_id, "User_Elicitation", "User Message", message)
|
|
|
763 |
save_feedback(
|
764 |
user_id,
|
765 |
uuid_this_session,
|
766 |
+
"interaction",
|
767 |
{"type": tab_name, "role": "user", "content": first_message},
|
768 |
feedback_file_interaction,
|
769 |
)
|
770 |
save_feedback(
|
771 |
user_id,
|
772 |
uuid_this_session,
|
773 |
+
"interaction",
|
774 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
775 |
feedback_file_interaction,
|
776 |
)
|
|
|
783 |
save_feedback(
|
784 |
user_id,
|
785 |
uuid_this_session,
|
786 |
+
"interaction",
|
787 |
+
{"type": "user_elicitation", "role": "user", "content": first_message},
|
788 |
feedback_file_interaction,
|
789 |
)
|
790 |
save_feedback(
|
791 |
user_id,
|
792 |
uuid_this_session,
|
793 |
"Interaction",
|
794 |
+
{"type": "user_elicitation", "role": "assistant", "content": outputs_text},
|
795 |
feedback_file_interaction,
|
796 |
)
|
797 |
# log_action(user_id, "User_Elicitation", "User Message", first_message)
|
|
|
848 |
save_feedback(
|
849 |
user_id,
|
850 |
uuid_this_session,
|
851 |
+
"interaction",
|
852 |
{
|
853 |
"type": tab_name,
|
854 |
"role": "user",
|
|
|
859 |
save_feedback(
|
860 |
user_id,
|
861 |
uuid_this_session,
|
862 |
+
"interaction",
|
863 |
{"type": tab_name, "role": "assistant", "content": outputs_text},
|
864 |
feedback_file_interaction,
|
865 |
)
|
|
|
873 |
save_feedback(
|
874 |
user_id,
|
875 |
uuid_this_session,
|
876 |
+
"interaction",
|
877 |
+
{"type": "user_elicitation", "role": "user", "content": message},
|
878 |
feedback_file_interaction,
|
879 |
)
|
880 |
save_feedback(
|
881 |
user_id,
|
882 |
uuid_this_session,
|
883 |
+
"interaction",
|
884 |
+
{"type": "user_elicitation", "role": "assistant", "content": outputs_text},
|
885 |
feedback_file_interaction,
|
886 |
)
|
887 |
# log_action(user_id, "User_Elicitation", "Response", outputs_text)
|
|
|
894 |
|
895 |
# dropdown, readon_button, multi-evaluator
|
896 |
print(f"Tab: {tab_name}\nEvaluation: {evals}")
|
897 |
+
save_feedback(user_id, uuid_this_session, "round_evaluation", evals, feedback_file_round_evaluation)
|
898 |
# log_action(user_id, tab_name, "Round Evaluation", "Following")
|
899 |
# for key, value in evals.items():
|
900 |
# log_action(user_id, tab_name, key, value)
|
|
|
939 |
save_feedback(
|
940 |
user_id,
|
941 |
uuid_this_session,
|
942 |
+
"final_ranking",
|
943 |
{
|
944 |
first_comp: ranking_first_comp,
|
945 |
second_comp: ranking_second_comp,
|
|
|
947 |
fourth_comp: ranking_fourth_comp,
|
948 |
fifth_comp: ranking_fifth_comp,
|
949 |
},
|
950 |
+
feedback_file_final_ranking,
|
951 |
)
|
952 |
# log_action(user_id, "Final_Ranking", first_comp, ranking_first_comp)
|
953 |
# log_action(user_id, "Final_Ranking", second_comp, ranking_second_comp)
|