Skip to main content

A package for loading promptdown files, which are a special type of markdown file for defining structured LLM prompts

Project description

Promptdown

Promptdown is a Python package that allows you to express structured prompts for language models in a markdown format. It provides a simple and intuitive way to define and manage prompts, making it easier to work with language models in your projects.

Installation

Using PDM

Promptdown can be installed using PDM:

pdm add promptdown

Using pip

Alternatively, you can install Promptdown using pip:

pip install promptdown

Usage

Basic Usage

To use Promptdown, simply create a Promptdown file (.prompt.md) with the following format:

# My Prompt

## System Message

You are a helpful assistant.

## Conversation

| Role      | Content                                     |
|-----------|---------------------------------------------|
| User      | Hi, can you help me?                        |
| Assistant | Of course! What do you need assistance with?|
| User      | I'm having trouble with my code.            |
| Assistant | I'd be happy to help. What seems to be the problem? |

Then, you can parse this file into a StructuredPrompt object using Promptdown:

from promptdown import StructuredPrompt

structured_prompt = StructuredPrompt.from_promptdown_file('path/to/my_prompt.prompt.md')
print(structured_prompt)

Advanced Usage

You can also parse a Promptdown string directly:

promptdown_string = """
# My Prompt

## System Message

You are a helpful assistant.

## Conversation

| Role      | Content                                     |
|-----------|---------------------------------------------|
| User      | Hi, can you help me?                        |
| Assistant | Of course! What do you need assistance with?|
| User      | I'm having trouble with my code.            |
| Assistant | I'd be happy to help. What seems to be the problem? |
"""

structured_prompt = StructuredPrompt.from_promptdown_string(promptdown_string)
print(structured_prompt)

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

Promptdown is released under 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

promptdown-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

promptdown-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file promptdown-0.1.0.tar.gz.

File metadata

  • Download URL: promptdown-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for promptdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3c2002fc0785b4dd28b832d3991b245b751ee5dd8b1fe99608998817202c252
MD5 506fc55c94bf7887a1448ab682c71120
BLAKE2b-256 77bb8734fe4dbb76f256ce62aa2cd15f544a410ab7f38404a279f2d380c80a07

See more details on using hashes here.

File details

Details for the file promptdown-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: promptdown-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for promptdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f604e192a64ddcf24d5ea8f426b6e2b5e95e5e3719c9316a93f774c63d8c9aa9
MD5 9126e2ae9cf3a009f40578a24e24836f
BLAKE2b-256 e701a5bd6b985a734e3560a912bf5a2c9a859bd167a1c6addf77071693ad3558

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