Upload 5 files
Browse files- .gitattributes +1 -0
- LICENSE.txt +21 -0
- README.md +82 -3
- media/AgentClinicPaper.pdf +3 -0
- media/mainfigure.png +3 -0
- media/perfplots.png +3 -0
.gitattributes
CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
media/AgentClinicPaper.pdf filter=lfs diff=lfs merge=lfs -text
|
LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2024 Samuel Schmidgall
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -1,3 +1,82 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AgentClinic: a multimodal agent benchmark to evaluate AI in simulated clinical environments
|
2 |
+
|
3 |
+
<p align="center">
|
4 |
+
<img src="media/mainfigure.png" alt="Demonstration of the flow of AgentClinic" style="width: 99%;">
|
5 |
+
</p>
|
6 |
+
|
7 |
+
## Release
|
8 |
+
- [05/18/2024] 🤗 We added support for HuggingFace models!
|
9 |
+
- [05/17/2024] We release new results and support for GPT-4o!
|
10 |
+
- [05/13/2024] 🔥 We release **AgentClinic: a multimodal agent benchmark to evaluate AI in simulated clinical environment**. We propose a multimodal benchmark based on language agents which simulate the clinical environment. Checkout the [paper](media/AgentClinicPaper.pdf) and the [website](https://agentclinic.github.io/) for this code.
|
11 |
+
|
12 |
+
|
13 |
+
## Contents
|
14 |
+
- [Install](#install)
|
15 |
+
- [Evaluation](#evaluation)
|
16 |
+
- [Code Examples](#code-examples)
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
## Install
|
21 |
+
|
22 |
+
1. This library has few dependencies, so you can simply install the requirements.txt!
|
23 |
+
```bash
|
24 |
+
pip install -r requirements.txt
|
25 |
+
```
|
26 |
+
|
27 |
+
## Evaluation
|
28 |
+
|
29 |
+
All of the models from the paper are available (GPT-4/4o/3.5, Mixtral-8x7B, Llama-70B-chat). You can try them for any of the agents, make sure you have either an OpenAI or Replicate key ready for evaluation! HuggingFace wrappers are also implemented if you don't want to use API keys.
|
30 |
+
|
31 |
+
Just change modify the following parameters in the CLI
|
32 |
+
|
33 |
+
```
|
34 |
+
parser.add_argument('--openai_api_key', type=str, required=True, help='OpenAI API Key')
|
35 |
+
parser.add_argument('--replicate_api_key', type=str, required=False, help='Replicate API Key')
|
36 |
+
parser.add_argument('--inf_type', type=str, choices=['llm', 'human_doctor', 'human_patient'], default='llm')
|
37 |
+
parser.add_argument('--doctor_bias', type=str, help='Doctor bias type', default='None', choices=["recency", "frequency", "false_consensus", "confirmation", "status_quo", "gender", "race", "sexual_orientation", "cultural", "education", "religion", "socioeconomic"])
|
38 |
+
parser.add_argument('--patient_bias', type=str, help='Patient bias type', default='None', choices=["recency", "frequency", "false_consensus", "self_diagnosis", "gender", "race", "sexual_orientation", "cultural", "education", "religion", "socioeconomic"])
|
39 |
+
parser.add_argument('--doctor_llm', type=str, default='gpt4', choices=['gpt4', 'gpt3.5', 'llama-2-70b-chat', 'mixtral-8x7b', 'gpt4o'])
|
40 |
+
parser.add_argument('--patient_llm', type=str, default='gpt4', choices=['gpt4', 'gpt3.5', 'mixtral-8x7b', 'gpt4o'])
|
41 |
+
parser.add_argument('--measurement_llm', type=str, default='gpt4', choices=['gpt4'])
|
42 |
+
parser.add_argument('--moderator_llm', type=str, default='gpt4', choices=['gpt4'])
|
43 |
+
parser.add_argument('--num_scenarios', type=int, default=1, required=False, help='Number of scenarios to simulate')
|
44 |
+
```
|
45 |
+
|
46 |
+
|
47 |
+
## Code Examples
|
48 |
+
|
49 |
+
🎆 And then run it!
|
50 |
+
|
51 |
+
```
|
52 |
+
python3 agentclinic.py --openai_api_key "YOUR_OPENAIAPI_KEY" --inf_type "llm"
|
53 |
+
```
|
54 |
+
|
55 |
+
🤗 You can also try ANY custom HuggingFace language model very simply! All you have to do is pass "HF_{hf_path}" where hf_path is the HuggingFace path (e.g. mistralai/Mixtral-8x7B-v0.1). Here is how you can run Mixtral-8x7B locally with AgentClinic for both doctor and patient agents. 🤗
|
56 |
+
|
57 |
+
⚠️ Can be quite slow ⚠️
|
58 |
+
|
59 |
+
```
|
60 |
+
python3 agentclinic.py --inf_type "llm" --inf_type "llm" --patient_llm "HF_mistralai/Mixtral-8x7B-v0.1" --moderator_llm "HF_mistralai/Mixtral-8x7B-v0.1" --doctor_llm "HF_mistralai/Mixtral-8x7B-v0.1" --measurement_llm "HF_mistralai/Mixtral-8x7B-v0.1"
|
61 |
+
```
|
62 |
+
|
63 |
+
🔥 Here is an example with gpt-4o!
|
64 |
+
|
65 |
+
```
|
66 |
+
python3 agentclinic.py --openai_api_key "YOUR_OPENAIAPI_KEY" --doctor_llm "gpt4o" --patient_llm "gpt4o" --inf_type "llm"
|
67 |
+
```
|
68 |
+
|
69 |
+
⚖️ Here is an example with doctor and patient bias with gpt-3.5!
|
70 |
+
|
71 |
+
```
|
72 |
+
python3 agentclinic.py --openai_api_key "YOUR_OPENAIAPI_KEY" --doctor_llm "gpt3.5" --patient_llm "gpt4" --patient_bias "self_diagnosis" --doctor_bias "recency" --inf_type "llm"
|
73 |
+
```
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
<p align="center">
|
78 |
+
<img src="media/perfplots.png" alt="Demonstration of the flow of AgentClinic" style="width: 99%;">
|
79 |
+
</p>
|
80 |
+
|
81 |
+
|
82 |
+
|
media/AgentClinicPaper.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c3c524981cfdf89b5bbfdf40e038b70583e88c60ef8d237e743f40cbb41eb953
|
3 |
+
size 7726665
|
media/mainfigure.png
ADDED
Git LFS Details
|
media/perfplots.png
ADDED
Git LFS Details
|