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.1.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.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aitextutils_py-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 72f025ae07e58af0c39559d2003bf8c85bc3b3ec0d66305de7e0e43eb772b913
MD5 ef49d5f0ba46ffddbbb250a96d07119d
BLAKE2b-256 589703ccd73d026b2fdcbdecb1e3ae91901bc59a779d4ab38935eafba59143f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aitextutils_py-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc0ea02e0af2ce35239927cfe97806f1b5a431c0baee225ede24f1c77553230b
MD5 afe37399caebf9abb5f6b01b4e6b01d2
BLAKE2b-256 3ec206f55be36829a7642559c40b119296970215227376b21e6e2224286c70c2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 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