promptkit 🧠
A lightweight Python toolkit for cleaning and preparing text before sending it to any LLM (GPT, Claude, Gemini, etc.)
Every AI developer copy-pastes these utilities across projects. Now you don't have to.
Installation
pip install promptkit
Functions
| Function | What it does |
|---|---|
clean(text) |
Removes extra spaces, repeated punctuation |
truncate_tokens(text, max_words) |
Trims text to stay within token limits |
remove_pii(text) |
Masks emails, phone numbers, URLs |
format_prompt(template, **kwargs) |
Safely fills prompt templates |
word_count(text) |
Returns word count of a string |
Usage
from promptkit import clean, truncate_tokens, remove_pii, format_prompt, word_count
# Clean messy input
clean(" Hello!!! World??? ")
# → "Hello! World?"
# Truncate to token budget
truncate_tokens("one two three four five", max_words=3)
# → "one two three..."
# Remove sensitive info before sending to external APIs
remove_pii("My email is john@gmail.com and number is 9876543210")
# → "My email is [EMAIL] and number is [PHONE]"
# Fill prompt templates safely
format_prompt("Summarize: {text}", text="Hello world")
# → "Summarize: Hello world"
# Quick word count
word_count("Hello world foo bar")
# → 4
Why promptkit?
- ✅ Zero dependencies — pure Python
- ✅ Works with any LLM — OpenAI, Anthropic, Google, local models
- ✅ PII removal keeps your users' data safe
- ✅ Token truncation saves API costs
License
MIT — free to use, modify, and distribute.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptkit_1-0.1.1.tar.gz.
File metadata
- Download URL: promptkit_1-0.1.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dae67f40cf86cfda1ef7677a93ef6d8f148c916965481a02562b70e9edbc5651
|
|
| MD5 |
d1de3c971310613a52603ebe82d0ce35
|
|
| BLAKE2b-256 |
a6fd36caf3f3bead65e3cef59098ab17638b71f45d6d71841f9dc28ec7d071ce
|
Provenance
The following attestation bundles were made for promptkit_1-0.1.1.tar.gz:
Publisher:
publish.yml on junaidify/promptkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
promptkit_1-0.1.1.tar.gz -
Subject digest:
dae67f40cf86cfda1ef7677a93ef6d8f148c916965481a02562b70e9edbc5651 - Sigstore transparency entry: 2340122050
- Sigstore integration time:
-
Permalink:
junaidify/promptkit@5bd8324edd15c7030fa1cffb8ce7e5e8a13bad38 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/junaidify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5bd8324edd15c7030fa1cffb8ce7e5e8a13bad38 -
Trigger Event:
push
-
Statement type:
File details
Details for the file promptkit_1-0.1.1-py3-none-any.whl.
File metadata
- Download URL: promptkit_1-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af538b3be3dfdc4309118b95d028b7052c41057e0985963c2bb6680c940cd224
|
|
| MD5 |
9d65552bd9a10986b20dff6c0b410384
|
|
| BLAKE2b-256 |
93e4b71cc09289c790166e66e0e3ccf333d096344a0ea4f95d4dd3be8425c103
|
Provenance
The following attestation bundles were made for promptkit_1-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on junaidify/promptkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
promptkit_1-0.1.1-py3-none-any.whl -
Subject digest:
af538b3be3dfdc4309118b95d028b7052c41057e0985963c2bb6680c940cd224 - Sigstore transparency entry: 2340122149
- Sigstore integration time:
-
Permalink:
junaidify/promptkit@5bd8324edd15c7030fa1cffb8ce7e5e8a13bad38 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/junaidify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5bd8324edd15c7030fa1cffb8ce7e5e8a13bad38 -
Trigger Event:
push
-
Statement type: