Skip to main content

A package for simplified and reproducible LLM prompting.

Project description

RadPrompter

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="meta-llama/Meta-Llama-3-8B-Instruct",
    base_url="http://localhost:9999/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 👁️ 📓

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radprompter-1.1.15.tar.gz (132.5 kB view details)

Uploaded Source

Built Distribution

radprompter-1.1.15-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file radprompter-1.1.15.tar.gz.

File metadata

  • Download URL: radprompter-1.1.15.tar.gz
  • Upload date:
  • Size: 132.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for radprompter-1.1.15.tar.gz
Algorithm Hash digest
SHA256 ef8007d2181ae73bfc2aa98b66d0e0bd25f45b6ca98152b769cb8fe887f7f349
MD5 b535f0f3bb68392dc1242e794366005e
BLAKE2b-256 eed71dbc2018a9edc20878bc5e3cec30f86630e53cde90ca1936cb22780c6461

See more details on using hashes here.

File details

Details for the file radprompter-1.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for radprompter-1.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 950036fa83f3e5fa720d8ed38ff5864aba99601a1e5cacc348fcfd9e6ddec50a
MD5 f0c5c938329d1126e2ff4485b1a15e58
BLAKE2b-256 830d5b98ce8f283ea4edc68499d3f0671ab4b2c57be4444b8e9b7dc29e7d54ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page