Spaces:
Sleeping
Sleeping
Shreeti Shrestha
commited on
Commit
·
674a813
1
Parent(s):
77708a2
cleanup
Browse files- pages/llm_tutor.py +2 -2
- pages/textbook.py +7 -69
- utils/conceptexcerpts.py +2 -10
- utils/exampleexcerpts.py +9 -10
- utils/questions_dataset.py +4 -2
pages/llm_tutor.py
CHANGED
@@ -51,7 +51,8 @@ with st.sidebar:
|
|
51 |
st.session_state.chat_title = f'ChatSession-{st.session_state.chat_id}'
|
52 |
|
53 |
|
54 |
-
st.
|
|
|
55 |
next_btn = st.button("Click here when finished")
|
56 |
|
57 |
st.write("Use this AI Tutor to help you understand the concepts. You can ask it to explain the concepts, provide examples, or clarify any doubts you have.")
|
@@ -68,7 +69,6 @@ try:
|
|
68 |
except:
|
69 |
st.session_state.messages = []
|
70 |
st.session_state.gemini_history = []
|
71 |
-
print('new_cache made')
|
72 |
|
73 |
sys_prompt = system_instruction % (
|
74 |
st.session_state.prequiz_df['num_correct'][0],
|
|
|
51 |
st.session_state.chat_title = f'ChatSession-{st.session_state.chat_id}'
|
52 |
|
53 |
|
54 |
+
st.set_page_config(page_title="LSAT Group A", page_icon="📘")
|
55 |
+
st.title("📘Logical Reasoning: Group A")
|
56 |
next_btn = st.button("Click here when finished")
|
57 |
|
58 |
st.write("Use this AI Tutor to help you understand the concepts. You can ask it to explain the concepts, provide examples, or clarify any doubts you have.")
|
|
|
69 |
except:
|
70 |
st.session_state.messages = []
|
71 |
st.session_state.gemini_history = []
|
|
|
72 |
|
73 |
sys_prompt = system_instruction % (
|
74 |
st.session_state.prequiz_df['num_correct'][0],
|
pages/textbook.py
CHANGED
@@ -1,65 +1,12 @@
|
|
1 |
-
import time
|
2 |
-
import os
|
3 |
-
import joblib
|
4 |
import streamlit as st
|
5 |
from utils.conceptexcerpts import concept_excerpts
|
6 |
from utils.exampleexcerpts import example_excerpts
|
7 |
-
from
|
8 |
|
9 |
-
st.set_page_config(page_title="LSAT
|
10 |
-
st.title("📘
|
11 |
|
12 |
-
|
13 |
-
MODEL_ROLE = 'ai'
|
14 |
-
AI_AVATAR_ICON = '✨'
|
15 |
-
|
16 |
-
# Create a data/ folder if it doesn't already exist
|
17 |
-
try:
|
18 |
-
os.mkdir('data/groupa')
|
19 |
-
except:
|
20 |
-
# data/ folder already exists
|
21 |
-
pass
|
22 |
-
|
23 |
-
# Load past chats (if available)
|
24 |
-
try:
|
25 |
-
past_chats: dict = joblib.load('data/past_chats_list')
|
26 |
-
except:
|
27 |
-
past_chats = {}
|
28 |
-
|
29 |
-
# Sidebar allows a list of past chats
|
30 |
-
with st.sidebar:
|
31 |
-
st.write('# Past Chats')
|
32 |
-
if st.session_state.get('chat_id') is None:
|
33 |
-
st.session_state.chat_id = st.selectbox(
|
34 |
-
label='Pick a past chat',
|
35 |
-
options=[new_chat_id] + list(past_chats.keys()),
|
36 |
-
format_func=lambda x: past_chats.get(x, 'New Chat'),
|
37 |
-
placeholder='_',
|
38 |
-
)
|
39 |
-
else:
|
40 |
-
# This will happen the first time AI response comes in
|
41 |
-
st.session_state.chat_id = st.selectbox(
|
42 |
-
label='Pick a past chat',
|
43 |
-
options=[new_chat_id, st.session_state.chat_id] + list(past_chats.keys()),
|
44 |
-
index=1,
|
45 |
-
format_func=lambda x: past_chats.get(x, 'New Chat' if x != st.session_state.chat_id else st.session_state.chat_title),
|
46 |
-
placeholder='_',
|
47 |
-
)
|
48 |
-
|
49 |
-
# Save new chats after a message has been sent to AI
|
50 |
-
st.session_state.chat_title = f'ChatSession-{st.session_state.chat_id}'
|
51 |
-
|
52 |
-
# Chat history (allows to ask multiple questions)
|
53 |
-
try:
|
54 |
-
st.session_state.messages = joblib.load(
|
55 |
-
f'data/{st.session_state.chat_id}-st_messages'
|
56 |
-
)
|
57 |
-
st.session_state.gemini_history = joblib.load(
|
58 |
-
f'data/{st.session_state.chat_id}-gemini_messages'
|
59 |
-
)
|
60 |
-
except:
|
61 |
-
st.session_state.messages = []
|
62 |
-
st.session_state.gemini_history = []
|
63 |
|
64 |
choices = ["A", "B", "C", "D", "E"]
|
65 |
|
@@ -74,24 +21,15 @@ st.markdown(concept_excerpts[topic])
|
|
74 |
st.subheader("Practice Question")
|
75 |
q = example_excerpts[topic]
|
76 |
st.write(q[0])
|
77 |
-
|
78 |
-
|
79 |
|
80 |
# Show answer
|
81 |
if st.checkbox("Show Answer"):
|
82 |
st.success(f"Correct Answer: {q[1]}")
|
83 |
|
84 |
-
# Save to file
|
85 |
-
joblib.dump(
|
86 |
-
st.session_state.messages,
|
87 |
-
f'data/{st.session_state.chat_id}-st_messages',
|
88 |
-
)
|
89 |
-
joblib.dump(
|
90 |
-
st.session_state.gemini_history,
|
91 |
-
f'data/{st.session_state.chat_id}-gemini_messages',
|
92 |
-
)
|
93 |
|
94 |
-
next_page = st.button("
|
95 |
|
96 |
if next_page:
|
97 |
st.switch_page("pages/postquiz.py")
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from utils.conceptexcerpts import concept_excerpts
|
3 |
from utils.exampleexcerpts import example_excerpts
|
4 |
+
from utils.misc import end_session, display_pre_quiz
|
5 |
|
6 |
+
st.set_page_config(page_title="LSAT Group B", page_icon="📘")
|
7 |
+
st.title("📘Logical Reasoning: Group B")
|
8 |
|
9 |
+
display_pre_quiz()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
choices = ["A", "B", "C", "D", "E"]
|
12 |
|
|
|
21 |
st.subheader("Practice Question")
|
22 |
q = example_excerpts[topic]
|
23 |
st.write(q[0])
|
24 |
+
for i, choice in enumerate(choices):
|
25 |
+
st.write(f"{i}). {choice}")
|
26 |
|
27 |
# Show answer
|
28 |
if st.checkbox("Show Answer"):
|
29 |
st.success(f"Correct Answer: {q[1]}")
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
next_page = st.button("Click here to end session")
|
33 |
|
34 |
if next_page:
|
35 |
st.switch_page("pages/postquiz.py")
|
utils/conceptexcerpts.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
Assumption = """
|
2 |
-
|
3 |
Assumption questions ask you to identify the missing link in the logic of the stimulus
|
4 |
argument.
|
5 |
Some example question stems are
|
@@ -33,7 +33,7 @@ was irrelevant to the strength of the structure.
|
|
33 |
|
34 |
|
35 |
Weaken_Strengthen = """
|
36 |
-
|
37 |
You will have to attack a significant number of weaken and strengthen questions in
|
38 |
order to end up with a respectable LSAT score. This question type also sometimes
|
39 |
appears in the Reading Comprehension section of the exam. Since the LSAT is set up to
|
@@ -83,7 +83,6 @@ argument.
|
|
83 |
"""
|
84 |
Conclusion = """
|
85 |
|
86 |
-
Question Type: Conclusion
|
87 |
These questions ask you to draw a conclusion from evidence presented within the stimulus.
|
88 |
In some cases, the conclusion that you are asked to draw is based on only part of
|
89 |
the stimulus and will not necessarily be the main idea of the stimulus paragraph. Some
|
@@ -110,7 +109,6 @@ Look for the logical end of the chain of reasoning started in the stimulus argum
|
|
110 |
"""
|
111 |
Method_of_Argument = """
|
112 |
|
113 |
-
Question Type: Method of Argument
|
114 |
Method of argument questions ask you to recognize the way that the argument is put
|
115 |
together. You must choose the answer that properly describes the structure of the stimulus
|
116 |
argument. Some, but certainly not all, method of argument questions are based on
|
@@ -136,7 +134,6 @@ that you can recognize the argument amidst the tricky language.
|
|
136 |
"""
|
137 |
Principle = """
|
138 |
|
139 |
-
Question Type: Principle
|
140 |
These questions ask you to identify a rule, or principle, that supports the stimulus argument
|
141 |
presented. In some cases, you are required to choose an argument that conforms
|
142 |
to the stimulus principle.
|
@@ -159,7 +156,6 @@ content.
|
|
159 |
"""
|
160 |
Point_of_Contention = """
|
161 |
|
162 |
-
Question Type: Point of Contention
|
163 |
These questions always involve a dialogue between two people who disagree about
|
164 |
something. You are expected to choose the answer that best describes the crux of the
|
165 |
disagreement.
|
@@ -181,7 +177,6 @@ correct answer.
|
|
181 |
"""
|
182 |
Role_of_Fact = """
|
183 |
|
184 |
-
Question Type: Role of Fact
|
185 |
Some of the questions ask about the role, or function, of a specific fact that is included
|
186 |
in the stimulus argument.
|
187 |
|
@@ -202,7 +197,6 @@ too narrow or too broad, or beyond the scope of the stimulus argument.
|
|
202 |
"""
|
203 |
Flaw = """
|
204 |
|
205 |
-
Question Type: Flaw
|
206 |
These questions ask you to identify an error of reasoning in the stimulus argument.
|
207 |
Some sample question stems are
|
208 |
1. Which one of the following, if true, identifies a flaw in the plan for the program?
|
@@ -224,7 +218,6 @@ taking something for granted that is not necessarily true.
|
|
224 |
"""
|
225 |
Paradox = """
|
226 |
|
227 |
-
Question Type: Paradox
|
228 |
A paradox arises when you are presented with two statements that are both true, yet
|
229 |
they appear to be mutually contradictory. The key words to help you spot paradox question
|
230 |
stems are “explain” and “reconcile.”
|
@@ -249,7 +242,6 @@ unsound” is poorly defined.
|
|
249 |
"""
|
250 |
Parallel_Structure = """
|
251 |
|
252 |
-
Question Type: Parallel Structure
|
253 |
These questions ask you to match up two arguments that share structural characteristics.
|
254 |
There are usually two parallel structure questions in each Logical Reasoning section. They
|
255 |
are usually in the second half of the section, and they can usually be recognized by their
|
|
|
1 |
Assumption = """
|
2 |
+
|
3 |
Assumption questions ask you to identify the missing link in the logic of the stimulus
|
4 |
argument.
|
5 |
Some example question stems are
|
|
|
33 |
|
34 |
|
35 |
Weaken_Strengthen = """
|
36 |
+
|
37 |
You will have to attack a significant number of weaken and strengthen questions in
|
38 |
order to end up with a respectable LSAT score. This question type also sometimes
|
39 |
appears in the Reading Comprehension section of the exam. Since the LSAT is set up to
|
|
|
83 |
"""
|
84 |
Conclusion = """
|
85 |
|
|
|
86 |
These questions ask you to draw a conclusion from evidence presented within the stimulus.
|
87 |
In some cases, the conclusion that you are asked to draw is based on only part of
|
88 |
the stimulus and will not necessarily be the main idea of the stimulus paragraph. Some
|
|
|
109 |
"""
|
110 |
Method_of_Argument = """
|
111 |
|
|
|
112 |
Method of argument questions ask you to recognize the way that the argument is put
|
113 |
together. You must choose the answer that properly describes the structure of the stimulus
|
114 |
argument. Some, but certainly not all, method of argument questions are based on
|
|
|
134 |
"""
|
135 |
Principle = """
|
136 |
|
|
|
137 |
These questions ask you to identify a rule, or principle, that supports the stimulus argument
|
138 |
presented. In some cases, you are required to choose an argument that conforms
|
139 |
to the stimulus principle.
|
|
|
156 |
"""
|
157 |
Point_of_Contention = """
|
158 |
|
|
|
159 |
These questions always involve a dialogue between two people who disagree about
|
160 |
something. You are expected to choose the answer that best describes the crux of the
|
161 |
disagreement.
|
|
|
177 |
"""
|
178 |
Role_of_Fact = """
|
179 |
|
|
|
180 |
Some of the questions ask about the role, or function, of a specific fact that is included
|
181 |
in the stimulus argument.
|
182 |
|
|
|
197 |
"""
|
198 |
Flaw = """
|
199 |
|
|
|
200 |
These questions ask you to identify an error of reasoning in the stimulus argument.
|
201 |
Some sample question stems are
|
202 |
1. Which one of the following, if true, identifies a flaw in the plan for the program?
|
|
|
218 |
"""
|
219 |
Paradox = """
|
220 |
|
|
|
221 |
A paradox arises when you are presented with two statements that are both true, yet
|
222 |
they appear to be mutually contradictory. The key words to help you spot paradox question
|
223 |
stems are “explain” and “reconcile.”
|
|
|
242 |
"""
|
243 |
Parallel_Structure = """
|
244 |
|
|
|
245 |
These questions ask you to match up two arguments that share structural characteristics.
|
246 |
There are usually two parallel structure questions in each Logical Reasoning section. They
|
247 |
are usually in the second half of the section, and they can usually be recognized by their
|
utils/exampleexcerpts.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
Assumption_q = f"""
|
2 |
|
3 |
-
Sample Assumption Question \n
|
4 |
Consider the following example: \n
|
5 |
1. The birth rate in Country X is down this year by 12% compared to last year. The
|
6 |
death rate in Country X has remained stable for several years. Therefore, the
|
@@ -47,7 +46,7 @@ must be correct.
|
|
47 |
"""
|
48 |
|
49 |
Weaken_Strengthen_q = """
|
50 |
-
|
51 |
Consider the following example: \n
|
52 |
1. More and more computer software that is capable of correcting not just spelling,
|
53 |
but also grammar and punctuation is being developed. Therefore, it is increasingly
|
@@ -80,7 +79,7 @@ likely to be true. \n
|
|
80 |
"""
|
81 |
|
82 |
Conclusion_q = """
|
83 |
-
|
84 |
Consider the following example: \n
|
85 |
1. Physician: The continued use of this drug to treat patients with a certain disease
|
86 |
cannot be adequately supported by the proposition that any drug that treats the
|
@@ -110,7 +109,7 @@ the drug should be considered when deciding whether to use the drug.
|
|
110 |
"""
|
111 |
|
112 |
Method_of_Argument_q = """
|
113 |
-
|
114 |
Consider the following example: \n
|
115 |
1. It is widely accepted that eating sugar can cause weight gain. Indeed, many people
|
116 |
who are susceptible to weight gain report that, in their own experience, eating
|
@@ -140,7 +139,7 @@ consumption are, in fact, caused by stress. \n
|
|
140 |
"""
|
141 |
|
142 |
Principle_q = """
|
143 |
-
|
144 |
Consider the following example: \n
|
145 |
1. The best way to create a successful party is to visualize the guests discussing it with
|
146 |
friends the next day. The hostess should first decide what aspects of the party will
|
@@ -173,7 +172,7 @@ rather than backward. \n
|
|
173 |
"""
|
174 |
|
175 |
Point_of_Contention_q = """
|
176 |
-
|
177 |
Consider the following example: \n
|
178 |
1. Jason: The Internet is making more information available to more people than
|
179 |
ever before in history. So, people can simply learn all they need to know without
|
@@ -198,7 +197,7 @@ direct public access to information. Mark thinks that the opposite will occur.
|
|
198 |
"""
|
199 |
|
200 |
Role_of_Fact_q = """
|
201 |
-
|
202 |
Consider the following example: \n
|
203 |
1. Some environmentalists have argued that there are two independently sufficient
|
204 |
justifications for recycling waste materials: one based on economics and the other
|
@@ -228,7 +227,7 @@ to shore up the reasons given by environmentalists. \n
|
|
228 |
"""
|
229 |
|
230 |
Flaw_q = """
|
231 |
-
|
232 |
Consider the following example: \n
|
233 |
1. Giant Motors is attempting to dominate the automobile market by promoting its
|
234 |
products with an expensive television advertising campaign. But, the results of recent
|
@@ -257,7 +256,7 @@ market. Each of the other answer choices describes an error in reasoning that is
|
|
257 |
to the stimulus argument. \n
|
258 |
"""
|
259 |
Paradox_q = """
|
260 |
-
|
261 |
Consider the following example: \n
|
262 |
1. Researchers concur with one another on the issue of the harm that can result when
|
263 |
children are exposed to microscopic asbestos fibers. The resulting disease, asbestosis,
|
@@ -295,7 +294,7 @@ seemingly logical inconsistency inherent in the researchers’ positions. \n
|
|
295 |
"""
|
296 |
|
297 |
Parallel_Structure_q = """
|
298 |
-
|
299 |
Consider the following example: \n
|
300 |
1. Murcheson’s drawing of the Lincoln Monument contains several inaccuracies.
|
301 |
Therefore, your attempt to reproduce the drawing of the monument will not be a
|
|
|
1 |
Assumption_q = f"""
|
2 |
|
|
|
3 |
Consider the following example: \n
|
4 |
1. The birth rate in Country X is down this year by 12% compared to last year. The
|
5 |
death rate in Country X has remained stable for several years. Therefore, the
|
|
|
46 |
"""
|
47 |
|
48 |
Weaken_Strengthen_q = """
|
49 |
+
|
50 |
Consider the following example: \n
|
51 |
1. More and more computer software that is capable of correcting not just spelling,
|
52 |
but also grammar and punctuation is being developed. Therefore, it is increasingly
|
|
|
79 |
"""
|
80 |
|
81 |
Conclusion_q = """
|
82 |
+
|
83 |
Consider the following example: \n
|
84 |
1. Physician: The continued use of this drug to treat patients with a certain disease
|
85 |
cannot be adequately supported by the proposition that any drug that treats the
|
|
|
109 |
"""
|
110 |
|
111 |
Method_of_Argument_q = """
|
112 |
+
|
113 |
Consider the following example: \n
|
114 |
1. It is widely accepted that eating sugar can cause weight gain. Indeed, many people
|
115 |
who are susceptible to weight gain report that, in their own experience, eating
|
|
|
139 |
"""
|
140 |
|
141 |
Principle_q = """
|
142 |
+
|
143 |
Consider the following example: \n
|
144 |
1. The best way to create a successful party is to visualize the guests discussing it with
|
145 |
friends the next day. The hostess should first decide what aspects of the party will
|
|
|
172 |
"""
|
173 |
|
174 |
Point_of_Contention_q = """
|
175 |
+
|
176 |
Consider the following example: \n
|
177 |
1. Jason: The Internet is making more information available to more people than
|
178 |
ever before in history. So, people can simply learn all they need to know without
|
|
|
197 |
"""
|
198 |
|
199 |
Role_of_Fact_q = """
|
200 |
+
|
201 |
Consider the following example: \n
|
202 |
1. Some environmentalists have argued that there are two independently sufficient
|
203 |
justifications for recycling waste materials: one based on economics and the other
|
|
|
227 |
"""
|
228 |
|
229 |
Flaw_q = """
|
230 |
+
|
231 |
Consider the following example: \n
|
232 |
1. Giant Motors is attempting to dominate the automobile market by promoting its
|
233 |
products with an expensive television advertising campaign. But, the results of recent
|
|
|
256 |
to the stimulus argument. \n
|
257 |
"""
|
258 |
Paradox_q = """
|
259 |
+
|
260 |
Consider the following example: \n
|
261 |
1. Researchers concur with one another on the issue of the harm that can result when
|
262 |
children are exposed to microscopic asbestos fibers. The resulting disease, asbestosis,
|
|
|
294 |
"""
|
295 |
|
296 |
Parallel_Structure_q = """
|
297 |
+
|
298 |
Consider the following example: \n
|
299 |
1. Murcheson’s drawing of the Lincoln Monument contains several inaccuracies.
|
300 |
Therefore, your attempt to reproduce the drawing of the monument will not be a
|
utils/questions_dataset.py
CHANGED
@@ -62,8 +62,10 @@ system_instruction = """You are an AI tutor that teaches users LSAT Logical Reas
|
|
62 |
Role Play: (%d/%d)
|
63 |
Strengthen: (%d/%d)
|
64 |
Weaken the argument: (%d/%d)
|
65 |
-
Based on this, classify them as Beginner / Intermediate / Advanced.
|
|
|
66 |
Question the user to ensure that they understand the material.
|
67 |
-
Use practice questions from the tool to ensure they understand the material.
|
|
|
68 |
Never give a one word answer. Always keep the conversation moving.
|
69 |
Once the user has studied all the topics, prompt them to press the next button. """
|
|
|
62 |
Role Play: (%d/%d)
|
63 |
Strengthen: (%d/%d)
|
64 |
Weaken the argument: (%d/%d)
|
65 |
+
Based on this, classify them as Beginner / Intermediate / Advanced.
|
66 |
+
Walk through the student on all topics, but focus on the ones they struggle with.
|
67 |
Question the user to ensure that they understand the material.
|
68 |
+
Use practice questions from the tool to ensure they understand the material.
|
69 |
+
If no practice questions are found in the tool for a certain subtopic, find general practice questions on that subtopic.
|
70 |
Never give a one word answer. Always keep the conversation moving.
|
71 |
Once the user has studied all the topics, prompt them to press the next button. """
|