DAN_AI / template.py
oliverwang15's picture
updates on the new prompt and better features
478965d
raw
history blame
8.85 kB
TEMPLATE_v3 = '''We now have a following <document> in the medical field:
"""
{}
"""
You are an expert in biomedical research.
You are asked to answer the following <question>s based on the <document>, the <question>s and their <instruction>s and <rule>s are as follows:
- "Question 1":
- "question": "What is the <animal type> of this study?"
- "instruction": "This task is to find the <animal type> according to the <document>."
- "definition":
- "animal type": "The rodent type used in the article"
- "rule": "<answer> of <animal type> should be one of the two choices {{mice/rats}} or both"
- "Question 2":
- "question": "What is the <exposure age> of this study?"
- "instruction": "This task is to find the <exposure age> according to the <document>."
- "definition":
- "exposure age": "The age when the animals were exposed to anesthetics. There are two kinds of <exposure age>: <postnatal day> and <gestational day>"
- "postnatal day": "<postnatal day> means the days after the animals were born. For example, 'postnatal day <int>' means the animals were born for <int> day. 'postnatal day <int>' is sometimes shortened to 'PND <int>' or 'pnd <int>', which still means 'postnatal day <int>', after birth. 'postnatal day <int>' is sometimes shortened to 'p<int>', which still means 'postnatal day <int>', after birth"
- "gestational day": "<gestational day> means the days after the animals were pregnant. For example, 'gestational day <int>' means the animals were pregnant for <int> day. 'gestational day <int>' is sometimes abbreviated as 'E <int>', 'E' meaning before birth"
- "rule": "<answer> of <exposure age> should be expressed as one of {{'postnatal day <int>'/'gestational day <int>'}}. For Example: "postnatal day 7", "Gestational day 21"
- "Question 3":
- "question": "Is there any <behavior test> done in this study?"
- "instruction": "This task is to find whether there are any <behavior test> in the study according to the <document>."
- "definition":
- "behavior test": "If there are any of the <behavior tests> described and done in the article, which mentioned as: 'Open field test', 'Morris water task', 'fear conditioning test', 'Dark/light avoidance'; 'passive/active avoidance test'; 'elevated maze', 'Forced swim test', 'Object recognition test', 'Social interaction/preference'."
- "rule": "<answer> to <behavior test> should be one of the two choices {{Yes/No}}."
- "Question 4":
- "question": "What's the <intervention>s of this study?
- "instruction": "This task is to find the <intervention>s according to the <document>."
- "definition":
- "intervention": "The <intervention>s are anesthetic drugs, which in one of {{"isoflurane"/"sevoflurane"/"desflurane"/"ketamine"/"propofol"/"Midazolam"/"Nitrous oxide“}}."
- "rule": "There are one or two <intervention>s in the <document>. Please find them all and answer the <question>. If there is only one <intervention>, the second one is 'None'."
- "Question 5":
- "question": "What's the <genetic chain> of this study?"
- "instruction": "This task is to find the <genetic chain> according to the <document>."
- "definition":
- "genetic chain": "The <genetic chain> is the genetic type of the animals being used in the article."
- "rule": "Please do as the following examples: 'C57BL/6', 'C57BL/6J' should be extracted as 'C57BL/6'; 'Sprague Dawley', 'Sprague-Dawley', 'SD' should be extracted as 'Sprague Dawley'; 'CD-1' should be extracted as 'CD-1'; 'Wistar/ST' should be extracted as 'Wistar/ST'; 'Wistar' should be extracted as 'Wistar'; 'FMR-1 KO' should be extracted as 'FMR-1 KO'."
Here is the instrucrtions for all the <question>s:
1. Please select the <original sentences> related the "behavior tests" from the <document> for each <question>.
2. Please use the <original sentences> to answer the <question> by following the <rule> and <instruction> accroding to the <definition>.
3. Please provide <original sentences> coming from the <document>.
4. Output the <answer> in the following JSON format:
{{
"Question 1": {{
"answer": "{{mice/rats/both}}",
"original sentences": []
}},
"Question 2": {{
"answer": "{{postnatal day <int>/gestational day <int>}}",
"original sentences": []
}},
"Question 3": {{
"answer": "{{Yes/No}}",
"original sentences": []
}},
"Question 4":
{{
{{intervention 1}}: {{
"answer": "{{intervention 1}}]",
"original sentences": []
}}
{{intervention 2}}: {{
"answer": "{{intervention 2}}",
"original sentences": []
}}
}},
"Question 5": {{
"answer": "{{genetic chain}}",
"original sentences": []
}}
}}
'''
TEMPLATE_v2 = '''We now have a following <document> in the medical field:
"""
{}
"""
We have some introduction here:
1. DOI: The DOI link for the article, usually can be found in the first line of the .txt file for the article. E.g., “DOI: 10.3892/mmr.2019.10397”.
2. Citation ID: The number in the file name. E.g., “1134”.
3. First author: The last name in the file name. E.g., “Guan”.
4. Year: The year in the file name. E.g., “2019”.
5. Animal type: The rodent type used in the article, should be one of the choices: mice, rats. E.g., “rats”.
6. Exposure age: The age when the animals were exposed to anesthetics, should be mentioned as "PND1", "PND7","postnatal day 7", "Gestational day 21", etc, which should be extract as: 'PND XX' , 'Gestational day xx'. E.g., “PND7”.
7. Behavior test: Whether there is any behavior test in the article, should be one of the choices: "Y", "N". "Y" is chosen if there are any of the behavior tests described and done in the article, which mentioned as: "Open field test", "Morris water task", "fear conditioning test", "Dark/light avoidance"; "passive/active avoidance test"; "elevated maze", "Forced swim test", "Object recognition test", "Social interaction/preference“. E.g., “N”.
8. Intervention 1 & Intervention 2: Intervention 1 and Intervention 2 are both anesthetic drugs, which listed as: "isoflurane", "sevoflurane", "desflurane", "ketamine", "propofol", "Midazolam", "Nitrous oxide“. If none, put “NA”. E.g., “propofol”.
9. Genetic chain: Genetic chain is the genetic type of the animals being used in the article, here is the examples:
"C57BL/6", "C57BL/6J" should be extracted as "C57BL/6"; "Sprague Dawley", "Sprague-Dawley", "SD" should be extracted as "Sprague Dawley"; "CD-1" should be extracted as "CD-1"; "Wistar/ST" should be extracted as "Wistar/ST"; "Wistar" should be extracted as "Wistar"; "FMR-1 KO" should be extracted as "FMR-1 KO“. E.g., “Sprague Dawley”.
We have some <question>s begin with "Question" here:
"""
{}
"""
Please finish the following task:
1. Please select the <original sentences> related the each <question> from the <document>.
2. Please use the <original sentences> to answer the <question>.
3. Please provide <original sentences> coming from the <document>.
4. Output the <answer> in the following json format:
{{
"Question 1": {{
"question": {{}},
"answer": {{}},
"original sentences": []
}},
"Question 2": {{
"question": {{}},
"answer": {{}},
"original sentences": []
}},
...
}}
'''
TEMPLATE_v1 = '''We now have a following <document> in the medical field:
"""
{}
"""
We have some <question>s begin with "Question" here:
"""
{}
"""
Please finish the following task:
1. Please select the <original sentences> related the each <question> from the <document>.
2. Please use the <original sentences> to answer the <question>.
3. Please provide <original sentences> coming from the <document>.
4. Output the <answer> in the following json format:
{{
"Question 1": {{
"question": {{}},
"answer": {{}},
"original sentences": []
}},
"Question 2": {{
"question": {{}},
"answer": {{}},
"original sentences": []
}},
...
}}
'''
QUESTIONS = [
"What is the DOI of this study?",
"What is the Citation ID of this study?",
"What is the First author of this study?",
"What is the year of this study?",
"What is the animal type of this study?",
"What is the exposure age of this study?",
"Is there any behavior test done in this study?",
"What's the Intervention 1's name of this study?(anesthetics only)",
"What's the Intervention 2's name of this study?(anesthetics only)",
"What's the genetic chain of this study?",
"Input question",
]
QUESTIONS = [ f'Question {id_ +1 }: {q}' for id_, q in enumerate(QUESTIONS) if 'Input question' not in q]
QUESTIONS = '\n'.join(QUESTIONS)