<div align="center">
<h1>promptxml</h1>
<p>
<img alt="License: MIT" src="https://img.shields.io/github/license/barabum0/promptxml">
<img alt="GitHub stars" src="https://img.shields.io/github/stars/barabum0/promptxml">
<a href="https://pypi.org/project/promptxml">
<img alt="PyPI version" src="https://img.shields.io/pypi/v/promptxml.svg?logo=pypi&logoColor=FFE873">
</a>
<a href="https://github.com/psf/black">
<img alt="code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a>
<a href="https://github.com/PyCQA/isort">
<img alt="formatted with: isort" src="https://img.shields.io/badge/formatted%20with-isort-blue.svg">
</a>
<a href="https://mypy-lang.org/">
<img alt="formatted with: isort" src="https://www.mypy-lang.org/static/mypy_badge.svg">
</a>
</p>
</div>
## 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:
```bash
pip install promptxml
```
## Usage
### Using `PromptItem`
```python
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`
```python
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`
```python
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](https://github.com/barabum0/promptxml/issues) 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](CONTRIBUTION.md) file.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/barabum0/promptxml",
"name": "promptxml",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "python, chatgpt, ai, prompt, xml, instruction",
"author": "sushka",
"author_email": "r.m.poltorabatko@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e2/6b/0d0c379e9a0c47a4230fa9eee4f32b6b9727bcc0bd0d7c7a76c40f6ad351/promptxml-0.1.1.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <h1>promptxml</h1>\n <p>\n <img alt=\"License: MIT\" src=\"https://img.shields.io/github/license/barabum0/promptxml\">\n <img alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/barabum0/promptxml\">\n <a href=\"https://pypi.org/project/promptxml\">\n <img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/promptxml.svg?logo=pypi&logoColor=FFE873\">\n </a>\n <a href=\"https://github.com/psf/black\">\n <img alt=\"code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\">\n </a>\n <a href=\"https://github.com/PyCQA/isort\">\n <img alt=\"formatted with: isort\" src=\"https://img.shields.io/badge/formatted%20with-isort-blue.svg\">\n </a>\n <a href=\"https://mypy-lang.org/\">\n <img alt=\"formatted with: isort\" src=\"https://www.mypy-lang.org/static/mypy_badge.svg\">\n </a>\n </p>\n</div>\n\n## About\n\n**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.\n\n## Installation\n\nTo install **promptxml**, simply use pip:\n\n```bash\npip install promptxml\n```\n\n## Usage\n\n### Using `PromptItem`\n\n```python\nfrom promptxml import PromptItem\n\n# Create a new PromptItem\nitem = PromptItem(label=\"guideline\", value=\"Do something once\")\n\n# Print the XML representation\nprint(item.to_xml())\n```\n\n### Using `PromptSection`\n\n```python\nfrom promptxml import PromptSection, PromptItem\n\n# Create a new PromptSection\nsection = PromptSection(label=\"guidelines\")\n\n# Add items to the section\nsection.add(\n PromptItem(label=\"guideline\", value=\"Do something once\"),\n PromptItem(label=\"guideline\", value=\"Do something twice\")\n)\n\n# Print the XML representation\nprint(section.to_xml())\n```\n\n### Nested `PromptSection` and `PromptItem`\n\n```python\nfrom promptxml import PromptItem, PromptSection\n\n# Create a new section with nested items and sections\nsection = PromptSection(label=\"guidelines\")\n\nsection.add(\n PromptItem(label=\"guideline\", value=\"Do something once\"),\n PromptItem(label=\"guideline\", value=\"Do something twice\"),\n PromptSection(\n label=\"guideline\",\n items=[\n PromptItem(label=\"instruction\", value=\"This is a complex instruction with nested list.\"),\n PromptSection(\n label=\"some_items\",\n items=[\n PromptItem(label=\"some_item\", value=\"This is item 1\"),\n PromptItem(label=\"some_item\", value=\"This is item 2\"),\n PromptItem(label=\"some_item\", value=\"This is item 3\"),\n ],\n instruction=\"instructions can also be in attributes!, and it can contain some \\\"quotes\\\" and 'other quotes'\",\n second_attr=\"qwerty\",\n ),\n ],\n ),\n PromptSection(\n label=\"guideline\",\n items=[\n PromptItem(\n label=\"instruction\",\n value=\"This is a second complex instruction with nested list built with build_multiple.\",\n ),\n PromptSection(\n label=\"some_items\",\n items=PromptItem.build_multiple(\n label=\"some_item\",\n values=[\n \"This is item 1\",\n \"This is item 2\",\n \"This is item 3\",\n ],\n ),\n ),\n ],\n ),\n)\n\n# Print the XML representation and pretty-print it\nprint(section.to_xml())\nprint(section.make_pretty())\n```\n\n## Troubleshooting\n\nIf you encounter any issues, please visit the [issues section](https://github.com/barabum0/promptxml/issues) on GitHub to report a problem or seek assistance.\n\n## Contribution\n\nContributions are welcome. Please fork the repository, make your changes, and submit a pull request. For detailed contribution guidelines, please refer to the [CONTRIBUTION.md](CONTRIBUTION.md) file.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool designed to create prompt instructions for neural networks in XML format.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/barabum0/promptxml",
"Repository": "https://github.com/barabum0/promptxml"
},
"split_keywords": [
"python",
" chatgpt",
" ai",
" prompt",
" xml",
" instruction"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3f408db2688509a0d357219a11d44ad34953174c2875197f900cd8d411fda70a",
"md5": "67cf0a72c3e09323c5fa3569a3d298d7",
"sha256": "66069c1eee9469f86b9f7bc71b4bdea2283d55ed454755b64cc7f162b4763639"
},
"downloads": -1,
"filename": "promptxml-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "67cf0a72c3e09323c5fa3569a3d298d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 4483,
"upload_time": "2024-07-13T13:27:56",
"upload_time_iso_8601": "2024-07-13T13:27:56.879552Z",
"url": "https://files.pythonhosted.org/packages/3f/40/8db2688509a0d357219a11d44ad34953174c2875197f900cd8d411fda70a/promptxml-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e26b0d0c379e9a0c47a4230fa9eee4f32b6b9727bcc0bd0d7c7a76c40f6ad351",
"md5": "9da40af7ecf551e4550fac91c94683d3",
"sha256": "63e2bb8dc2d0070219bf57d0ceceda907e1be7b6cdba11abed03f2863f8364af"
},
"downloads": -1,
"filename": "promptxml-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "9da40af7ecf551e4550fac91c94683d3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 3828,
"upload_time": "2024-07-13T13:27:58",
"upload_time_iso_8601": "2024-07-13T13:27:58.243866Z",
"url": "https://files.pythonhosted.org/packages/e2/6b/0d0c379e9a0c47a4230fa9eee4f32b6b9727bcc0bd0d7c7a76c40f6ad351/promptxml-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-13 13:27:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "barabum0",
"github_project": "promptxml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "promptxml"
}