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 hashes)
Built Distribution
Close
Hashes for prettyprompt-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6d63d8035d2cb7b02b749eebbf3f3173eba193181d7eff92e9d4d5ba4853119 |
|
MD5 | 2ae3fb43472c899a31e493668c78a591 |
|
BLAKE2b-256 | 1138bd30096a668ff4516535db569d229965a91b5fcee8f762e5c6b2f5a9a4ef |