-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts_extraction.py
152 lines (139 loc) · 4.93 KB
/
prompts_extraction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
def get_prompts_race():
properties = {
"num_white": {
"type": "string",
"description": "The number of white/caucasian patients in the study",
},
"num_black": {
"type": "string",
"description": "The number of black/african american patients in the study",
},
"num_latino": {
"type": "string",
"description": "The number of latino patients in the study",
},
"num_asian": {
"type": "string",
"description": "The number of asian patients in the study",
},
"evidence_span_race": {
"type": "string",
"description": "The long text span in the input that includes evidence for num_white, num_black, num_latino, and num_asian.",
},
}
functions = [
{
"name": "extract_patient_nums_by_race",
"description": "Get the number of patients in this study for different gender and race demographics.",
"parameters": {
"type": "object",
"properties": properties,
"required": [
"num_white",
"num_black",
# "num_latino",
# "num_asian",
"evidence_span_race",
],
},
},
]
content_str = """### QUESTION: How many patients were in the study, broken down by race?
### STUDY: {input}"""
return properties, functions, content_str
def get_prompts_gender():
properties = {
"num_male": {
"type": "string",
"description": "The number of male patients in the study",
},
"num_female": {
"type": "string",
"description": "The number of female patients in the study",
},
"num_total": {
"type": "string",
"description": "The total number of patients in the study",
},
"evidence_span_gender": {
"type": "string",
"description": "The long text span in the input that includes evidence for num_male, num_female, and num_gender.",
},
}
functions = [
{
"name": "extract_patient_nums_by_gender",
"description": "Get the number of patients in this study for different genders",
"parameters": {
"type": "object",
"properties": properties,
"required": [
"num_male",
"num_female",
"num_total",
"evidence_span_gender",
],
},
},
]
content_str = """### QUESTION: How many male and female patients were in the study?
### STUDY: {input}"""
return properties, functions, content_str
def get_prompts_gender_and_race():
properties = {
"num_white": {
"type": "string",
"description": "The number of white/caucasian patients in the study",
},
"num_black": {
"type": "string",
"description": "The number of black/african american patients in the study",
},
"num_latino": {
"type": "string",
"description": "The number of latino patients in the study",
},
"num_asian": {
"type": "string",
"description": "The number of asian patients in the study",
},
"evidence_span_race": {
"type": "string",
"description": "The long text span in the input that includes evidence for num_white, num_black, num_latino, and num_asian.",
},
"num_male": {
"type": "string",
"description": "The number of male patients in the study",
},
"num_female": {
"type": "string",
"description": "The number of female patients in the study",
},
"num_total": {
"type": "string",
"description": "The total number of patients in the study",
},
"evidence_span_gender": {
"type": "string",
"description": "The long text span in the input that includes evidence for num_male, num_female, and num_gender.",
},
}
functions = [
{
"name": "extract_patient_nums_by_demographics",
"description": "Get the number of patients in this study for different gender and race demographics.",
"parameters": {
"type": "object",
"properties": properties,
"required": [
"num_male",
"num_female",
"num_total",
"evidence_span_gender",
],
},
},
]
content_str = """### QUESTION: How many patients were in the study, broken down by race and gender?
### STUDY: {input}"""
return properties, functions, content_str