This project is a multi-agent system designed to process medical data using large language models (LLMs). The system is modular, with agents responsible for different tasks, such as data loading, preprocessing, and analysis using LLMs like GPT-4. This framework can be extended for various medical data analysis use cases, such as diagnostics, predictions, and clinical document processing.
- Multi-Agent System: Modular agents for data collection, preprocessing, and analysis.
- LLM Integration: Seamless integration with large language models (e.g., GPT-4, GPT-3).
- Medical Data Processing: Process and analyze medical data for insights using AI models.
- Extendable: Add new agents for additional tasks or other AI models.
llm-multi-agent-medical-data/
├── agents/
│ ├── __init__.py # Initializes the agents module
│ ├── data_agent.py # Agent for loading and preprocessing medical data
│ ├── analysis_agent.py # Agent for analyzing data using an LLM
├── data/
│ ├── sample_data.csv # Sample medical data for development
├── models/
│ ├── llm_model.py # LLM model integration logic
├── tests/
│ ├── test_agents.py # Unit tests for the agents
├── README.md # Project documentation
├── requirements.txt # Project dependencies
├── main.py # Entry point to run the system
└── .gitignore # Files to ignore in version control
Make sure you have the following installed:
- Python 3.x
- OpenAI or Hugging Face API Key (if you're using GPT-3 or GPT-4)
-
Clone the repository:
git clone https://github.com/TUDB-Labs/LLM-Medical-Agent.git cd llm-multi-agent-medical-data
-
Install the dependencies:
pip install -r requirements.txt
-
Add your API key for the LLM (if applicable). For OpenAI, for example:
export OPENAI_API_KEY="your-api-key"
To run the system, execute:
python main.py
The agents will load the sample data, preprocess it, and analyze it using the specified LLM.
The data/sample_data.csv
contains placeholder data. Replace this with actual medical data for real-world use cases.
-
DataAgent: Responsible for loading and preprocessing medical data.
- Example:
data_agent = DataAgent('data/sample_data.csv') data = data_agent.load_data() preprocessed_data = data_agent.preprocess_data()
- Example:
-
LLMModel: A wrapper around the large language model API to process text data.
- Example:
llm_model = LLMModel('gpt-4') result = llm_model.process_text("Analyze this medical record")
- Example:
-
AnalysisAgent: Uses the LLM to analyze the preprocessed data.
- Example:
analysis_agent = AnalysisAgent(llm_model) analysis_agent.analyze(preprocessed_data)
- Example:
To run the unit tests:
pytest tests/
- Add more agents for data validation and transformation.
- Expand LLM integration to support different models (e.g., BERT, BioBERT).
- Improve data preprocessing for medical-specific data formats (e.g., DICOM, HL7).
- Implement additional test cases for robust validation.
Contributions are welcome! Please submit a pull request or open an issue for discussion.
This project is licensed under the MIT License. See the LICENSE file for details.