mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 09:08:54 -04:00
Address models tend to tag a postal code with high confidence but miss or under-score the town right after it. Measured with privacy-filter-multilingual on 24 synthetic German invoices: the postal code was masked every time, while the town after it stayed in the clear in 6 of 18 cases (4 not detected at all, 2 tagged CITY at 0.43/0.47, below the configured floor). Masking the code alone leaves the pair half redacted: "[REDACTED:ner:ZIPCODE] Ludwigshafen". pii_detection.extend_to_next_word lists entity groups whose accepted detections also cover the word that directly follows them on the same line, with the same action and group. Horizontal whitespace is skipped, a line break ends the search, and nothing is extended when no word follows, so a hit never grows over bare whitespace or onto the next line (or across the segment separator on the multi-message path). The option is opt-in and empty by default; existing detector configs behave exactly as before. Covered by Ginkgo specs in core/services/routing/pii/extend_test.go (fail without the change), a YAML round-trip spec, a registry entry for the model editor, and the middleware and model-configuration docs. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>