OpenMed is a Python library that delivers state-of-the-art biomedical and clinical Large Language Models (LLMs), focusing on advanced entity extraction, assertion detection, and medical reasoning. It provides a robust, open-source toolkit for HIPAA-compliant workflows, supporting a simple Python API, a FastAPI-based REST service, and batch processing capabilities. The library is actively developed, with its current version being 0.6.4, and is designed to unify model discovery, advanced extractions, and one-line orchestration for clinical NLP workflows.
pip install openmedVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `analyze_text` function to perform named entity recognition (NER) on clinical text using a specified model. It prints detected entities, their text, and confidence scores.
Allocate sufficient RAM/VRAM. For GPU acceleration, ensure compatible drivers and PyTorch/TensorFlow installations. Specify `model_name` correctly or configure `OPENMED_MODEL_CACHE_DIR` to pre-download models.
Carefully review OpenMed's PII documentation. Ensure secure data handling practices, access controls, and auditing are in place at the application and infrastructure level.
Always explicitly set the desired `config_profile` when invoking `analyze_text` or related functions in production contexts, or manage it via environment variables (e.g., `OPENMED_PROFILE`).
When processing non-English text for PII, pass the appropriate ISO 639-1 language code to the `lang` parameter.
Install the library using pip: `pip install openmed` or `uv pip install openmed` if you are using the `uv` installer.
Install `openmed` with the Hugging Face support extra: `pip install 'openmed[hf]'` or `uv pip install 'openmed[hf]'`.
Verify that the `model_name` is spelled correctly and is a valid model listed in the OpenMed model registry. Ensure you have an active internet connection to download models, or check your local Hugging Face cache for corrupted files. Example correct usage: `analyze_text("text", model_name="disease_detection_superclinical")`.