Recipes

API validation errors

from vaakly import compose, polish

compose(
    ["validation failed", "email is required", "password too short"],
    profile="api",
)

polish(
    "email is required, password too short, token expired please login again",
    profile="api",
)

Meaningful log entries

from vaakly import logify, redact

raw = "ERR timeout db=users retries=3 password=hunter2"
print(logify(redact(raw)))

ESL / product feedback

from vaakly import polish

polish(
    "Still I feel like the UX expereince is lacking. "
    "May be black color theme is not all want.",
    profile="plain",
)

Storefront JSON → prose

Vaakly formats English; it does not parse JSON. Map fields to sentences, then compose. See examplesstorefront_config.py.

from vaakly import compose

compose([
    "The business name is Example Shop.",
    "Contact phone is +1 555 010 4321.",
    "WhatsApp number is +15550104321.",
    "All listed prices include taxes.",
    "GST included in the price is 5 percent.",
], profile="api")

Lambda / container

from vaakly import Vaakly

_CLIENT = Vaakly(profile="api")

def handler(event, context):
    return {"message": _CLIENT.polish(event["text"])}

Full recipe source: documentation/recipes.md