Quarantined
This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.
aitextkit
Text cleaning, chunking, and token estimation for AI pipelines.
Install
pip install aitextkit
For local development:
pip install -e .
Usage
from aitextkit import (
build_chat_messages,
build_prompt,
clean_text,
extract_code_block,
extract_json_block,
redact_secrets,
truncate_to_tokens,
)
clean_text("Hello <b>world</b>")
# "Hello world"
prompt = build_prompt(
"Summarize this.",
system="You are concise.",
context="A long article.",
max_context_tokens=500,
)
messages = build_chat_messages("Hello", system="Be brief.")
extract_code_block("```python\nprint(1)\n```", "python")
extract_json_block('Answer: {"ok": true}')
redact_secrets("contact me@site.com")
truncate_to_tokens(long_text, 200)
API
clean_text(value, strip_html=True, strip_urls=False)chunk_text(value, max_chars=1000, overlap_chars=100)estimate_tokens(value)truncate_to_tokens(value, max_tokens)build_prompt(instruction, system="", context="", max_context_tokens=None)build_chat_messages(user, system="", context="")extract_code_block(value, language=None)extract_json_block(value)redact_secrets(value)get_os_version()— returnswindows,mac, orlinuxinname
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aitextkit_py-0.1.1.tar.gz
(3.9 MB
view details)
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 aitextkit_py-0.1.1.tar.gz.
File metadata
- Download URL: aitextkit_py-0.1.1.tar.gz
- Upload date:
- Size: 3.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65405db1b5fc4c5fbe01612613e8ef27618af7c5bdc7342a8c9c1a4df48972e3
|
|
| MD5 |
21ad51b8eaeca5e6b0a3af536cd254c6
|
|
| BLAKE2b-256 |
a53655dac09f3ba44cf3519216b393cb28b14bb908afe9e2c6862cd5434fcaf1
|
File details
Details for the file aitextkit_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aitextkit_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c64cd68667e889896742a76444f11b0e6160bc31ed4f38794bb3612275e63f8b
|
|
| MD5 |
c129916d6fc0d66c06cbeff5298b9e21
|
|
| BLAKE2b-256 |
74c9c44cc3ffe697e0d4a9dfc738ed339f865b84170aebdd9ecbdb6f38cf8ebf
|