Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

aitextutils

Text cleaning, chunking, and prompt helpers for AI pipelines.

This package is the text-only counterpart to aitextkit. It has no OS installer and no system.py.

Install

pip install aitextutils

Local development:

cd aitextutils
pip install -e ".[dev]"

Usage

from aitextutils import (
    build_chat_messages,
    build_prompt,
    clean_text,
    chunk_text,
    estimate_tokens,
    extract_code_block,
    extract_json_block,
    redact_secrets,
    truncate_to_tokens,
)

clean_text("Hello   <b>world</b>")
# "Hello world"

estimate_tokens("abcd")
# 1

build_prompt("Summarize this.", system="You are concise.", context="A long article.")
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)

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

aitextutils_py-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

aitextutils_py-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file aitextutils_py-0.1.0.tar.gz.

File metadata

  • Download URL: aitextutils_py-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for aitextutils_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68fabad01e3faee62ad968ddd6899f109aec32a7ba37f6056ce333c18e5ed61f
MD5 17459aabc7ec875ab12628ab117347c2
BLAKE2b-256 917c5cd3dcdc20925a38059a8de3d46bf2c7cad94a3b762e11b183bc9397a518

See more details on using hashes here.

File details

Details for the file aitextutils_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aitextutils_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for aitextutils_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e85ff5dbcb4740b6442b64af96509cbd2b195e2508e9e577344031f7a0fb550
MD5 7026528c1a5e4c5e00a2d23b38303a8b
BLAKE2b-256 eec5ab47c5210def31c21e604a3984cbdd29ccd6c8f031a5333012f9fb94f013

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page