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.1.8.tar.gz (8.9 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.1.8-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kanuni_layer_sdk-0.1.8.tar.gz
  • Upload date:
  • Size: 8.9 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.1.8.tar.gz
Algorithm Hash digest
SHA256 102cf95e4ef16e8a2686a5153c6a7056894a100ab461b1e047470afa1aa51986
MD5 92845f2f44c361d92f7e9f1b917888b2
BLAKE2b-256 33471693aeab666d992adfb3ebcb6c06771f3a876e3dada34b744392e40a964b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kanuni_layer_sdk-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3e3297c6f7a6a0fa97a7bb74b210629969c6e626b9052b8be0c07d40bcda92
MD5 fb642bc5a61527a533cf3f56675038c7
BLAKE2b-256 b0f9366f07a5b5b4b3aae8f059f6522a6e4a13b6d975e3d4d2b28e2a83fd1bd9

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