new double negation prompt + 10 responses instead of 5
Browse files- app.py +14 -4
- config/templates.py +12 -12
app.py
CHANGED
|
@@ -95,7 +95,7 @@ async def run_diagnoser(user_query: str, chosen_model: str, exercise_format: str
|
|
| 95 |
responses = await asyncio.gather(*tasks)
|
| 96 |
|
| 97 |
# pad up to 5 if needed
|
| 98 |
-
all_responses = list(responses) + [""] * (
|
| 99 |
|
| 100 |
# Return a tuple of exactly 5 responses.
|
| 101 |
return tuple(all_responses)
|
|
@@ -133,9 +133,9 @@ with gr.Blocks() as interface:
|
|
| 133 |
interactive=True,
|
| 134 |
)
|
| 135 |
sampling_count = gr.Dropdown(
|
| 136 |
-
choices=["1", "2", "3", "4", "5"],
|
| 137 |
value="1",
|
| 138 |
-
label="Sampling Count
|
| 139 |
interactive=True,
|
| 140 |
)
|
| 141 |
# Set up a change callback so that if the user selects "Claude 3.5", the exercise format updates to "XML"
|
|
@@ -163,6 +163,11 @@ with gr.Blocks() as interface:
|
|
| 163 |
diagnoser_response_3 = gr.Textbox(label="Response 3", interactive=False)
|
| 164 |
diagnoser_response_4 = gr.Textbox(label="Response 4", interactive=False)
|
| 165 |
diagnoser_response_5 = gr.Textbox(label="Response 5", interactive=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
with gr.TabItem("π€ Generate distractors"):
|
| 167 |
# Insert an HTML info icon with a tooltip at the top of the tab content.
|
| 168 |
gr.HTML(
|
|
@@ -212,7 +217,12 @@ with gr.Blocks() as interface:
|
|
| 212 |
diagnoser_response_2,
|
| 213 |
diagnoser_response_3,
|
| 214 |
diagnoser_response_4,
|
| 215 |
-
diagnoser_response_5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
]
|
| 217 |
)
|
| 218 |
|
|
|
|
| 95 |
responses = await asyncio.gather(*tasks)
|
| 96 |
|
| 97 |
# pad up to 5 if needed
|
| 98 |
+
all_responses = list(responses) + [""] * (10 - len(responses))
|
| 99 |
|
| 100 |
# Return a tuple of exactly 5 responses.
|
| 101 |
return tuple(all_responses)
|
|
|
|
| 133 |
interactive=True,
|
| 134 |
)
|
| 135 |
sampling_count = gr.Dropdown(
|
| 136 |
+
choices=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
|
| 137 |
value="1",
|
| 138 |
+
label="Sampling Count",
|
| 139 |
interactive=True,
|
| 140 |
)
|
| 141 |
# Set up a change callback so that if the user selects "Claude 3.5", the exercise format updates to "XML"
|
|
|
|
| 163 |
diagnoser_response_3 = gr.Textbox(label="Response 3", interactive=False)
|
| 164 |
diagnoser_response_4 = gr.Textbox(label="Response 4", interactive=False)
|
| 165 |
diagnoser_response_5 = gr.Textbox(label="Response 5", interactive=False)
|
| 166 |
+
diagnoser_response_6 = gr.Textbox(label="Response 6", interactive=False)
|
| 167 |
+
diagnoser_response_7 = gr.Textbox(label="Response 7", interactive=False)
|
| 168 |
+
diagnoser_response_8 = gr.Textbox(label="Response 8", interactive=False)
|
| 169 |
+
diagnoser_response_9 = gr.Textbox(label="Response 9", interactive=False)
|
| 170 |
+
diagnoser_response_10 = gr.Textbox(label="Response 10", interactive=False)
|
| 171 |
with gr.TabItem("π€ Generate distractors"):
|
| 172 |
# Insert an HTML info icon with a tooltip at the top of the tab content.
|
| 173 |
gr.HTML(
|
|
|
|
| 217 |
diagnoser_response_2,
|
| 218 |
diagnoser_response_3,
|
| 219 |
diagnoser_response_4,
|
| 220 |
+
diagnoser_response_5,
|
| 221 |
+
diagnoser_response_6,
|
| 222 |
+
diagnoser_response_7,
|
| 223 |
+
diagnoser_response_8,
|
| 224 |
+
diagnoser_response_9,
|
| 225 |
+
diagnoser_response_10
|
| 226 |
]
|
| 227 |
)
|
| 228 |
|
config/templates.py
CHANGED
|
@@ -21,11 +21,11 @@ diagnose_template = ChatPromptTemplate(
|
|
| 21 |
|
| 22 |
template_diagnose_double_negation = ChatPromptTemplate(
|
| 23 |
messages=[
|
| 24 |
-
("system", """
|
| 25 |
Here are some examples of double negatives:
|
| 26 |
|
| 27 |
<example 1>
|
| 28 |
-
<exercise
|
| 29 |
Stelling
|
| 30 |
Expertfolio wordt niet aangeboden door ENI.
|
| 31 |
|
|
@@ -35,14 +35,14 @@ template_diagnose_double_negation = ChatPromptTemplate(
|
|
| 35 |
|
| 36 |
Correct antwoord:
|
| 37 |
1. Deze stelling is niet correct
|
| 38 |
-
</exercise
|
| 39 |
<double negative explanation>
|
| 40 |
-
|
| 41 |
</double negative explanation>
|
| 42 |
</example 1>
|
| 43 |
|
| 44 |
<example 2>
|
| 45 |
-
<exercise
|
| 46 |
Vraag
|
| 47 |
Welk aspect hoort niet bij eenzaamheid?
|
| 48 |
|
|
@@ -53,10 +53,10 @@ template_diagnose_double_negation = ChatPromptTemplate(
|
|
| 53 |
4. Geen lijfelijk contact hebben
|
| 54 |
|
| 55 |
Correct antwoord:
|
| 56 |
-
|
| 57 |
-
</exercise
|
| 58 |
<double negative explanation>
|
| 59 |
-
|
| 60 |
</double negative explanation>
|
| 61 |
</example 2>.
|
| 62 |
If it's obvious that there is or isn't a double negative in this exercise, just give a short one-sentence diagnosis on this.
|
|
@@ -167,16 +167,16 @@ diagnose_scorecard_template = ChatPromptTemplate(
|
|
| 167 |
(and a third icon if need be: - β means the diagnosis is unclear)
|
| 168 |
The scorecard should always look like this:
|
| 169 |
<template>
|
| 170 |
-
The exercise does not contain/contains a double negative: β
/β -- The correct answer does not/does stand out: β
/β -- None/Some of the distractors are too obviously false: β
/β -- None/Some of the distractors are actually also kinda correct: β
/β
|
| 171 |
</template>
|
| 172 |
<example 1>
|
| 173 |
-
The exercise doesn't contain a double negative: β
-- The correct answer does not stand out: β
-- None of the distractors are too obviously false: β
-- None of the distractors are actually also kinda correct: β
|
| 174 |
</example 1>
|
| 175 |
<example 2>
|
| 176 |
-
The exercise doesn't contain a double negative: β
-- The correct answer does stand out: β -- None of the distractors are too obviously false: β
-- Some of the distractors are actually also kinda correct: β
|
| 177 |
</example 2>
|
| 178 |
<example 3>
|
| 179 |
-
The exercise contains a double negative: β -- The correct answer does not stand out: β
-- Some of the distractors are too obviously false: β -- None of the distractors are actually also kinda correct: β
|
| 180 |
</example 3>
|
| 181 |
"""),
|
| 182 |
("human", "{combined_diagnosis}")
|
|
|
|
| 21 |
|
| 22 |
template_diagnose_double_negation = ChatPromptTemplate(
|
| 23 |
messages=[
|
| 24 |
+
("system", """Analyze a multiple-choice exercise for the presence of double negatives: either two negations in the question/statement itself, or a negation in the question/statement AND in an answer option.
|
| 25 |
Here are some examples of double negatives:
|
| 26 |
|
| 27 |
<example 1>
|
| 28 |
+
<exercise>
|
| 29 |
Stelling
|
| 30 |
Expertfolio wordt niet aangeboden door ENI.
|
| 31 |
|
|
|
|
| 35 |
|
| 36 |
Correct antwoord:
|
| 37 |
1. Deze stelling is niet correct
|
| 38 |
+
</exercise>
|
| 39 |
<double negative explanation>
|
| 40 |
+
The statement itself contains one negation (wordt 'niet' aangeboden), and one answer option contains another (is 'niet' correct). Interpreted together, this forms a statement with a double negation ('het is niet correct dat Expertfolio niet wordt aangeboden' is een dubbele ontkenning).
|
| 41 |
</double negative explanation>
|
| 42 |
</example 1>
|
| 43 |
|
| 44 |
<example 2>
|
| 45 |
+
<exercise>
|
| 46 |
Vraag
|
| 47 |
Welk aspect hoort niet bij eenzaamheid?
|
| 48 |
|
|
|
|
| 53 |
4. Geen lijfelijk contact hebben
|
| 54 |
|
| 55 |
Correct antwoord:
|
| 56 |
+
1. Betekenisvolle relaties hebben
|
| 57 |
+
</exercise>
|
| 58 |
<double negative explanation>
|
| 59 |
+
The question itself contains one negation (hoort 'niet' bij), and an answer option contains the second ('Geen' lijfelijk contact). Together, the resulting statement contains a double negation ('Geen lichamelijk contact hebben hoort niet bij eenzaamheid').
|
| 60 |
</double negative explanation>
|
| 61 |
</example 2>.
|
| 62 |
If it's obvious that there is or isn't a double negative in this exercise, just give a short one-sentence diagnosis on this.
|
|
|
|
| 167 |
(and a third icon if need be: - β means the diagnosis is unclear)
|
| 168 |
The scorecard should always look like this:
|
| 169 |
<template>
|
| 170 |
+
1. The exercise does not contain/contains a double negative: β
/β -- 2. The correct answer does not/does stand out: β
/β -- 3. None/Some of the distractors are too obviously false: β
/β -- 4. None/Some of the distractors are actually also kinda correct: β
/β
|
| 171 |
</template>
|
| 172 |
<example 1>
|
| 173 |
+
1. The exercise doesn't contain a double negative: β
-- 2. The correct answer does not stand out: β
-- 3. None of the distractors are too obviously false: β
-- 4. None of the distractors are actually also kinda correct: β
|
| 174 |
</example 1>
|
| 175 |
<example 2>
|
| 176 |
+
1. The exercise doesn't contain a double negative: β
-- 2. The correct answer does stand out: β -- 3. None of the distractors are too obviously false: β
-- 4. Some of the distractors are actually also kinda correct: β
|
| 177 |
</example 2>
|
| 178 |
<example 3>
|
| 179 |
+
1. The exercise contains a double negative: β -- 2. The correct answer does not stand out: β
-- 3. Some of the distractors are too obviously false: β -- 4. None of the distractors are actually also kinda correct: β
|
| 180 |
</example 3>
|
| 181 |
"""),
|
| 182 |
("human", "{combined_diagnosis}")
|