Skip to content

Commit c50b53b

Browse files
committed
Final draft for submission
1 parent 37988cb commit c50b53b

9 files changed

+254
-173
lines changed

jupyter_mentor/_modidx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@
6969
'jupyter_mentor/madlib.py'),
7070
'jupyter_mentor.madlib.MadLibView.observe_value_change': ( 'madlib.html#madlibview.observe_value_change',
7171
'jupyter_mentor/madlib.py')},
72-
'jupyter_mentor.student_course_overview': { 'jupyter_mentor.student_course_overview.StudentCourseOverview': ( 'student_course_overview.html#studentcourseoverview',
72+
'jupyter_mentor.student_course_overview': { 'jupyter_mentor.student_course_overview.FileDownloader': ( 'student_course_overview.html#filedownloader',
73+
'jupyter_mentor/student_course_overview.py'),
74+
'jupyter_mentor.student_course_overview.FileDownloader.__init__': ( 'student_course_overview.html#filedownloader.__init__',
75+
'jupyter_mentor/student_course_overview.py'),
76+
'jupyter_mentor.student_course_overview.StudentCourseOverview': ( 'student_course_overview.html#studentcourseoverview',
7377
'jupyter_mentor/student_course_overview.py'),
7478
'jupyter_mentor.student_course_overview.StudentCourseOverview.__init__': ( 'student_course_overview.html#studentcourseoverview.__init__',
7579
'jupyter_mentor/student_course_overview.py')},

jupyter_mentor/chatbot_tab.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ def prompt(self):
5656
kwargs = {key:value for key, value in zip(keys,values)}
5757
prompt = chat_prompt.format_prompt( **kwargs )
5858
bot = self.llm.invoke(prompt).content
59-
user = "\n".join([desc + ' ' + val for desc, val in zip(self.madlib_models[self.selected_index].descriptions, self.madlib_models[self.selected_index].values)])
59+
interm= [desc + ' ' + val for desc, val in zip(self.madlib_models[self.selected_index].descriptions, self.madlib_models[self.selected_index].values)]
60+
user = "\n".join(interm)
6061
return (user, bot)
6162

6263
def prompt_with_kwargs(self, kwargs):
6364
ret = self.llm.invoke(self.chat_prompt.format_prompt(**kwargs))
6465
return ret.content
6566

66-
# %% ../nbs/06_chatbot.ipynb 8
67+
# %% ../nbs/06_chatbot.ipynb 9
6768
class ChatBotView(widgets.VBox):
6869
""" This view also exists in 04_chatbot, but wea
6970
are overwriting it here
@@ -94,7 +95,7 @@ def __init__(self):
9495
self.hbox.children = (self.stack, self.submit_button)
9596
self.children = (self.chat, self.radio_buttons, self.hbox )
9697

97-
# %% ../nbs/06_chatbot.ipynb 10
98+
# %% ../nbs/06_chatbot.ipynb 11
9899
class ChatBot(ChatBotView):
99100
""" This view also exists in 04_chatbot, but wea
100101
are overwriting it here
@@ -122,9 +123,9 @@ def __init__(self, model):
122123
self.submit_button.on_click(self.on_click)
123124

124125
def on_click(self, change):
125-
for child in self.stack.children[self.selected_index].children:
126-
child.value = ''
127126
user, bot = self.model.prompt()
128127
self.chat.value = "USER: " + user + '\n\n' + "CHATBOT: " + bot + '\n\n'
129128
self.selected_index = 0
129+
for child in self.stack.children[self.selected_index].children:
130+
child.value = ''
130131

jupyter_mentor/educator_course_overview.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
__all__ = ['EducatorCourseOverview']
55

66
# %% ../nbs/04_educator_course_overview.ipynb 1
7+
from .llm import FileModel
78
from .file_viewer import FileViewer
89
import ipywidgets as widgets
910
from ipywidgets import VBox, HBox, HTML, Button, Label, Text, Textarea, Checkbox, Accordion, FileUpload
1011
from IPython.display import display, clear_output
1112
import ipyvuetify as v
1213
from traitlets import observe
1314

14-
# %% ../nbs/04_educator_course_overview.ipynb 2
15+
# %% ../nbs/04_educator_course_overview.ipynb 3
1516
class EducatorCourseOverview(VBox):
1617

17-
def __init__(self, file_viewer):
18+
def __init__(self):
1819
super().__init__()
1920

2021
# File Upload button

jupyter_mentor/student_course_overview.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self):
2525
children=["Download All"]
2626
)
2727
self.children = [self.file_chooser, self.download_button]
28+
2829

2930
# %% ../nbs/14_student_course_overview.ipynb 3
3031
class StudentCourseOverview(VBox):

nbs/00_main.ipynb

Lines changed: 69 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": 1,
23+
"execution_count": null,
2424
"id": "89293f18-ab92-426e-abf4-249f3e17727d",
2525
"metadata": {},
2626
"outputs": [],
@@ -32,13 +32,13 @@
3232
"from jupyter_mentor.student_profile import StudentProfile\n",
3333
"from jupyter_mentor.educator_course_overview import EducatorCourseOverview\n",
3434
"from jupyter_mentor.student_course_overview import StudentCourseOverview\n",
35-
"from jupyter_mentor.chatbot_tab import ChatBot, ChatBotModel, StudentChatBot, EducatorChatBot\n",
35+
"from jupyter_mentor.chatbot_tab import ChatBot, ChatBotModel\n",
3636
"from jupyter_mentor.file_viewer import FileViewerView"
3737
]
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 2,
41+
"execution_count": null,
4242
"id": "af80f333-81cd-4f2d-8f92-195b79a8e307",
4343
"metadata": {},
4444
"outputs": [],
@@ -55,35 +55,71 @@
5555
},
5656
{
5757
"cell_type": "code",
58-
"execution_count": 3,
58+
"execution_count": null,
5959
"id": "d25ddd77-b1e3-41e6-9254-686a04ee7633",
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
63-
"madlibs_list = [\n",
64-
" {'name': 'Open Prompt',\n",
65-
" 'description': '',\n",
66-
" 'variables': {\n",
67-
" 'input_text': 'value'\n",
68-
" }, \n",
69-
" 'template': '{input_text}' ,\n",
70-
" 'placeholder': 'Message AI chatbot...',\n",
71-
" },\n",
72-
" {\n",
73-
" 'name': 'Metaphor',\n",
74-
" 'variables': {\n",
75-
" 'concept': 'value'\n",
76-
" }, \n",
77-
" 'template': \"I'm having trouble understanding {concept}. Explain it as a metaphor\",\n",
78-
" 'description': \"I'm having trouble understanding...\", \n",
79-
" 'placeholder': 'why the sky is blue'\n",
63+
"student_madlibs = [\n",
64+
" { 'name': 'Open Prompt',\n",
65+
" 'template': '{input_text}',\n",
66+
" 'variables': ['input_text'],\n",
67+
" 'descriptions': [''],\n",
68+
" 'placeholders': ['Message AI chatbot...']\n",
69+
" }, {'name': 'Metaphor',\n",
70+
" 'template': \"I'm having trouble understanding {concept}. Please explain it as a metaphor\",\n",
71+
" 'variables': ['concept'],\n",
72+
" 'descriptions': [\"I'm having trouble understanding\"],\n",
73+
" 'placeholders': ['']\n",
74+
" }, {'name': 'Step-by-Step',\n",
75+
" 'template': \"I'm having trouble understanding {concept}. Please help me break it down into steps.\",\n",
76+
" 'variables': ['concept'],\n",
77+
" 'descriptions': [\"I'm having trouble understanding\"],\n",
78+
" 'placeholders': ['']\n",
79+
" }, {'name': 'Debate Partner',\n",
80+
" 'template': \"I want to debate about {concept}. Let's use the Socratic method. You are subject matter expert who is trying to convince me about it. You will speak first and then wait for me to respond.\",\n",
81+
" 'variables': ['concept'],\n",
82+
" 'descriptions': [\"I want to debate about\"],\n",
83+
" 'placeholders': ['']\n",
84+
" }\n",
85+
"]"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": null,
91+
"id": "19a93c82-481e-4e50-8e88-85f37b964d3d",
92+
"metadata": {},
93+
"outputs": [],
94+
"source": [
95+
"educator_madlibs = [\n",
96+
" { 'name': 'Open Prompt',\n",
97+
" 'template': '{input_text}',\n",
98+
" 'variables': ['input_text'],\n",
99+
" 'descriptions': [''],\n",
100+
" 'placeholders': ['Message AI chatbot...']\n",
101+
" }, {'name': 'Metaphor',\n",
102+
" 'template': \"I'm having trouble understanding {concept}. Please explain it as a metaphor\",\n",
103+
" 'variables': ['concept'],\n",
104+
" 'descriptions': [\"I'm having trouble understanding\"],\n",
105+
" 'placeholders': ['']\n",
106+
" }, {'name': 'Translate',\n",
107+
" 'template': \"Help me translate the following text into {language}: {text}\",\n",
108+
" 'variables': ['language', 'text'],\n",
109+
" 'descriptions': [\"Text\", \"Language\"],\n",
110+
" 'placeholders': ['', '']\n",
111+
" }, {'name': 'Quiz Questions',\n",
112+
" 'template': \"Help me generate 10 quiz questions about {concept}.\",\n",
113+
" 'variables': ['concept'],\n",
114+
" 'descriptions': [\"Quiz Topic\"],\n",
115+
" 'placeholders': ['']\n",
80116
" }\n",
81117
"]"
82118
]
83119
},
84120
{
85121
"cell_type": "code",
86-
"execution_count": 4,
122+
"execution_count": null,
87123
"id": "ff4ce152-adef-4c60-828a-8bbf68129209",
88124
"metadata": {},
89125
"outputs": [],
@@ -96,14 +132,14 @@
96132
" \n",
97133
" # initialize models\n",
98134
" # self.model = DataModel(FILENAME)\n",
99-
" self.educator_chatbot_model = ChatBotModel(madlibs_list)\n",
135+
" self.educator_chatbot_model = ChatBotModel(educator_madlibs)\n",
100136
"\n",
101137
" \n",
102138
" # initialize views\n",
103139
" self.first = Login()\n",
104140
" self.second = EducatorProfileView()\n",
105141
" self.file_viewer = FileViewerView()\n",
106-
" self.third = EducatorCourseOverview(self.file_viewer)\n",
142+
" self.third = EducatorCourseOverview()\n",
107143
" self.fourth = ChatBot(self.educator_chatbot_model)\n",
108144
" \n",
109145
" # Add tabs to the Tab widget\n",
@@ -127,40 +163,23 @@
127163
" self.selected_index = 2\n",
128164
" \n",
129165
" def switch_to_fourth(self, button):\n",
130-
" self.selected_index = 3\n",
131-
" "
166+
" self.selected_index = 3"
132167
]
133168
},
134169
{
135170
"cell_type": "code",
136-
"execution_count": 5,
171+
"execution_count": null,
137172
"id": "9ca28623-ed1f-4f1c-b671-462ee582040f",
138173
"metadata": {},
139-
"outputs": [
140-
{
141-
"data": {
142-
"application/vnd.jupyter.widget-view+json": {
143-
"model_id": "45777c8ce5e544ccb75ef60ea2d3f504",
144-
"version_major": 2,
145-
"version_minor": 0
146-
},
147-
"text/plain": [
148-
"EducatorMain(children=(Login(children=(Container(children=[Html(attributes={'title': 'a title'}, children=['Lo…"
149-
]
150-
},
151-
"execution_count": 5,
152-
"metadata": {},
153-
"output_type": "execute_result"
154-
}
155-
],
174+
"outputs": [],
156175
"source": [
157176
"educator_main = EducatorMain()\n",
158177
"educator_main"
159178
]
160179
},
161180
{
162181
"cell_type": "code",
163-
"execution_count": 8,
182+
"execution_count": null,
164183
"id": "7548d87a-94e3-4cdc-bb20-fe46ec366425",
165184
"metadata": {},
166185
"outputs": [],
@@ -173,13 +192,12 @@
173192
" \n",
174193
" # initialize models\n",
175194
" # self.model = EducatorModel(FILENAME)\n",
176-
" self.student_chatbot_model = ChatBotModel(madlibs_list)\n",
195+
" self.student_chatbot_model = ChatBotModel(student_madlibs)\n",
177196
"\n",
178197
" # initialize views\n",
179198
" self.first = Login()\n",
180199
" self.second = StudentProfile()\n",
181200
" self.file_viewer = FileViewerView()\n",
182-
" #self.third = StudentCourseOverview(self.file_viewer\n",
183201
" self.third = StudentCourseOverview()\n",
184202
" self.fourth = ChatBot(self.student_chatbot_model)\n",
185203
"\n",
@@ -190,7 +208,7 @@
190208
" self.set_title(0, 'LogIn')\n",
191209
" self.set_title(1, 'User Profile')\n",
192210
" self.set_title(2, 'Course Overview')\n",
193-
" self.set_title(3, 'Student Chatbox')\n",
211+
" self.set_title(3, 'Test/Assn Generator')\n",
194212
"\n",
195213
"\n",
196214
" # Add event handlers to \"Next\" buttons in each tab\n",
@@ -210,26 +228,10 @@
210228
},
211229
{
212230
"cell_type": "code",
213-
"execution_count": 9,
231+
"execution_count": null,
214232
"id": "36cabf8d-427b-4d24-9c5d-8a6f8e4ab6b5",
215233
"metadata": {},
216-
"outputs": [
217-
{
218-
"data": {
219-
"application/vnd.jupyter.widget-view+json": {
220-
"model_id": "5ba5c5efdcdb42fa8efc2fcc9c77d2b5",
221-
"version_major": 2,
222-
"version_minor": 0
223-
},
224-
"text/plain": [
225-
"StudentMain(children=(Login(children=(Container(children=[Html(attributes={'title': 'a title'}, children=['Log…"
226-
]
227-
},
228-
"execution_count": 9,
229-
"metadata": {},
230-
"output_type": "execute_result"
231-
}
232-
],
234+
"outputs": [],
233235
"source": [
234236
"student_main = StudentMain()\n",
235237
"student_main"
@@ -257,21 +259,9 @@
257259
],
258260
"metadata": {
259261
"kernelspec": {
260-
"display_name": "Python 3 (ipykernel)",
262+
"display_name": "python3",
261263
"language": "python",
262264
"name": "python3"
263-
},
264-
"language_info": {
265-
"codemirror_mode": {
266-
"name": "ipython",
267-
"version": 3
268-
},
269-
"file_extension": ".py",
270-
"mimetype": "text/x-python",
271-
"name": "python",
272-
"nbconvert_exporter": "python",
273-
"pygments_lexer": "ipython3",
274-
"version": "3.8.19"
275265
}
276266
},
277267
"nbformat": 4,

0 commit comments

Comments
 (0)