Skip to main content

Keeping your prompts clean since 2023

Project description

Pretty Prompt

Simple tools for better prompts.

Installation

pip install prettyprompt

Usage

Sniffing bad intentions

from prettyprompt import sniffers

# will this SQL statement write to my database?
sniffers.is_sql_write_statement(user_supplied_sql)

# is this a prompt injection attempt? ask ChatGPT
sniffers.is_prompt_injection(prompt, strategy="LLM")

Converting input

from prettyprompt import converters

# convert scraped HTML into plain text, maintaining some structure
converters.html_to_text(scraped_html)

Cleaning input

from prettyprompt import cleaners

# remove tags from HTML
cleaners.remove_tags(html)

# normalise spaces
cleaners.normalise_spaces(text)

# swap common 'smart' characters with ASCII equivalents
cleaners.simplify_text(text)

Tests

  • pip install pytest pytest-mock
  • pytest

TODO

  • Prompt Injection

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

prettyprompt-0.1.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

prettyprompt-0.1.3-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file prettyprompt-0.1.3.tar.gz.

File metadata

  • Download URL: prettyprompt-0.1.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for prettyprompt-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8a612c9a696f55aeab1335c08b4a81add86b5cf245ce9a08248a5b7fa285c046
MD5 de5561c913b0535fd0fd6ce31e3245de
BLAKE2b-256 62d5c39e81266df709636bf95c40518d4ab541fc6183b28da105a69b8de76fbe

See more details on using hashes here.

File details

Details for the file prettyprompt-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for prettyprompt-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d6d63d8035d2cb7b02b749eebbf3f3173eba193181d7eff92e9d4d5ba4853119
MD5 2ae3fb43472c899a31e493668c78a591
BLAKE2b-256 1138bd30096a668ff4516535db569d229965a91b5fcee8f762e5c6b2f5a9a4ef

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