Skip to main content

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

promptkit_1-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptkit_1-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for promptkit_1-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dae67f40cf86cfda1ef7677a93ef6d8f148c916965481a02562b70e9edbc5651
MD5 d1de3c971310613a52603ebe82d0ce35
BLAKE2b-256 a6fd36caf3f3bead65e3cef59098ab17638b71f45d6d71841f9dc28ec7d071ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptkit_1-0.1.1.tar.gz:

Publisher: publish.yml on junaidify/promptkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for promptkit_1-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af538b3be3dfdc4309118b95d028b7052c41057e0985963c2bb6680c940cd224
MD5 9d65552bd9a10986b20dff6c0b410384
BLAKE2b-256 93e4b71cc09289c790166e66e0e3ccf333d096344a0ea4f95d4dd3be8425c103

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptkit_1-0.1.1-py3-none-any.whl:

Publisher: publish.yml on junaidify/promptkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page