Skip to main content

A simple yet powerful prompt templating engine

Project description

Promuet

PyPI - Version PyPI - Downloads PyPI - Python Version

A simple yet powerful prompt templating engine

Promuet is a simple Python library for designing complex chains of prompts using basic prompt templates. See below for an example.

Example Usage

At the core, Promuet is just

template = TemplateMatchItem(
    """
        Task {{task_number:int}}: {{task_title}}
        Description: {{task_description}}

        Verification: {{task_verification_items:list}}
    """
)
input_string = """
    Task 12: Clean the house
    Description:
    I need to clean the house to make it nice.

    The floors need to be cleaned, the rugs vacuumed, and the laundry folded.

    Verification:
    - Floors should have no dust
    - Rugs should be free of dirt
    - Laundry should be folded
"""
data = template.parse(input_string)
assert data['.str'].strip() == textwrap.dedent(input_string).strip()
data = extract_data_vars(data)
assert data == dict(
    task_number=12,
    task_title='Clean the house',
    task_description='I need to clean the house to make it nice.\n\nThe floors need to be cleaned, the rugs vacuumed, and the laundry folded.',
    task_verification_items=[
        'Floors should have no dust',
        'Rugs should be free of dirt',
        'Laundry should be folded',
    ],
)

Installation

pip install promuet

License

promuet is distributed under the terms of the MIT license.

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

promuet-0.3.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

promuet-0.3.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file promuet-0.3.1.tar.gz.

File metadata

  • Download URL: promuet-0.3.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for promuet-0.3.1.tar.gz
Algorithm Hash digest
SHA256 691b56ae4270c13ddc144b46935d52c35b394ede29fc846118e059742817e044
MD5 92c37ef7a97192a5cca935eda04337fd
BLAKE2b-256 1f541e2a436153207bc827d5d8f1ad0abe4229591d22599723609095e06873b0

See more details on using hashes here.

File details

Details for the file promuet-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: promuet-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for promuet-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4c89bf78e8d354b434463e1edc0ef6482f68655215af5f7365e936e5ae829dd
MD5 e3c81c34bb9db06a2be6bda0cd28ab8b
BLAKE2b-256 ede7e732f87672c0071849ccf83ca2f78ed579ef3e9ab31356928beb0de2cce3

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