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.

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() — returns windows, mac, or linux in name

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.0.tar.gz (3.9 MB view details)

Uploaded Source

Built Distribution

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

aitextkit_py-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aitextkit_py-0.1.0.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

Hashes for aitextkit_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38eb22c9cdfb4d930dae69fb368d71ffac44e6376713a36ca64b8aa462ef12e0
MD5 ec3027b0c9462a429a1c9bd71c1b0a2e
BLAKE2b-256 993d7cd53358e0ca16510976bfd726e987901a2418ced3ebf1af765ac3ad29f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aitextkit_py-0.1.0-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

Hashes for aitextkit_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc559b785a4d9c319ee1f58558524f3f3d6f832d1d02587533898308a84e256f
MD5 46b882d4cb77569fa32342499791dfac
BLAKE2b-256 9836123b013fc812c2d1940733612ffb5f38e60282ab30203826e3e40a213731

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