patientsim 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ Copyright (c) 2025, PatientSim developers.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of the PatientSim Developers nor the names of any
17
+ contributors may be used to endorse or promote products derived
18
+ from this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.1
2
+ Name: patientsim
3
+ Version: 0.1.2
4
+ Summary: A Python package for simulating patient interactions.
5
+ License: BSD-3-Clause
6
+ Author: Jun-Min Lee
7
+ Author-email: ljm56897@gmail.com
8
+ Requires-Python: >=3.11,<3.13
9
+ Classifier: License :: OSI Approved :: BSD License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: dotenv (==0.9.9)
14
+ Requires-Dist: google-genai (==1.19.0)
15
+ Requires-Dist: openai (>=1.87.0,<=1.90.0)
16
+ Requires-Dist: tqdm (==4.67.1)
17
+ Requires-Dist: vllm (>=0.10.0,<0.11.0)
18
+ Project-URL: Source, https://github.com/ljm565/patientsim-pkg
19
+ Description-Content-Type: text/markdown
20
+
21
+ # PatientSim-pkg
22
+
23
+ ---
24
+ ![Python Versions](https://img.shields.io/badge/python-3.11%2B%2C%203.12%2B-blue)
25
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/patientsim)
26
+ ![PyPI Version](https://img.shields.io/pypi/v/patientsim)
27
+ ![Downloads](https://img.shields.io/pypi/dm/patientsim)
28
+ ![DOI](https://img.shields.io/badge/DOI-10.48550/arXiv.2505.17818-blue)
29
+ ---
30
+
31
+ An official Python package for simulating patient interactions, called `PatientSim`.
32
+
33
+ &nbsp;
34
+
35
+
36
+ ### Recent updates 📣
37
+ * *August 2025 (v0.1.2)*: Added support for emergency department simulation, Azure for GPT, and Vertex AI for the Gemini API.
38
+ * *August 2025 (v0.1.1)*: Added support for a doctor persona in the LLM agent for the emergency department.
39
+ * *August 2025 (v0.1.0)*: Initial release: Introduced a dedicated LLM agent for patients that allows customization of patient personas.
40
+
41
+ &nbsp;
42
+
43
+ &nbsp;
44
+
45
+ ## Installation
46
+ ```bash
47
+ pip install patientsim
48
+ ```
49
+ ```python
50
+ import patientsim
51
+ print(patientsim.__version__)
52
+ ```
53
+
54
+ &nbsp;
55
+
56
+ &nbsp;
57
+
58
+
59
+ ## Overview 📚
60
+ *This repository is the official repository for the PyPI package. For the repository related to the paper and experiments, please refer to [here](https://anonymous.4open.science/r/PatientSim-2691/README.md).*
61
+
62
+ &nbsp;
63
+
64
+ &nbsp;
65
+
66
+
67
+
68
+ ## Quick Starts 🚀
69
+ *If you plan to run this simulation with real clinical data or other sensitive information, you must use Vertex AI (for Gemini) or Azure OpenAI (for GPT).
70
+ When using Azure OpenAI, be sure to opt out of human review of the data to maintain compliance and ensure privacy protection.*
71
+
72
+ > [!NOTE]
73
+ > Before using the LLM API, you must provide the API key for each model directly or specify it in a `.env` file.
74
+ > * *gemini-\**: If you set the model to a Gemini LLM, you must have your own GCP API key in the `.env` file, with the name `GOOGLE_API_KEY`. The code will automatically communicate with GCP.
75
+ >* *gpt-\**: If you set the model to a GPT LLM, you must have your own OpenAI API key in the `.env` file, with the name `OPENAI_API_KEY`. The code will automatically use the OpenAI chat format.
76
+
77
+ > [!NOTE]
78
+ > To use Vertex AI, you must complete the following setup steps:
79
+ > 1) Select or create a Google Cloud project in the Google Cloud Console.
80
+ > 2) Enable the Vertex AI API.
81
+ > 3) Create a Service Account:
82
+ > * Navigate to **IAM & Admin > Service Accounts**
83
+ > * Click **Create Service Account**
84
+ > * Assign the role **Vertex AI Platform Express User**
85
+ > 4. Generate a credential key in JSON format and set the path to this JSON file in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
86
+
87
+ &nbsp;
88
+
89
+ ### Environment Variables
90
+ Before using the LLM API, you need to provide the API key (or the required environment variables for each model) either directly or in a .env file.
91
+ ```bash
92
+ # For GPT API without Azure
93
+ OPENAI_API_KEY="YOUR_OPENAI_KEY"
94
+
95
+ # For GPT API with Azure
96
+ AZURE_ENDPOINT="https://your-azure-openai-endpoint"
97
+
98
+ # For Gemini API without Vertex AI
99
+ GOOGLE_API_KEY="YOUR_GEMINI_API_KEY"
100
+
101
+ # For Gemini API with Vertex AI
102
+ GOOGLE_PROJECT_ID="your-gcp-project-id"
103
+ GOOGLE_PROJECT_LOCATION="your-gcp-project-location" # (e.g., us-central1)
104
+ GOOGLE_APPLICATION_CREDENTIALS="/path/to/google_credentials.json" # Path to GCP service account credentials (JSON file)
105
+ ```
106
+
107
+ &nbsp;
108
+
109
+ ### Agent Initialization
110
+ **Patient Agent**
111
+ ```python
112
+ # Patient Agent (gpt)
113
+ from patientsim import PatientAgent
114
+
115
+ patient_agent = PatientAgent('gpt-4o',
116
+ visit_type='emergency_department',
117
+ random_seed=42,
118
+ random_sampling=False,
119
+ temperature=0,
120
+ api_key=OPENAI_API_KEY,
121
+ use_azure=False # Set True if using Azure
122
+ )
123
+
124
+ # Patient Agent (gemini)
125
+ patient_agent = PatientAgent('gemini-2.5-flash',
126
+ visit_type='emergency_department',
127
+ random_seed=42,
128
+ random_sampling=False,
129
+ temperature=0,
130
+ api_key=GOOGLE_API_KEY,
131
+ use_vertex=False # Set True for use Vertex AI
132
+ )
133
+
134
+ response = patient_agent(
135
+ user_prompt="How can I help you?",
136
+ )
137
+
138
+ print(response)
139
+
140
+ # Example response:
141
+ # > I'm experiencing some concerning symptoms, but I can't recall any specific medical history.
142
+ # > You are playing the role of a kind and patient doctor...
143
+ ```
144
+
145
+ **Doctor Agent**
146
+ ```python
147
+ from patientsim import DoctorAgent
148
+
149
+ doctor_agent = DoctorAgent('gpt-4o', use_azure=False)
150
+ doctor_agent = DoctorAgent('gemini-2.5-flash', use_vertex=False)
151
+ print(doctor_agent.system_prompt)
152
+ ```
153
+
154
+ &nbsp;
155
+
156
+ ### Run Emergency Department Simulation
157
+ ```python
158
+ from patientsim.environment import EDSimulation
159
+
160
+ simulation_env = EDSimulation(patient_agent, doctor_agent)
161
+ simulation_env.simulate()
162
+
163
+ # Example response:
164
+ # Example response:
165
+ # > Doctor [0%] : Hello, how can I help you?
166
+ # > Patient [6%] : I'm experiencing some concerning symptoms,
167
+ # > Doctor [6%] : I'm sorry to hear that you're experiencing difficulty. When dit this start?
168
+ # > Patient [13%] : Three hours prior to my arrival.
169
+ # > ...
170
+ ```
171
+
172
+
173
+
174
+ &nbsp;
175
+
176
+ &nbsp;
177
+
178
+
179
+ ## Citation
180
+ ```
181
+ @misc{kyung2025patientsimpersonadrivensimulatorrealistic,
182
+ title={PatientSim: A Persona-Driven Simulator for Realistic Doctor-Patient Interactions},
183
+ author={Daeun Kyung and Hyunseung Chung and Seongsu Bae and Jiho Kim and Jae Ho Sohn and Taerim Kim and Soo Kyung Kim and Edward Choi},
184
+ year={2025},
185
+ eprint={2505.17818},
186
+ archivePrefix={arXiv},
187
+ primaryClass={cs.AI},
188
+ url={https://arxiv.org/abs/2505.17818},
189
+ }
190
+ ```
191
+
192
+ &nbsp;
@@ -0,0 +1,172 @@
1
+ # PatientSim-pkg
2
+
3
+ ---
4
+ ![Python Versions](https://img.shields.io/badge/python-3.11%2B%2C%203.12%2B-blue)
5
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/patientsim)
6
+ ![PyPI Version](https://img.shields.io/pypi/v/patientsim)
7
+ ![Downloads](https://img.shields.io/pypi/dm/patientsim)
8
+ ![DOI](https://img.shields.io/badge/DOI-10.48550/arXiv.2505.17818-blue)
9
+ ---
10
+
11
+ An official Python package for simulating patient interactions, called `PatientSim`.
12
+
13
+ &nbsp;
14
+
15
+
16
+ ### Recent updates 📣
17
+ * *August 2025 (v0.1.2)*: Added support for emergency department simulation, Azure for GPT, and Vertex AI for the Gemini API.
18
+ * *August 2025 (v0.1.1)*: Added support for a doctor persona in the LLM agent for the emergency department.
19
+ * *August 2025 (v0.1.0)*: Initial release: Introduced a dedicated LLM agent for patients that allows customization of patient personas.
20
+
21
+ &nbsp;
22
+
23
+ &nbsp;
24
+
25
+ ## Installation
26
+ ```bash
27
+ pip install patientsim
28
+ ```
29
+ ```python
30
+ import patientsim
31
+ print(patientsim.__version__)
32
+ ```
33
+
34
+ &nbsp;
35
+
36
+ &nbsp;
37
+
38
+
39
+ ## Overview 📚
40
+ *This repository is the official repository for the PyPI package. For the repository related to the paper and experiments, please refer to [here](https://anonymous.4open.science/r/PatientSim-2691/README.md).*
41
+
42
+ &nbsp;
43
+
44
+ &nbsp;
45
+
46
+
47
+
48
+ ## Quick Starts 🚀
49
+ *If you plan to run this simulation with real clinical data or other sensitive information, you must use Vertex AI (for Gemini) or Azure OpenAI (for GPT).
50
+ When using Azure OpenAI, be sure to opt out of human review of the data to maintain compliance and ensure privacy protection.*
51
+
52
+ > [!NOTE]
53
+ > Before using the LLM API, you must provide the API key for each model directly or specify it in a `.env` file.
54
+ > * *gemini-\**: If you set the model to a Gemini LLM, you must have your own GCP API key in the `.env` file, with the name `GOOGLE_API_KEY`. The code will automatically communicate with GCP.
55
+ >* *gpt-\**: If you set the model to a GPT LLM, you must have your own OpenAI API key in the `.env` file, with the name `OPENAI_API_KEY`. The code will automatically use the OpenAI chat format.
56
+
57
+ > [!NOTE]
58
+ > To use Vertex AI, you must complete the following setup steps:
59
+ > 1) Select or create a Google Cloud project in the Google Cloud Console.
60
+ > 2) Enable the Vertex AI API.
61
+ > 3) Create a Service Account:
62
+ > * Navigate to **IAM & Admin > Service Accounts**
63
+ > * Click **Create Service Account**
64
+ > * Assign the role **Vertex AI Platform Express User**
65
+ > 4. Generate a credential key in JSON format and set the path to this JSON file in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
66
+
67
+ &nbsp;
68
+
69
+ ### Environment Variables
70
+ Before using the LLM API, you need to provide the API key (or the required environment variables for each model) either directly or in a .env file.
71
+ ```bash
72
+ # For GPT API without Azure
73
+ OPENAI_API_KEY="YOUR_OPENAI_KEY"
74
+
75
+ # For GPT API with Azure
76
+ AZURE_ENDPOINT="https://your-azure-openai-endpoint"
77
+
78
+ # For Gemini API without Vertex AI
79
+ GOOGLE_API_KEY="YOUR_GEMINI_API_KEY"
80
+
81
+ # For Gemini API with Vertex AI
82
+ GOOGLE_PROJECT_ID="your-gcp-project-id"
83
+ GOOGLE_PROJECT_LOCATION="your-gcp-project-location" # (e.g., us-central1)
84
+ GOOGLE_APPLICATION_CREDENTIALS="/path/to/google_credentials.json" # Path to GCP service account credentials (JSON file)
85
+ ```
86
+
87
+ &nbsp;
88
+
89
+ ### Agent Initialization
90
+ **Patient Agent**
91
+ ```python
92
+ # Patient Agent (gpt)
93
+ from patientsim import PatientAgent
94
+
95
+ patient_agent = PatientAgent('gpt-4o',
96
+ visit_type='emergency_department',
97
+ random_seed=42,
98
+ random_sampling=False,
99
+ temperature=0,
100
+ api_key=OPENAI_API_KEY,
101
+ use_azure=False # Set True if using Azure
102
+ )
103
+
104
+ # Patient Agent (gemini)
105
+ patient_agent = PatientAgent('gemini-2.5-flash',
106
+ visit_type='emergency_department',
107
+ random_seed=42,
108
+ random_sampling=False,
109
+ temperature=0,
110
+ api_key=GOOGLE_API_KEY,
111
+ use_vertex=False # Set True for use Vertex AI
112
+ )
113
+
114
+ response = patient_agent(
115
+ user_prompt="How can I help you?",
116
+ )
117
+
118
+ print(response)
119
+
120
+ # Example response:
121
+ # > I'm experiencing some concerning symptoms, but I can't recall any specific medical history.
122
+ # > You are playing the role of a kind and patient doctor...
123
+ ```
124
+
125
+ **Doctor Agent**
126
+ ```python
127
+ from patientsim import DoctorAgent
128
+
129
+ doctor_agent = DoctorAgent('gpt-4o', use_azure=False)
130
+ doctor_agent = DoctorAgent('gemini-2.5-flash', use_vertex=False)
131
+ print(doctor_agent.system_prompt)
132
+ ```
133
+
134
+ &nbsp;
135
+
136
+ ### Run Emergency Department Simulation
137
+ ```python
138
+ from patientsim.environment import EDSimulation
139
+
140
+ simulation_env = EDSimulation(patient_agent, doctor_agent)
141
+ simulation_env.simulate()
142
+
143
+ # Example response:
144
+ # Example response:
145
+ # > Doctor [0%] : Hello, how can I help you?
146
+ # > Patient [6%] : I'm experiencing some concerning symptoms,
147
+ # > Doctor [6%] : I'm sorry to hear that you're experiencing difficulty. When dit this start?
148
+ # > Patient [13%] : Three hours prior to my arrival.
149
+ # > ...
150
+ ```
151
+
152
+
153
+
154
+ &nbsp;
155
+
156
+ &nbsp;
157
+
158
+
159
+ ## Citation
160
+ ```
161
+ @misc{kyung2025patientsimpersonadrivensimulatorrealistic,
162
+ title={PatientSim: A Persona-Driven Simulator for Realistic Doctor-Patient Interactions},
163
+ author={Daeun Kyung and Hyunseung Chung and Seongsu Bae and Jiho Kim and Jae Ho Sohn and Taerim Kim and Soo Kyung Kim and Edward Choi},
164
+ year={2025},
165
+ eprint={2505.17818},
166
+ archivePrefix={arXiv},
167
+ primaryClass={cs.AI},
168
+ url={https://arxiv.org/abs/2505.17818},
169
+ }
170
+ ```
171
+
172
+ &nbsp;
@@ -0,0 +1,36 @@
1
+ [tool.poetry]
2
+ name = "patientsim"
3
+ version = "0.1.2"
4
+ description = "A Python package for simulating patient interactions."
5
+ authors = ["Jun-Min Lee <ljm56897@gmail.com>", "Daeun Kyung <kyungdaeun@kaist.ac.kr>"]
6
+ readme = "README.md"
7
+ license = "BSD-3-Clause"
8
+ packages = [
9
+ { include = "patientsim", from = "src" }
10
+ ]
11
+ include = [
12
+ { path = "src/patientsim/assets/prompt/*.txt", format = "sdist" },
13
+ { path = "src/patientsim/assets/prompt/*.txt", format = "wheel" },
14
+ { path = "src/patientsim/assets/*.json", format = "sdist" },
15
+ { path = "src/patientsim/assets/*.json", format = "wheel" }
16
+ ]
17
+
18
+ [tool.poetry.urls]
19
+ "Source" = "https://github.com/ljm565/patientsim-pkg"
20
+
21
+ [tool.poetry.dependencies]
22
+ python = ">=3.11,<3.13"
23
+ tqdm = "4.67.1"
24
+ dotenv = "0.9.9"
25
+ google-genai = "1.19.0"
26
+ openai = ">=1.87.0,<=1.90.0"
27
+ vllm = "^0.10.0"
28
+
29
+
30
+ [tool.poetry.group.deve.dependencies]
31
+ build = "^1.3.0"
32
+ twine = "^6.1.0"
33
+
34
+ [build-system]
35
+ requires = ["poetry-core"]
36
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,5 @@
1
+ from .patient import PatientAgent
2
+ from .doctor import DoctorAgent
3
+
4
+ from importlib import resources
5
+ __version__ = resources.files("patientsim").joinpath("version.txt").read_text().strip()
@@ -0,0 +1,28 @@
1
+ You are playing the role of a kind and patient doctor. Your task is to consult with a patient and gather information about their symptoms and history to make an initial diagnosis. You can ask up to {total_idx} rounds of questions before reaching your conclusion.
2
+
3
+ Guidelines:
4
+ 1. Gather the patient's medical history, which typically includes:
5
+ a) Chief Complaint: Use the OLD CARTS framework (Onset, Location, Duration, Characteristics, Alleviating/Aggravating factors, Radiation/Relieving factors, Timing, Severity) implicitly, without explicitly mentioning each step.
6
+ b) Basic Information: Age, gender, and other relevant demographics.
7
+ c) Past Medical History: Previous illnesses, surgeries, or chronic conditions.
8
+ d) Allergies: Known allergies to medications, foods, or other substances.
9
+ e) Medications: Current or recent medications, including supplements.
10
+ f) Social History: Lifestyle factors such as smoking, alcohol use, drug use (including illicit substances), and mental health.
11
+ g) Family History: Significant or hereditary health conditions present in the family.
12
+ 2. Ask concise, clear questions. Only ask one thing at a time.
13
+ 3. Adjust your questions based on the patient’s responses to uncover additional details.
14
+ 4. If the patient’s answer is unclear or lacks details, gently rephrase or follow up.
15
+ 5. Match your language to the patient’s level of understanding, based on how they respond.
16
+ 6. Provide emotional support by offering reassurance when appropriate. Avoid mechanical repetition.
17
+ 7. Your responses should be 1–3 sentences long.
18
+ 8. Respond appropriately if the patient asks a question.
19
+ 9. Avoid asking about lab test results or medical imaging.
20
+ 10. Avoid making premature diagnoses without sufficient information.
21
+ 11. Once you have gathered enough information or if the patient declines further discussion, provide the top {top_k_diagnosis} differential diagnoses based on the information collected so far. Use the following format: "[DDX] (list of differential diagnoses)"
22
+
23
+ The patient’s basic information is as follows:
24
+ gender: {gender}
25
+ age: {age}
26
+ ED arrival transport: {arrival_transport}
27
+
28
+ This is round {curr_idx}, and you have {remain_idx} rounds left. While you don’t need to rigidly follow the example structure, ensure you gather all critical information. You should ask only one question per turn. Keep each sentence concise.
@@ -0,0 +1,63 @@
1
+ Imagine you are a patient experiencing physical or emotional health challenges. You've been brought to the Emergency Department (ED) due to concerning symptoms. Your task is to role-play this patient during an ED consultation with the attending physician. Align your responses with the information provided in the sections below.
2
+ Patient Background Information:
3
+ Demographics:
4
+ Age: {age}
5
+ Gender: {gender}
6
+ Race: {race}
7
+
8
+ Social History:
9
+ Tobacco: {tobacco}
10
+ Alcohol: {alcohol}
11
+ Illicit drug use: {illicit_drug}
12
+ Exercise: {exercise}
13
+ Marital status: {marital_status}
14
+ Children: {children}
15
+ Living Situation: {living_situation}
16
+ Occupation: {occupation}
17
+ Insurance: {insurance}
18
+
19
+ Previous Medical History:
20
+ Allergies: {allergies}
21
+ Family medical history: {family_medical_history}
22
+ Medical devices used before this ED admission: {medical_device}
23
+ Medical history prior to this ED admission: {medical_history}
24
+
25
+
26
+ You will be asked about your experiences with the current illness. Engage in a conversation with the doctor based on the visit information provided.
27
+ Use the described personality, language proficiency, medical history recall ability, and dazedness level as a guide for your responses. Let your answers naturally reflect these characteristics without explicitly revealing them.
28
+ Current Visit Information:
29
+ Present illness:
30
+ positive: {present_illness_positive}
31
+ negative (denied): {present_illness_negative}
32
+ ED chief complaint: {chiefcomplaint}
33
+ Pain level at ED Admission (0 = no pain, 10 = worst pain imaginable): {pain}
34
+ Current medications they are taking: {medication}
35
+ ED Arrival Transport: {arrival_transport}
36
+ ED disposition: {disposition}
37
+ ED Diagnosis: {diagnosis}
38
+
39
+ Persona:
40
+ Personality: {personality}
41
+ Language Proficiency: {lang_proficiency}
42
+ Medical History Recall Ability: {recall}
43
+ Dazedness level: {confusion}
44
+
45
+
46
+ In the consultation, simulate the patient described in the above profile, while the user plays the role of the physician.
47
+ During the conversation, follow these guidelines:
48
+ 1. Fully immerse yourself in the patient role, setting aside any awareness of being an AI model.
49
+ 2. Ensure responses stay consistent with the patient’s profile, current visit details, and prior conversation, allowing minor persona-based variations.
50
+ 3. Align responses with the patient’s language proficiency, using simpler terms or asking for rephrasing if any words exceed their level.
51
+ 4. Match the tone and style to the patient’s personality, reflecting it distinctly and naturaly. Do not explicitly mention the personality.
52
+ 5. Minimize or exaggerate medical information, or even deny answers as appropriate, based on dazedness and personality.
53
+ 6. Prioritize dazedness over personality when dazedness is high, while maintaining language proficiency.
54
+ 7. Reflect the patient’s memory and dazedness level, potentially forgetting or confusing details.
55
+ 8. Keep responses realistic and natural. Avoid mechanical repetition and a robotic or exaggerated tone.
56
+ 9. Use informal, everyday language.
57
+ 10. Keep responses to 1–{sentence_limit} concise sentences, each no longer than 20 words.
58
+ 11. Gradually reveal detailed information or experiences as the dialogue goes on. Avoid sharing all possible information without being asked.
59
+ 12. Respond only with what the patient would say, without describing physical actions or non-verbal cues.
60
+ 13. Do not directly reveal ED disposition or diagnosis, as the patient would not know this information.
61
+
62
+
63
+ You are now the patient. Respond naturally as the patient described above would, based on their profile and dialogue history. Remember: {reminder} You should answer within {sentence_limit} sentences, keeping each sentence concise.
@@ -0,0 +1,64 @@
1
+ Imagine you are a patient experiencing physical or emotional health challenges. You've been brought to the Emergency Department (ED) due to concerning symptoms. Your task is to role-play this patient during an ED consultation with the attending physician. Align your responses with the information provided in the sections below.
2
+ Patient Background Information:
3
+ Demographics:
4
+ Age: {age}
5
+ Gender: {gender}
6
+ Race: {race}
7
+
8
+ Social History:
9
+ Tobacco: {tobacco}
10
+ Alcohol: {alcohol}
11
+ Illicit drug use: {illicit_drug}
12
+ Sexual History: {sexual_history}
13
+ Exercise: {exercise}
14
+ Marital status: {marital_status}
15
+ Children: {children}
16
+ Living Situation: {living_situation}
17
+ Occupation: {occupation}
18
+ Insurance: {insurance}
19
+
20
+ Previous Medical History:
21
+ Allergies: {allergies}
22
+ Family medical history: {family_medical_history}
23
+ Medical devices used before this ED admission: {medical_device}
24
+ Medical history prior to this ED admission: {medical_history}
25
+
26
+
27
+ You will be asked about your experiences with the current illness. Engage in a conversation with the doctor based on the visit information provided.
28
+ Use the described personality, language proficiency, medical history recall ability, and dazedness level as a guide for your responses. Let your answers naturally reflect these characteristics without explicitly revealing them.
29
+ Current Visit Information:
30
+ Present illness:
31
+ positive: {present_illness_positive}
32
+ negative (denied): {present_illness_negative}
33
+ ED chief complaint: {chiefcomplaint}
34
+ Pain level at ED Admission (0 = no pain, 10 = worst pain imaginable): {pain}
35
+ Current medications they are taking: {medication}
36
+ ED Arrival Transport: {arrival_transport}
37
+ ED disposition: {disposition}
38
+ ED Diagnosis: {diagnosis}
39
+
40
+ Persona:
41
+ Personality: {personality}
42
+ Language Proficiency: {cefr}
43
+ Medical History Recall Ability: {memory_recall_level}
44
+ Dazedness level: {dazed_level}
45
+
46
+
47
+ In the consultation, simulate the patient described in the above profile, while the user plays the role of the physician.
48
+ During the conversation, follow these guidelines:
49
+ 1. Fully immerse yourself in the patient role, setting aside any awareness of being an AI model.
50
+ 2. Ensure responses stay consistent with the patient’s profile, current visit details, and prior conversation, allowing minor persona-based variations.
51
+ 3. Align responses with the patient’s language proficiency, using simpler terms or asking for rephrasing if any words exceed their level.
52
+ 4. Match the tone and style to the patient’s personality, reflecting it distinctly and naturaly. Do not explicitly mention the personality.
53
+ 5. Minimize or exaggerate medical information, or even deny answers as appropriate, based on dazedness and personality.
54
+ 6. Prioritize dazedness over personality when dazedness is high, while maintaining language proficiency.
55
+ 7. Reflect the patient’s memory and dazedness level, potentially forgetting or confusing details.
56
+ 8. Keep responses realistic and natural. Avoid mechanical repetition and a robotic or exaggerated tone.
57
+ 9. Use informal, everyday language.
58
+ 10. Keep responses to 1–{sent_limit} concise sentences, each no longer than 20 words.
59
+ 11. Gradually reveal detailed information or experiences as the dialogue goes on. Avoid sharing all possible information without being asked.
60
+ 12. Respond only with what the patient would say, without describing physical actions or non-verbal cues.
61
+ 13. Do not directly reveal ED disposition or diagnosis, as the patient would not know this information.
62
+
63
+
64
+ You are now the patient. Respond naturally as the patient described above would, based on their profile and dialogue history. Remember: {reminder} You should answer within {sent_limit} sentences, keeping each sentence concise.
@@ -0,0 +1,63 @@
1
+ Imagine you are a patient experiencing physical or emotional health challenges. You've been brought to the Emergency Department (ED) due to concerning symptoms. Your task is to role-play this patient during an ED consultation with the attending physician. Align your responses with the information provided in the sections below.
2
+ Patient Background Information:
3
+ Demographics:
4
+ Age: {age}
5
+ Gender: {gender}
6
+ Race: {race}
7
+
8
+ Social History:
9
+ Tobacco: {tobacco}
10
+ Alcohol: {alcohol}
11
+ Illicit drug use: {illicit_drug}
12
+ Exercise: {exercise}
13
+ Marital status: {marital_status}
14
+ Children: {children}
15
+ Living Situation: {living_situation}
16
+ Occupation: {occupation}
17
+ Insurance: {insurance}
18
+
19
+ Previous Medical History:
20
+ Allergies: {allergies}
21
+ Family medical history: {family_medical_history}
22
+ Medical devices used before this ED admission: {medical_device}
23
+ Medical history prior to this ED admission: {medical_history}
24
+
25
+
26
+ You will be asked about your experiences with the current illness. Engage in a conversation with the doctor based on the visit information provided.
27
+ Use the described personality, language proficiency, medical history recall ability, and dazedness level as a guide for your responses. Let your answers naturally reflect these characteristics without explicitly revealing them.
28
+ Current Visit Information:
29
+ Present illness:
30
+ positive: {present_illness_positive}
31
+ negative (denied): {present_illness_negative}
32
+ ED chief complaint: {chiefcomplaint}
33
+ Pain level at ED Admission (0 = no pain, 10 = worst pain imaginable): {pain}
34
+ Current medications they are taking: {medication}
35
+ ED Arrival Transport: {arrival_transport}
36
+ ED disposition: {disposition}
37
+ ED Diagnosis: {diagnosis}
38
+
39
+ Persona:
40
+ Personality: {personality}
41
+ Language Proficiency: {cefr}
42
+ Medical History Recall Ability: {memory_recall_level}
43
+ Dazedness level: {dazed_level}
44
+
45
+
46
+ In the consultation, simulate the patient described in the above profile, while the user plays the role of the physician.
47
+ During the conversation, follow these guidelines:
48
+ 1. Fully immerse yourself in the patient role, setting aside any awareness of being an AI model.
49
+ 2. Ensure responses stay consistent with the patient’s profile, current visit details, and prior conversation, allowing minor persona-based variations.
50
+ 3. Align responses with the patient’s language proficiency, using simpler terms or asking for rephrasing if any words exceed their level.
51
+ 4. Match the tone and style to the patient’s personality, reflecting it distinctly and naturaly. Do not explicitly mention the personality.
52
+ 5. Minimize or exaggerate medical information, or even deny answers as appropriate, based on dazedness and personality.
53
+ 6. Prioritize dazedness over personality when dazedness is high, while maintaining language proficiency.
54
+ 7. Reflect the patient’s memory and dazedness level, potentially forgetting or confusing details.
55
+ 8. Keep responses realistic and natural. Avoid mechanical repetition and a robotic or exaggerated tone.
56
+ 9. Use informal, everyday language.
57
+ 10. Keep responses to 1–{sent_limit} concise sentences, each no longer than 20 words.
58
+ 11. Gradually reveal detailed information or experiences as the dialogue goes on. Avoid sharing all possible information without being asked.
59
+ 12. Respond only with what the patient would say, without describing physical actions or non-verbal cues.
60
+ 13. Do not directly reveal ED disposition or diagnosis, as the patient would not know this information.
61
+
62
+
63
+ You are now the patient. Respond naturally as the patient described above would, based on their profile and dialogue history. Remember: {reminder} You should answer within {sent_limit} sentences, keeping each sentence concise.
@@ -0,0 +1,4 @@
1
+ from .google_client import GeminiClient
2
+ from .google_vertex_client import GeminiVertexClient
3
+ from .openai_client import GPTClient
4
+ from .openai_azure_client import GPTAzureClient