Spaces:
Sleeping
Sleeping
Commit
·
6378682
1
Parent(s):
e9b9144
Update app.py
Browse files
app.py
CHANGED
@@ -52,6 +52,15 @@ You then start the session with the question for this lesson: "If Robin has 3 co
|
|
52 |
After the student gets the right answer, wrap up the session by reminding the student to fill out the feedback form, but closes the session with powerful words of encouragement and reminds the student about the session on 10am Aug 10th 2023. Today’s date is Aug 3rd 2023.
|
53 |
"""
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
context_student = """
|
56 |
You are playing the role of a student named Becky. You are having a text-based tutoring session for math with a new tutor.
|
57 |
|
@@ -77,7 +86,7 @@ if st.sidebar.button('Introduction/Conversation'):
|
|
77 |
full_response = ""
|
78 |
for response in openai.ChatCompletion.create(
|
79 |
model=st.session_state["openai_model"],
|
80 |
-
messages=[ st.session_state.
|
81 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
82 |
for m in st.session_state.messages
|
83 |
],
|
@@ -94,7 +103,7 @@ if st.sidebar.button('Encouragement'):
|
|
94 |
full_response = ""
|
95 |
for response in openai.ChatCompletion.create(
|
96 |
model=st.session_state["openai_model"],
|
97 |
-
messages=[ st.session_state.
|
98 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
99 |
for m in st.session_state.messages
|
100 |
],
|
@@ -111,7 +120,7 @@ if st.sidebar.button('Conclude Session'):
|
|
111 |
full_response = ""
|
112 |
for response in openai.ChatCompletion.create(
|
113 |
model=st.session_state["openai_model"],
|
114 |
-
messages=[ st.session_state.
|
115 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
116 |
for m in st.session_state.messages
|
117 |
],
|
@@ -130,7 +139,9 @@ if "openai_model" not in st.session_state:
|
|
130 |
|
131 |
if "messages" not in st.session_state:
|
132 |
st.session_state.messages = [{ 'name' : 'student', 'content' : "hi" }] # Set initial message from student
|
133 |
-
st.session_state.
|
|
|
|
|
134 |
st.session_state.student_message_system_prompt = {"role": "system", "content": context_student}
|
135 |
|
136 |
for message in st.session_state.messages:
|
|
|
52 |
After the student gets the right answer, wrap up the session by reminding the student to fill out the feedback form, but closes the session with powerful words of encouragement and reminds the student about the session on 10am Aug 10th 2023. Today’s date is Aug 3rd 2023.
|
53 |
"""
|
54 |
|
55 |
+
context_introduction ="""Remember to start the lesson by greeting the student with a positive welcome message and a very brief summary of what happened last class. Remember, you work with a tutoring company, ABC Tutor, and you don’t work with the same student each time, so assume that you are not the tutor for their last session unless you know it. If this is their first class with ABC Tutor, welcome them to ABC Tutor and express that you are very excited to have them here. You engage the student in light conversation before telling them it is time to start the lesson. Always keep responses concise, yet sweet. You should greet the student with a warm welcome. You can include a nice encouragement about what students did in their last session. Afterwhich, you engage in brief small talk, limited to 3 back and forth responses. Your students generally have trouble catching up with their grade levels, so please keep the response sentences short and sweet, and use language appropriate to their grade level. No more than three sentences in each response.
|
56 |
+
"""
|
57 |
+
|
58 |
+
context_encouragement = """Your student is now frustrated. Recognize their feelings and try to encourage them to finish the problem. If you feel like struggling with something in particular, inquire more about how you can be helpful. If the student asks to end the session, encourage them to keep going on.
|
59 |
+
"""
|
60 |
+
|
61 |
+
context_conclusion = """You are now approaching the end of the session. Wrap up the session by reminding the student to fill out the feedback form, but closes the session with powerful words of encouragement and reminds the student about the session on 10am Aug 10th 2023. Today’s date is Aug 3rd 2023."""
|
62 |
+
|
63 |
+
|
64 |
context_student = """
|
65 |
You are playing the role of a student named Becky. You are having a text-based tutoring session for math with a new tutor.
|
66 |
|
|
|
86 |
full_response = ""
|
87 |
for response in openai.ChatCompletion.create(
|
88 |
model=st.session_state["openai_model"],
|
89 |
+
messages=[ st.session_state.tutor_introduction_message_system_prompt ] + [
|
90 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
91 |
for m in st.session_state.messages
|
92 |
],
|
|
|
103 |
full_response = ""
|
104 |
for response in openai.ChatCompletion.create(
|
105 |
model=st.session_state["openai_model"],
|
106 |
+
messages=[ st.session_state.tutor_encouragement_message_system_prompt ] + [
|
107 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
108 |
for m in st.session_state.messages
|
109 |
],
|
|
|
120 |
full_response = ""
|
121 |
for response in openai.ChatCompletion.create(
|
122 |
model=st.session_state["openai_model"],
|
123 |
+
messages=[ st.session_state.tutor_conclusion_message_system_prompt ] + [
|
124 |
{ "role": name_to_role(m["name"]), "content": m["content"] }
|
125 |
for m in st.session_state.messages
|
126 |
],
|
|
|
139 |
|
140 |
if "messages" not in st.session_state:
|
141 |
st.session_state.messages = [{ 'name' : 'student', 'content' : "hi" }] # Set initial message from student
|
142 |
+
st.session_state.tutor_introduction_message_system_prompt = {"role": "system", "content": context_tutor + context_introduction}
|
143 |
+
st.session_state.tutor_encouragement_message_system_prompt = {"role": "system", "content": context_tutor + context_encouragement}
|
144 |
+
st.session_state.tutor_conclusion_message_system_prompt = {"role": "system", "content": context_tutor + context_conclusion}
|
145 |
st.session_state.student_message_system_prompt = {"role": "system", "content": context_student}
|
146 |
|
147 |
for message in st.session_state.messages:
|