harshalmore31 commited on
Commit
f6f55e7
Β·
1 Parent(s): a5f4f6d

Update README.md to enhance clarity and structure; improve installation instructions and usage examples

Browse files
Files changed (1) hide show
  1. README.md +96 -66
README.md CHANGED
@@ -1,122 +1,152 @@
1
  # MAI Diagnostic Orchestrator (MAI-DxO)
2
 
3
- > **AI-powered diagnostic system that simulates a virtual panel of physician-agents for medical diagnosis**
 
 
4
 
5
  [![Paper](https://img.shields.io/badge/Paper-arXiv:2506.22405-red.svg)](https://arxiv.org/abs/2506.22405)
6
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
  [![Python](https://img.shields.io/badge/Python-3.8+-green.svg)](https://python.org)
8
 
9
- An open-source implementation of Microsoft Research's "Sequential Diagnosis with Language Models" paper, built with the Swarms AI framework.
 
 
 
 
 
 
10
 
11
  ## πŸš€ Quick Start
12
 
 
 
 
 
 
 
 
 
 
 
13
  ```bash
14
  git clone https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator.git
15
  cd Open-MAI-Dx-Orchestrator
16
  pip install -r requirements.txt
17
  ```
18
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ```python
20
  from mai_dx import MaiDxOrchestrator
21
 
22
- # Create orchestrator
23
  orchestrator = MaiDxOrchestrator()
24
 
25
- # Run diagnosis
26
  result = orchestrator.run(
27
  initial_case_info="29-year-old woman with sore throat and peritonsillar swelling...",
28
  full_case_details="Patient: 29-year-old female. History: Onset of sore throat...",
29
  ground_truth_diagnosis="Embryonal rhabdomyosarcoma of the pharynx"
30
  )
31
 
32
- print(f"Diagnosis: {result.final_diagnosis}")
 
33
  print(f"Accuracy: {result.accuracy_score}/5.0")
34
- print(f"Cost: ${result.total_cost:,}")
35
  ```
36
 
37
- ## ✨ Key Features
38
-
39
- - **8 AI Physician Agents**: Specialized roles for comprehensive diagnosis
40
- - **5 Operational Modes**: instant, question-only, budgeted, no-budget, ensemble
41
- - **Cost Tracking**: Real-time budget monitoring with 25+ medical test costs
42
- - **Clinical Evaluation**: 5-point accuracy scoring with detailed feedback
43
- - **Model Agnostic**: Works with GPT, Gemini, Claude, and other LLMs
44
-
45
- ## πŸ₯ Virtual Physician Panel
46
-
47
- - **🧠 Dr. Hypothesis**: Maintains differential diagnosis with probabilities
48
- - **πŸ”¬ Dr. Test-Chooser**: Selects optimal diagnostic tests
49
- - **πŸ€” Dr. Challenger**: Prevents cognitive biases and diagnostic errors
50
- - **πŸ’° Dr. Stewardship**: Ensures cost-effective care decisions
51
- - **βœ… Dr. Checklist**: Quality control and consistency checks
52
- - **🀝 Consensus Coordinator**: Synthesizes panel decisions
53
- - **πŸ”‘ Gatekeeper**: Clinical information oracle
54
- - **βš–οΈ Judge**: Evaluates diagnostic accuracy
55
 
56
- ## πŸ“‹ Usage Modes
57
 
58
  ```python
59
- # Instant diagnosis (emergency triage)
60
- orchestrator = MaiDxOrchestrator.create_variant("instant")
61
-
62
- # Budget-constrained diagnosis
63
- orchestrator = MaiDxOrchestrator.create_variant("budgeted", budget=3000)
64
-
65
- # Question-only mode (telemedicine)
66
- orchestrator = MaiDxOrchestrator.create_variant("question_only")
67
-
68
- # Full diagnostic capability
69
- orchestrator = MaiDxOrchestrator.create_variant("no_budget")
70
-
71
- # Ensemble approach (multiple panels)
72
- result = orchestrator.run_ensemble(case_info, case_details, ground_truth, num_runs=3)
73
- ```
74
-
75
- ## πŸ›  Configuration
76
 
77
- ```python
78
  orchestrator = MaiDxOrchestrator(
79
  model_name="gemini/gemini-2.5-flash", # or "gpt-4", "claude-3-5-sonnet"
80
  max_iterations=10,
81
- initial_budget=10000,
82
- mode="no_budget"
83
  )
 
 
 
84
  ```
85
 
86
- ## πŸ“š Documentation
87
 
88
- - **[Complete Documentation](docs.md)** - Detailed API reference and examples
89
- - **[Example Usage](example.py)** - Ready-to-run examples
90
- - **[Original Paper](https://arxiv.org/abs/2506.22405)** - Microsoft Research paper
91
 
92
- ## 🎯 Example Results
 
 
 
 
 
 
 
93
 
94
- ```
95
- === MAI-DxO Diagnostic Results ===
96
- Variant: no_budget
97
- Final Diagnosis: Embryonal rhabdomyosarcoma of the pharynx
98
- Ground Truth: Embryonal rhabdomyosarcoma of the pharynx
99
- Accuracy Score: 5.0/5.0
100
- Total Cost: $4,650
101
- Iterations: 4
102
- ```
103
 
104
  ## 🀝 Contributing
105
 
106
- We welcome contributions! Please check our issues and submit pull requests.
107
 
108
  ## πŸ“„ License
109
 
110
- MIT License - see [LICENSE](LICENSE) file for details.
111
 
112
  ## πŸ“š Citation
113
 
 
 
114
  ```bibtex
115
  @misc{nori2025sequentialdiagnosislanguagemodels,
116
- title={Sequential Diagnosis with Language Models},
117
- author={Harsha Nori and others},
118
- year={2025},
119
- eprint={2506.22405},
120
- archivePrefix={arXiv}
 
 
 
 
 
 
 
 
 
121
  }
122
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # MAI Diagnostic Orchestrator (MAI-DxO)
2
 
3
+ > **An open-source implementation of Microsoft Research's "Sequential Diagnosis with Language Models" paper, built with the Swarms AI framework.**
4
+
5
+ MAI-DxO (MAI Diagnostic Orchestrator) is a sophisticated AI-powered diagnostic system that simulates a virtual panel of physician-agents to perform iterative medical diagnosis with cost-effectiveness optimization. This implementation faithfully reproduces the methodology described in the Microsoft Research paper while providing additional features and flexibility.
6
 
7
  [![Paper](https://img.shields.io/badge/Paper-arXiv:2506.22405-red.svg)](https://arxiv.org/abs/2506.22405)
8
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
  [![Python](https://img.shields.io/badge/Python-3.8+-green.svg)](https://python.org)
10
 
11
+ ## ✨ Key Features
12
+
13
+ - **8 AI Physician Agents**: Specialized roles for comprehensive diagnosis.
14
+ - **5 Operational Modes**: Instant, question-only, budgeted, no-budget, and ensemble modes.
15
+ - **Cost Tracking**: Real-time budget monitoring with costs for 25+ medical tests.
16
+ - **Clinical Evaluation**: 5-point accuracy scoring with detailed feedback.
17
+ - **Model Agnostic**: Works with GPT, Gemini, Claude, and other leading LLMs.
18
 
19
  ## πŸš€ Quick Start
20
 
21
+ ### 1. Installation
22
+
23
+ Install the package directly via pip:
24
+
25
+ ```bash
26
+ pip install mai-dx
27
+ ```
28
+
29
+ Or, for development, clone the repository and install the requirements:
30
+
31
  ```bash
32
  git clone https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator.git
33
  cd Open-MAI-Dx-Orchestrator
34
  pip install -r requirements.txt
35
  ```
36
 
37
+ ### 2. Environment Setup
38
+
39
+ Create a `.env` file in your project root and add your API keys:
40
+
41
+ ```txt
42
+ OPENAI_API_KEY="Your OpenAI API key"
43
+ GEMINI_API_KEY="Your Gemini API key"
44
+ ANTHROPIC_API_KEY="Your Anthropic API key"
45
+ ```
46
+
47
+ ### 3. Basic Usage
48
+
49
  ```python
50
  from mai_dx import MaiDxOrchestrator
51
 
52
+ # Create the orchestrator (defaults to a capable model)
53
  orchestrator = MaiDxOrchestrator()
54
 
55
+ # Run a diagnosis
56
  result = orchestrator.run(
57
  initial_case_info="29-year-old woman with sore throat and peritonsillar swelling...",
58
  full_case_details="Patient: 29-year-old female. History: Onset of sore throat...",
59
  ground_truth_diagnosis="Embryonal rhabdomyosarcoma of the pharynx"
60
  )
61
 
62
+ # Print the results
63
+ print(f"Final Diagnosis: {result.final_diagnosis}")
64
  print(f"Accuracy: {result.accuracy_score}/5.0")
65
+ print(f"Total Cost: ${result.total_cost:,.2f}")
66
  ```
67
 
68
+ ## βš™οΈ Advanced Usage & Configuration
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
+ Customize the orchestrator's model, budget, and operational mode.
71
 
72
  ```python
73
+ from mai_dx import MaiDxOrchestrator
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ # Configure with a specific model and budget
76
  orchestrator = MaiDxOrchestrator(
77
  model_name="gemini/gemini-2.5-flash", # or "gpt-4", "claude-3-5-sonnet"
78
  max_iterations=10,
79
+ initial_budget=3000,
80
+ mode="budgeted" # Other modes: "instant", "question_only", "no_budget"
81
  )
82
+
83
+ # Run the diagnosis
84
+ # ...
85
  ```
86
 
87
+ ## πŸ₯ How It Works: The Virtual Physician Panel
88
 
89
+ MAI-DxO employs a multi-agent system where each agent has a specific role:
 
 
90
 
91
+ - **🧠 Dr. Hypothesis**: Maintains the differential diagnosis.
92
+ - **πŸ”¬ Dr. Test-Chooser**: Selects the most cost-effective diagnostic tests.
93
+ - **πŸ€” Dr. Challenger**: Prevents cognitive biases and diagnostic errors.
94
+ - **πŸ’° Dr. Stewardship**: Ensures cost-effective care.
95
+ - **βœ… Dr. Checklist**: Performs quality control checks.
96
+ - **🀝 Consensus Coordinator**: Synthesizes panel decisions.
97
+ - **πŸ”‘ Gatekeeper**: Acts as the clinical information oracle.
98
+ - **βš–οΈ Judge**: Evaluates the final diagnostic accuracy.
99
 
100
+
101
+ ## Documentation
102
+
103
+ Learn more about this repository [with the docs](DOCS.md)
 
 
 
 
 
104
 
105
  ## 🀝 Contributing
106
 
107
+ We welcome contributions! Please feel free to open an issue or submit a pull request.
108
 
109
  ## πŸ“„ License
110
 
111
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
112
 
113
  ## πŸ“š Citation
114
 
115
+ If you use this work in your research, please cite both the original paper and this software implementation.
116
+
117
  ```bibtex
118
  @misc{nori2025sequentialdiagnosislanguagemodels,
119
+ title={Sequential Diagnosis with Language Models},
120
+ author={Harsha Nori and Mayank Daswani and Christopher Kelly and Scott Lundberg and Marco Tulio Ribeiro and Marc Wilson and Xiaoxuan Liu and Viknesh Sounderajah and Jonathan Carlson and Matthew P Lungren and Bay Gross and Peter Hames and Mustafa Suleyman and Dominic King and Eric Horvitz},
121
+ year={2025},
122
+ eprint={2506.22405},
123
+ archivePrefix={arXiv},
124
+ primaryClass={cs.CL},
125
+ url={https://arxiv.org/abs/2506.22405},
126
+ }
127
+
128
+ @software{mai_dx_orchestrator,
129
+ title={Open-MAI-Dx-Orchestrator: An Open Source Implementation of Sequential Diagnosis with Language Models},
130
+ author={The-Swarm-Corporation},
131
+ year={2025},
132
+ url={https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator.git}
133
  }
134
  ```
135
+
136
+ ## πŸ”— Related Work
137
+
138
+ - [Original Paper](https://arxiv.org/abs/2506.22405) - Sequential Diagnosis with Language Models
139
+ - [Swarms Framework](https://github.com/kyegomez/swarms) - Multi-agent AI orchestration
140
+ - [Microsoft Research](https://www.microsoft.com/en-us/research/) - Original research institution
141
+
142
+ ## πŸ“ž Support
143
+
144
+ - **Issues**: [GitHub Issues](https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator/issues)
145
+ - **Discussions**: [GitHub Discussions](https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator/discussions)
146
+ - **Documentation**: [Full Documentation](https://docs.swarms.world)
147
+
148
+ ---
149
+
150
+ <p align="center">
151
+ <strong>Built with Swarms for advancing AI-powered medical diagnosis</strong>
152
+ </p>