Skip to main content

promptxml

License: MIT GitHub stars PyPI version code style: black formatted with: isort formatted with: isort

About

promptxml is a tool designed to create prompt instructions for neural networks in XML format. This tool helps structure and manage complex prompts, making it easier to feed instructions to neural networks in a well-organized XML format.

Installation

To install promptxml, simply use pip:

pip install promptxml

Usage

Using PromptItem

from promptxml import PromptItem

# Create a new PromptItem
item = PromptItem(label="guideline", value="Do something once")

# Print the XML representation
print(item.to_xml())

Using PromptSection

from promptxml import PromptSection, PromptItem

# Create a new PromptSection
section = PromptSection(label="guidelines")

# Add items to the section
section.add(
    PromptItem(label="guideline", value="Do something once"),
    PromptItem(label="guideline", value="Do something twice")
)

# Print the XML representation
print(section.to_xml())

Nested PromptSection and PromptItem

from promptxml import PromptItem, PromptSection

# Create a new section with nested items and sections
section = PromptSection(label="guidelines")

section.add(
    PromptItem(label="guideline", value="Do something once"),
    PromptItem(label="guideline", value="Do something twice"),
    PromptSection(
        label="guideline",
        items=[
            PromptItem(label="instruction", value="This is a complex instruction with nested list."),
            PromptSection(
                label="some_items",
                items=[
                    PromptItem(label="some_item", value="This is item 1"),
                    PromptItem(label="some_item", value="This is item 2"),
                    PromptItem(label="some_item", value="This is item 3"),
                ],
                instruction="instructions can also be in attributes!, and it can contain some \"quotes\" and 'other quotes'",
                second_attr="qwerty",
            ),
        ],
    ),
    PromptSection(
        label="guideline",
        items=[
            PromptItem(
                label="instruction",
                value="This is a second complex instruction with nested list built with build_multiple.",
            ),
            PromptSection(
                label="some_items",
                items=PromptItem.build_multiple(
                    label="some_item",
                    values=[
                        "This is item 1",
                        "This is item 2",
                        "This is item 3",
                    ],
                ),
            ),
        ],
    ),
)

# Print the XML representation and pretty-print it
print(section.to_xml())
print(section.make_pretty())

Troubleshooting

If you encounter any issues, please visit the issues section on GitHub to report a problem or seek assistance.

Contribution

Contributions are welcome. Please fork the repository, make your changes, and submit a pull request. For detailed contribution guidelines, please refer to the CONTRIBUTION.md file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for promptxml 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promptxml 0.1.1
File Size Uploaded Provenance
promptxml-0.1.1.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for promptxml 0.1.1
File Interpreter ABI Platform
promptxml-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / promptxml-0.1.1.tar.gz

Download URL promptxml-0.1.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
63e2bb8dc2d0070219bf57d0ceceda907e1be7b6cdba11abed03f2863f8364af
BLAKE2b-256 checksum
How to use checksums
e26b0d0c379e9a0c47a4230fa9eee4f32b6b9727bcc0bd0d7c7a76c40f6ad351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.4 Linux/6.5.0-1023-azure

Release files / promptxml-0.1.1-py3-none-any.whl

Download URL promptxml-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66069c1eee9469f86b9f7bc71b4bdea2283d55ed454755b64cc7f162b4763639
BLAKE2b-256 checksum
How to use checksums
3f408db2688509a0d357219a11d44ad34953174c2875197f900cd8d411fda70a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.4 Linux/6.5.0-1023-azure

Security for promptxml 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page