RadPrompter
RadPrompter is a Python package for simplified and reproducible LLM prompting, particularly tailored for biomedical applications, including Radiology.
Installation
You can install RadPrompter using pip:
pip install radprompter
Note: RadPrompter works with Python 3.7+. However, for maximum compatilibity we recommend using Python 3.11+.
Getting Started
The core of RadPrompter is the .toml configuration file which defines your prompts. Here's a minimal example:
[METADATA]
version = 0.1
description = "A sample prompt for RadPrompter"
[CONSTRUCTOR]
system = "You are an experienced radiologist that help users extract infromation from radiology reports."
user = """Does the following report indicate a normal or abnormal finding?
{{report}}
Just reply with "normal" or "abnormal" to indicate your answer, without any additional information.
"""
And here's how you would use it in Python:
from radprompter import Prompt, RadPrompter, vLLMClient
prompt = Prompt("sample.toml")
client = vLLMClient(
model="google/medgemma-4b-it",
base_url="http://localhost:8000/v1",
temperature=0.0,
seed=42
)
engine = RadPrompter(
client=client,
prompt=prompt,
output_file="output.csv",
)
reports = [{"report": "..."}] # Your radiology reports
engine(reports)
For more details and advanced usage, check out our tutorials.
Tutorials
| Tutorial | Description | Notebook |
|---|---|---|
| 01_Basic-Usecase | Covers the basic usage of RadPrompter | 👁️ 📓 |
| 02_RDP-Templating | Introduces the [PROMPTS] section and rdp operator |
👁️ 📓 |
| 03_Multiturn-Prompting | Demonstrates multi-turn prompting | 👁️ 📓 |
| 04_Using-Schemas | Shows how to use schemas for structured output | 👁️ 📓 |
| 05_JSON-Prefill | Covers using JSON prefills and sanitization | 👁️ 📓 |
| 06_HuggingFace-Client | Covers using the new HuggingFaceClient |
👁️ 📓 |
| 07_Conditional-Schemas | Demonstrates how to use conditional schemas (v2.0+) | 👁️ 📓 |
Contributing
We welcome contributions! If you have any updates or improvements to the package, please open an issue or submit a pull request. We're happy to review and incorporate your changes.
Authors
RadPrompter is created and maintained by:
- Bardia Khosravi (bardiakhosravi95@gmail.com)
- Theo Dapamede (theo.dapamede@emory.edu)
Metadata
Release files for radprompter 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| radprompter-2.0.0.tar.gz | 145.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| radprompter-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 179.5 kB
Release files / radprompter-2.0.0.tar.gz
| Download URL | radprompter-2.0.0.tar.gz |
|---|---|
| Size | 145.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95167f7e8dc1ea2caab7059bec40982502061929cafd76ac1746ce048b8c67a7
|
|
BLAKE2b-256 checksum How to use checksums |
590cb11d6835fb0a4b791b2081096ba3c0fe254d158338478aa29a7acbb71d99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Release files / radprompter-2.0.0-py3-none-any.whl
| Download URL | radprompter-2.0.0-py3-none-any.whl |
|---|---|
| Size | 33.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03366fc4a3b0417b83a67fe6821d4602e667ad11a56c72e91092e35962e358b9
|
|
BLAKE2b-256 checksum How to use checksums |
1f6e5c12c56aa9af800e206017c0079d52e36831ff593a1238841f140de3169d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|