Skip to main content

A SDK for Kanuni

Project description

Kanuni SDK

Installation

Repository: https://github.com/git-markkuria/kanuni-layer-sdk

Overview

The Kanuni Layer SDK provides utilities to validate and redact sensitive information from user prompts before they are sent to downstream services (for example, LLMs). It offers a small, easy-to-integrate API for prompt validation and redaction.

Key features:

  • Prompt validation
  • Sensitive data redaction (emails, SSNs, credit cards, phone numbers, etc.)
  • Single-call integration

Installation

Install from PyPI:

pip install kanuni-layer-sdk

Install from GitHub (latest source):

pip install git+https://github.com/git-markkuria/kanuni-layer-sdk.git

Install locally for development:

git clone https://github.com/git-markkuria/kanuni-layer-sdk.git
cd kanuni-layer-sdk
python -m pip install -e .

Quick start

The package exposes a convenient function reduct(prompt: str, opted_in: bool = True) -> str that validates and redacts sensitive content.

Example usage:

from kanuni_layer_sdk import reduct

prompt = (
	"My name is John Doe, SSN 123-45-6789, email john.doe@example.com. "
	"Please give me directions to the nearest pharmacy."
)

# Redact using default settings (opted_in=True)
redacted = reduct(prompt)
print("Redacted prompt:\n", redacted)

# Force opt-out (no redaction) if you need the raw prompt
raw = reduct(prompt, opted_in=False)
print("Raw prompt (opted out):\n", raw)

Notes:

  • reduct performs basic prompt validation, optionally applies a transformation step (if configured), and then redacts sensitive values. The function returns the transformed/redacted prompt as a string.
  • Check kanuni_layer_sdk/main.py and the kanuni_layer_sdk/modules package for implementation details.

Development

  • Package code lives under the kanuni_layer_sdk package. The primary entrypoint is kanuni_layer_sdk.reduct.
  • See requirements.txt for runtime dependencies.

Contributing

Issues and pull requests are welcome. Please open PRs against the repository linked above.

License

See PKG-INFO or the repository for license details.

pip install kanuni-layer-sdk

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kanuni_layer_sdk-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

kanuni_layer_sdk-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file kanuni_layer_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: kanuni_layer_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kanuni_layer_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5e4e7bb68f2398b6c671e499ad060a8410a08074def3ba24ff99fe9572adb654
MD5 79fd107ad7044cc6975676a65898e7da
BLAKE2b-256 effe584d0b69e6ca5ea13fb7e70348c4ec219b94fd2f069cbdcefc1eeac31147

See more details on using hashes here.

File details

Details for the file kanuni_layer_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kanuni_layer_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 233c7a0d3309e1807b62515439b944754d88411cd75763472ec38ebe41ee003b
MD5 6627b137f85de458114b94069115fa04
BLAKE2b-256 573f699937af53f08c3d99db18327353cdffd133c025572329951556173b97c8

See more details on using hashes here.

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