improved scorecard propmt by adding standardized exercise as context
Browse files- app/ui/diagnoser_tab.py +6 -1
- chains/diagnoser/diagnoser_chain.py +1 -1
- config/system_prompt_texts.py +1 -1
- config/templates.py +5 -2
app/ui/diagnoser_tab.py
CHANGED
|
@@ -51,7 +51,12 @@ def build_diagnoser_tab():
|
|
| 51 |
# Create 10 Response textboxes
|
| 52 |
with gr.Column():
|
| 53 |
diagnoser_responses = [
|
| 54 |
-
gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
for i in range(10)
|
| 56 |
]
|
| 57 |
|
|
|
|
| 51 |
# Create 10 Response textboxes
|
| 52 |
with gr.Column():
|
| 53 |
diagnoser_responses = [
|
| 54 |
+
gr.Textbox(
|
| 55 |
+
label=f"Response {i + 1}",
|
| 56 |
+
interactive=False,
|
| 57 |
+
visible=(i == 0),
|
| 58 |
+
lines=30
|
| 59 |
+
)
|
| 60 |
for i in range(10)
|
| 61 |
]
|
| 62 |
|
chains/diagnoser/diagnoser_chain.py
CHANGED
|
@@ -41,7 +41,7 @@ class DiagnoserChain(BaseModel):
|
|
| 41 |
|
| 42 |
# Step 4: Generate a one-line scorecard
|
| 43 |
prompt = await self.template_diagnose_scorecard.aformat_prompt(
|
| 44 |
-
combined_diagnosis=combined_diagnosis
|
| 45 |
)
|
| 46 |
scorecard_messages = prompt.to_messages()
|
| 47 |
scorecard_response = await self.llm_4o.ainvoke(scorecard_messages)
|
|
|
|
| 41 |
|
| 42 |
# Step 4: Generate a one-line scorecard
|
| 43 |
prompt = await self.template_diagnose_scorecard.aformat_prompt(
|
| 44 |
+
combined_diagnosis=combined_diagnosis, standardized_exercise=standardized_exercise
|
| 45 |
)
|
| 46 |
scorecard_messages = prompt.to_messages()
|
| 47 |
scorecard_response = await self.llm_4o.ainvoke(scorecard_messages)
|
config/system_prompt_texts.py
CHANGED
|
@@ -758,7 +758,7 @@ After lots of iterative prep and reasoning, considering a wide range of options,
|
|
| 758 |
|
| 759 |
## Pointers
|
| 760 |
- Try to exactly match the content and language level in the learning objective. If it's stated in simple words, use equally simple words in the exercises as well.
|
| 761 |
-
- Avoid the use of unnecessarily strong false statements or distractors using words like "all", "never" or "exclusively" etc.,
|
| 762 |
- Output format doesn't matter, prioritize careful reasoning.
|
| 763 |
"""
|
| 764 |
|
|
|
|
| 758 |
|
| 759 |
## Pointers
|
| 760 |
- Try to exactly match the content and language level in the learning objective. If it's stated in simple words, use equally simple words in the exercises as well.
|
| 761 |
+
- Avoid the use of unnecessarily strong false statements or distractors using words like "all", "never" or "exclusively" etc., unless the correct answer is equally extreme. Otherwise, distractors using such strong claims are too easy to dismiss. For example: instead of your false statement being "De *enige* factor die slaapkwaliteit beïnvloedt, is consistent naar bed gaan", it is better to give a less extreme (and therefore more plausible-sounding) statement, like: "De hoofdfactor die slaapkwaliteit beïnvloedt, is consistent naar bed gaan".
|
| 762 |
- Output format doesn't matter, prioritize careful reasoning.
|
| 763 |
"""
|
| 764 |
|
config/templates.py
CHANGED
|
@@ -119,9 +119,12 @@ diagnose_scorecard_template = ChatPromptTemplate(
|
|
| 119 |
</example 3>
|
| 120 |
Oftentimes, diagnoses will be elaborate and quite nuanced, first viewing the issue from different angles, considering both scenarios of passing and failing equally. For this reason, when deciding on your binary classification, you should focus only on the very last concluding sentences of each diagnosis to determine a pass or fail.
|
| 121 |
"""),
|
| 122 |
-
("human", "
|
|
|
|
|
|
|
|
|
|
| 123 |
],
|
| 124 |
-
input_variables=["combined_diagnosis"]
|
| 125 |
)
|
| 126 |
|
| 127 |
|
|
|
|
| 119 |
</example 3>
|
| 120 |
Oftentimes, diagnoses will be elaborate and quite nuanced, first viewing the issue from different angles, considering both scenarios of passing and failing equally. For this reason, when deciding on your binary classification, you should focus only on the very last concluding sentences of each diagnosis to determine a pass or fail.
|
| 121 |
"""),
|
| 122 |
+
("human", "For context, here is the exercise that's being diagnose:\n"
|
| 123 |
+
"{standardized_exercise}\n\n"
|
| 124 |
+
"Here are the diagnoses:\n"
|
| 125 |
+
"{combined_diagnosis}")
|
| 126 |
],
|
| 127 |
+
input_variables=["combined_diagnosis", "standardized_exercise"]
|
| 128 |
)
|
| 129 |
|
| 130 |
|