Spaces:
Runtime error
Runtime error
Yew Chong
commited on
Commit
•
565eabc
1
Parent(s):
8687f86
retrieve prompt template from txt file
Browse files- streamlit/app8.py +8 -0
- templates/grader.txt +75 -0
- templates/patient.txt +24 -0
streamlit/app8.py
CHANGED
@@ -154,6 +154,10 @@ Question:
|
|
154 |
Remember, answer in a short and sweet manner, don't talk too much.
|
155 |
Your reply:
|
156 |
"""
|
|
|
|
|
|
|
|
|
157 |
if "TEMPLATE" not in st.session_state:
|
158 |
st.session_state.TEMPLATE = TEMPLATE
|
159 |
|
@@ -255,6 +259,10 @@ Student's final diagnosis:
|
|
255 |
|
256 |
Your grade:
|
257 |
"""
|
|
|
|
|
|
|
|
|
258 |
if "TEMPLATE2" not in st.session_state:
|
259 |
st.session_state.TEMPLATE2 = TEMPLATE2
|
260 |
|
|
|
154 |
Remember, answer in a short and sweet manner, don't talk too much.
|
155 |
Your reply:
|
156 |
"""
|
157 |
+
|
158 |
+
with open('templates/patient.txt', 'r') as file:
|
159 |
+
TEMPLATE = file.read()
|
160 |
+
|
161 |
if "TEMPLATE" not in st.session_state:
|
162 |
st.session_state.TEMPLATE = TEMPLATE
|
163 |
|
|
|
259 |
|
260 |
Your grade:
|
261 |
"""
|
262 |
+
|
263 |
+
with open('templates/grader.txt', 'r') as file:
|
264 |
+
TEMPLATE2 = file.read()
|
265 |
+
|
266 |
if "TEMPLATE2" not in st.session_state:
|
267 |
st.session_state.TEMPLATE2 = TEMPLATE2
|
268 |
|
templates/grader.txt
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
You are a teacher for medical students. You are grading a medical student on their OSCE, the Object Structured Clinical Examination.
|
2 |
+
|
3 |
+
The rubrics will consist of 4 parts: history taking for x, y, z, diagnos
|
4 |
+
|
5 |
+
Your task is to provide an overall assessment of a student's diagnosis, based on the rubrics provided.
|
6 |
+
|
7 |
+
=================================================================
|
8 |
+
|
9 |
+
You will be provided with the following information:
|
10 |
+
1. The rubrics that the student should be judged based upon.
|
11 |
+
2. The conversation history between the medical student and the patient.
|
12 |
+
3. The final diagnosis that the student will make.
|
13 |
+
|
14 |
+
=================================================================
|
15 |
+
|
16 |
+
Your task is as follows:
|
17 |
+
1. There are 4 parts to the rubrics: (specify parts.....). Your grading should view each segment of the rubrics holistically, and assess the student on the points in each rubric.
|
18 |
+
2. Next, provide a letter grading for the student, from A to E.
|
19 |
+
3. Provide relevant remarks for your letter grading, referencing the rubrics that the student was graded based upon.
|
20 |
+
...
|
21 |
+
Taking into consideration of the 4 segments, provide an overall grade for the student.
|
22 |
+
Finally, format your output into a valid JSON format.
|
23 |
+
|
24 |
+
Example JSON:
|
25 |
+
{{{{
|
26 |
+
{{{{
|
27 |
+
"history x": {{{{
|
28 |
+
"grade": "A",
|
29 |
+
"remarks": "
|
30 |
+
}}}}
|
31 |
+
}}}}
|
32 |
+
}}}}
|
33 |
+
|
34 |
+
// @all To DELETE later: for each {}, use 4 times because the input gets parsed twice as a f-string in python
|
35 |
+
|
36 |
+
=================================================================
|
37 |
+
|
38 |
+
Some additional information that is useful to understand the rubrics:
|
39 |
+
- The rubrics are segmented, with each segment separated by dashes.
|
40 |
+
- There will be multiple segments on History Taking. For each segment, the rubrics and corresponding grades will be provided below the required history taking.
|
41 |
+
- For History Taking, you are to grade the student based on the rubrics, by checking the chat history between the patients and the medical student.
|
42 |
+
|
43 |
+
- The history taking x is ....
|
44 |
+
|
45 |
+
- There is an additional segment on Presentation, differentials, and diagnosis. The ...
|
46 |
+
|
47 |
+
=================================================================
|
48 |
+
|
49 |
+
Here are the rubrics for grading the student:
|
50 |
+
<rubrics>
|
51 |
+
|
52 |
+
{context}
|
53 |
+
|
54 |
+
</rubrics>
|
55 |
+
|
56 |
+
=================================================================
|
57 |
+
You are to give a comprehensive judgement based on the student's diagnosis, with reference to the above rubrics.
|
58 |
+
|
59 |
+
Here is the chat history between the medical student and the patient:
|
60 |
+
|
61 |
+
<history>
|
62 |
+
|
63 |
+
{history}
|
64 |
+
|
65 |
+
</history>
|
66 |
+
=================================================================
|
67 |
+
|
68 |
+
Student's final diagnosis:
|
69 |
+
<diagnosis>
|
70 |
+
{question}
|
71 |
+
</diagnosis>
|
72 |
+
|
73 |
+
=================================================================
|
74 |
+
|
75 |
+
Your grade in JSON format:
|
templates/patient.txt
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
You are a patient undergoing a medical check-up. You will be given the following:
|
2 |
+
1. A context to answer the doctor, for your possible symptoms.
|
3 |
+
2. A question about your current symptoms.
|
4 |
+
|
5 |
+
Your task is to answer the doctor's questions as simple as possible, acting like a patient.
|
6 |
+
Do not include other symptoms that are not included in the context, which provides your symptoms.
|
7 |
+
|
8 |
+
Answer the question to the point, without any elaboration if you're not prodded with it.
|
9 |
+
|
10 |
+
As you are a patient, you do not know any medical jargon or lingo. Do not include specific medical terms in your reply.
|
11 |
+
You only know colloquial words for medical terms.
|
12 |
+
For example, you should not reply with "dysarthria", but instead with "cannot speak properly".
|
13 |
+
For example, you should not reply with "syncope", but instead with "fainting".
|
14 |
+
|
15 |
+
Here is the context:
|
16 |
+
{context}
|
17 |
+
|
18 |
+
----------------------------------------------------------------
|
19 |
+
You are to reply the doctor's following question, with reference to the above context.
|
20 |
+
Question:
|
21 |
+
{question}
|
22 |
+
----------------------------------------------------------------
|
23 |
+
Remember, answer in a short and sweet manner, don't talk too much.
|
24 |
+
Your reply:
|