radprompter


Nameradprompter JSON
Version 1.1.10 PyPI version JSON
download
home_pageNone
SummaryA package for simplified and reproducible LLM prompting.
upload_time2024-05-26 04:26:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![RadPrompter](./logo.png)

# 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:

```bash
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:

```toml
[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:

```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               | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/01_Basic-Usecase/01_Basic-Usecase.ipynb) [📓](./tutorials/01_Basic-Usecase)     |
| 02_RDP-Templating           | Introduces the `[PROMPTS]` section and `rdp` operator | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/02_RDP-Templating/02_RDP-Templating.ipynb) [📓](./tutorials/02_RDP-Templating)    |
| 03_Multiturn-Prompting      | Demonstrates multi-turn prompting                   | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/03_Multiturn-Prompting/03_Multiturn-Prompting.ipynb) [📓](./tutorials/03_Multiturn-Prompting) |
| 04_Using-Schemas            | Shows how to use schemas for structured output      | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/04_Using-Schemas/04_Using-Schemas.ipynb) [📓](./tutorials/04_Using-Schemas)     |
| 05_JSON-Prefill        | Covers using JSON prefills and sanitization                     | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/05_JSON-Prefill/05_JSON-Prefill.ipynb) [📓](./tutorials/05_JSON-Prefill)  |
| 06_HuggingFace-Client        | Covers using the new `HuggingFaceClient`                     | [👁️](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/06_HuggingFace-Client/06_HuggingFace-Client.ipynb) [📓](./tutorials/06_HuggingFace-Client)  |

## 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)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "radprompter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Bardia Khosravi <bardiakhosravi95@gmail.com>, Theo Dapamede <theo.dapamede@emory.edu>",
    "keywords": null,
    "author": null,
    "author_email": "Bardia Khosravi <bardiakhosravi95@gmail.com>, Theo Dapamede <theo.dapamede@emory.edu>",
    "download_url": "https://files.pythonhosted.org/packages/f9/ee/d6b2e617e312cef398c09868e7f8b07540bab13c980b729bf94869842e6e/radprompter-1.1.10.tar.gz",
    "platform": null,
    "description": "![RadPrompter](./logo.png)\n\n# RadPrompter\n\nRadPrompter is a Python package for simplified and reproducible LLM prompting, particularly tailored for biomedical applications, including Radiology.\n\n## Installation\n\nYou can install RadPrompter using pip:\n\n```bash\npip install radprompter\n```\n\n*Note*: RadPrompter works with Python 3.7+. However, for maximum compatilibity we recommend using Python 3.11+.\n\n## Getting Started\n\nThe core of RadPrompter is the `.toml` configuration file which defines your prompts. Here's a minimal example:\n\n```toml\n[METADATA]\nversion = 0.1\ndescription = \"A sample prompt for RadPrompter\"\n\n[CONSTRUCTOR]\nsystem = \"You are an experienced radiologist that help users extract infromation from radiology reports.\"\nuser = \"\"\"Does the following report indicate a normal or abnormal finding?\n{{report}}\n\nJust reply with \"normal\" or \"abnormal\" to indicate your answer, without any additional information.\n\"\"\"\n```\n\nAnd here's how you would use it in Python:\n\n```python\nfrom radprompter import Prompt, RadPrompter, vLLMClient\n\nprompt = Prompt(\"sample.toml\")\n\nclient = vLLMClient(\n    model=\"meta-llama/Meta-Llama-3-8B-Instruct\",\n    base_url=\"http://localhost:9999/v1\",\n    temperature=0.0,\n    seed=42\n)\n\nengine = RadPrompter(\n    client=client,\n    prompt=prompt, \n    output_file=\"output.csv\",\n)\n\nreports = [{\"report\": \"...\"}]  # Your radiology reports\nengine(reports)\n```\n\nFor more details and advanced usage, check out our tutorials.\n\n## Tutorials\n\n| Tutorial                    | Description                                         | Notebook                                                                         |\n|-----------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------|\n| 01_Basic-Usecase            | Covers the basic usage of RadPrompter               | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/01_Basic-Usecase/01_Basic-Usecase.ipynb) [\ud83d\udcd3](./tutorials/01_Basic-Usecase)     |\n| 02_RDP-Templating           | Introduces the `[PROMPTS]` section and `rdp` operator | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/02_RDP-Templating/02_RDP-Templating.ipynb) [\ud83d\udcd3](./tutorials/02_RDP-Templating)    |\n| 03_Multiturn-Prompting      | Demonstrates multi-turn prompting                   | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/03_Multiturn-Prompting/03_Multiturn-Prompting.ipynb) [\ud83d\udcd3](./tutorials/03_Multiturn-Prompting) |\n| 04_Using-Schemas            | Shows how to use schemas for structured output      | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/04_Using-Schemas/04_Using-Schemas.ipynb) [\ud83d\udcd3](./tutorials/04_Using-Schemas)     |\n| 05_JSON-Prefill        | Covers using JSON prefills and sanitization                     | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/05_JSON-Prefill/05_JSON-Prefill.ipynb) [\ud83d\udcd3](./tutorials/05_JSON-Prefill)  |\n| 06_HuggingFace-Client        | Covers using the new `HuggingFaceClient`                     | [\ud83d\udc41\ufe0f](https://nbviewer.org/github/BardiaKh/RadPrompter/blob/main/tutorials/06_HuggingFace-Client/06_HuggingFace-Client.ipynb) [\ud83d\udcd3](./tutorials/06_HuggingFace-Client)  |\n\n## Contributing\n\nWe 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.\n\n## Authors\n\nRadPrompter is created and maintained by:\n- Bardia Khosravi (bardiakhosravi95@gmail.com)\n- Theo Dapamede (theo.dapamede@emory.edu)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package for simplified and reproducible LLM prompting.",
    "version": "1.1.10",
    "project_urls": {
        "Home": "https://github.com/BardiaKh/RadPrompter"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "588812cf4752dc8a00969c3470ee3c6e1d8da6df4d084a58661e97bb6665c11a",
                "md5": "c379638e88d8102c04797af5ccbe0d84",
                "sha256": "0357d2d9546ab3f53d1a83b6300bba0aeca4958c02823a0c8c652da90a6c7310"
            },
            "downloads": -1,
            "filename": "radprompter-1.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c379638e88d8102c04797af5ccbe0d84",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 23129,
            "upload_time": "2024-05-26T04:26:28",
            "upload_time_iso_8601": "2024-05-26T04:26:28.038919Z",
            "url": "https://files.pythonhosted.org/packages/58/88/12cf4752dc8a00969c3470ee3c6e1d8da6df4d084a58661e97bb6665c11a/radprompter-1.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f9eed6b2e617e312cef398c09868e7f8b07540bab13c980b729bf94869842e6e",
                "md5": "c2e17e3b420b217b1084bfcadc67a348",
                "sha256": "efc75e60fd2da46505e8b5328ac85e20cefb22ee57d1adb856d27753beea3fe6"
            },
            "downloads": -1,
            "filename": "radprompter-1.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "c2e17e3b420b217b1084bfcadc67a348",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 132548,
            "upload_time": "2024-05-26T04:26:29",
            "upload_time_iso_8601": "2024-05-26T04:26:29.451931Z",
            "url": "https://files.pythonhosted.org/packages/f9/ee/d6b2e617e312cef398c09868e7f8b07540bab13c980b729bf94869842e6e/radprompter-1.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 04:26:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BardiaKh",
    "github_project": "RadPrompter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "radprompter"
}
        
Elapsed time: 0.24694s