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

Uploaded Source

Built Distribution

promptdown-0.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for promptdown-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4775c33b5c7671845b0a31566d377094e02f167f4fd16677b8a54a213eca5673
MD5 c96b207886207ae3aba987086cb69461
BLAKE2b-256 1ed88d518a3fa4fa74c908623fac60893dbd73eb5d771e6d4b0c0b69d1383e64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: promptdown-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73cd6ab904f5ae7bcd043f5ed94ef6b533eb38c394c24318fb0dede1f02e7364
MD5 4f8d3031c325e429b10e6f00e2e44757
BLAKE2b-256 4edd7fc5b8b843e455bf3614d7a3b6e7289842e891fabe4ebf0ebd107cd1123f

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