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
# (needs an OpenAI API key)
sniffers.is_prompt_injection(prompt, strategy="LLM")
# uses spaCy to indicate the imperative-ness of a string
# needs a trained pipeline e.g. `python -m spacy download en_core_web_sm`
sniffers.is_imperative(prompt)
Converting input
from prettyprompt import converters
# convert scraped HTML into plain text, maintaining some structure
converters.html_to_text(scraped_html)
# splits text into meaningful chunks, using GPT-3.5
converters.chunker(long_text, max_words_per_chunk, min_words_per_chunk)
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-mockpytest
TODO
Metadata
Release files for prettyprompt 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prettyprompt-0.1.5.tar.gz | 7.9 kB | Without provenance | Details for prettyprompt-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prettyprompt-0.1.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for prettyprompt-0.1.5-py2.py3-none-any.whl |
Total release size: 13.0 kB
Release files / prettyprompt-0.1.5.tar.gz
| Download URL | prettyprompt-0.1.5.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48ba2de04668da3efd82e5829316d58b9b01582bfdbdf978eae5ce77f98915cb
|
|
BLAKE2b-256 checksum How to use checksums |
a1e7fc5148abad84d01d107cb2b357919c9cb665fdca2eb56277d88242ef18b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.2
|
Release files / prettyprompt-0.1.5-py2.py3-none-any.whl
| Download URL | prettyprompt-0.1.5-py2.py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c45b0f3fda6bb52aa1fc718bf3c160dae732bb00eb907ff0be3f985d512aa3c4
|
|
BLAKE2b-256 checksum How to use checksums |
0b081db8b2796ecbbacb50ac136bfc6a8ea4e69832721322cd7cf76af32f907b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.2
|
Security for prettyprompt 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.