Skip to content

v0.3.4

Choose a tag to compare

@github-actions github-actions released this 14 Nov 01:20
· 45 commits to main since this release

A new extra and fixes, and nothing that worked before stops working: a patch release, as
CONTRIBUTING.md describes. The gateway comes with pip install "polanon[gateway]"; pip install polanon alone is unchanged and still needs nothing beyond the standard library. Where detection
missed or mislabelled a value it now differs, so a text may come out with other tokens: a first
name alone gives way to the language model's place or company, and a stray word left over where
two detections overlapped stays readable.

Added

  • A masking gateway for tools that speak the OpenAI API, run by whoever needs it on their own
    machine: pip install "polanon[gateway]", then polanon-gateway --upstream https://api.openai.com/v1, and Hermes Agent, n8n, Open WebUI or LibreChat point their base URL at
    http://127.0.0.1:8787/v1. It serves /v1/chat/completions and the Responses API,
    /v1/responses, streamed or not and with tool calls, /v1/embeddings and /v1/models, and
    refuses every other endpoint, images and audio. With the Responses API the whole conversation
    comes with every call, as Hermes Agent sends it with store: false, and encrypted reasoning
    passes as it is; a call that leaves the conversation at the provider is refused. Every call
    is masked, checked once more for any original value before it leaves, and restored on the way
    back, a tool call's arguments as valid JSON. It keeps nothing on disk, listens on 127.0.0.1 and
    needs a key every client sends to listen anywhere else, takes keys from the environment only, and
    logs counts, never values. The library still imports no web framework: the gateway is a plain
    ASGI application with httpx, served by uvicorn.

  • A twelfth benchmark document, a hospital discharge summary, health data being the most
    sensitive kind (#4): a patient with her PESEL, birth date, address and phone, her daughter, two
    doctors behind their titles and the hospital's address. Every value is made up, and the patient
    was born in 1847, so her PESEL belongs to nobody. The rules alone mask all of it but its two
    places; with pl_core_news_md all 18 values are masked, and the ward's name is read as a company.
    The corpus now has 187 annotated values: 161 masked with the rules alone (86%) and 184 with the
    model (98%), with 8 over-masked spans, the ward one of them.

Fixed

  • A model's reasoning sent back with its answer is masked by MaskedTurn.mask_messages:
    OpenRouter returns the reasoning next to the answer, in reasoning and reasoning_details, and
    a client that kept the answer sent it back with the history, restored, in the clear. Now
    reasoning, reasoning_content and the text and summary of every item of reasoning_details
    are masked, and encrypted reasoning passes as it is. Found by the gateway's last check, which
    refused the call, in a test against OpenRouter.
  • A surname on the next line or in the next cell is masked without the language model:
    "z panem Janem\nKowalskim" in a hard-wrapped e-mail, "Jan;Kowalski" in a CSV export and
    "| Jan | Kowalski |" in a Markdown table kept the surname in clear (#15). On the next line it
    joins the first name; in the next cell it is masked on its own, so the row keeps its columns.
    Across a line or a cell the word must read as a surname, so "Imię: Jan\nNazwisko:", "Jan;Anna",
    "Jan;Kraków" and "Kamil\nNowak Transport" under a signature stay apart.
  • A place spelled like a first name keeps the language model's label: "Wakacje na Kubie" went
    to the model as a person, since a first name outranked the model wherever the two overlapped
    (#16). A first name alone, with no surname, initial or form of address, now scores 0.8, below
    the model's 0.85, and is still masked as a person without the model. "Asia" alone is the
    continent, as "Maja" is the month; "Asia Kowalska" and "pani Asia" stay people.
  • A piece left over from a losing detection is treated alike in every turn (#20). Masked in
    place in the first turn, it was a known value in the next, so the bare "NIP" that an address
    rule left behind went to the model as an address in every sentence. A piece with no digit of a
    type whose values always carry one, or with fewer than three letters and digits, now stays as
    written; any other piece, such as the name of a loose span around an e-mail address, is masked
    wherever it stands from the first turn on.
  • An academic title alone stays readable: the Polish model tagged the "n." of "dr n. med." as a
    person. A span the model finds made only of titles such as dr, n., med., hab., prof., mgr, inż.
    and lek. is dropped, as form labels are; "dr n. med. Ewa Zawadzka" keeps the name masked.