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.2.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

promptdown-0.2.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for promptdown-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d32f09721ea9609db696fb9a9ceef614c0f4bd266038c2860701c8dd4003b039
MD5 4731bc3aa685ffa00f920cc4b63950bd
BLAKE2b-256 469c4b65b197f151f922551d7c2de82f210096da86f9979b6508f627575100cf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for promptdown-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e9863d1d82162d354258ccf463b1859985d7d60b7c6077202f76a2cef9222a57
MD5 4694242b997592efce6db2b1c3eab8a3
BLAKE2b-256 5eecf10ba9b09a6c7aac951a055847ef021e0fb493435033d4ce2a85b0b8e644

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