- response_format is omitted by default (Infomaniak rejects the legacy
json_object → HTTP 422); opt in via the new `responseFormat` option
({type:'json_object'} or a json_schema object). BREAKING for endpoints
that relied on the forced json_object.
- parse LLM JSON leniently (tolerate markdown fences / surrounding prose)
- fold strict-coherence rules into DEFAULT_SYSTEM_PROMPT (exact
placeholder<->mapping-key identity, values are originals, strict format,
mask value not adjacent label) → reliable output across models
Verified live against Gemma 4 (google/gemma-4-31B-it, Infomaniak v2): all
demo phrases anonymize with clean round-trips, no custom provider needed.
36 tests passing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.6 KiB
3.6 KiB
Changelog
All notable changes to this project are documented here. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.3.0] - Unreleased
Changed
openAICompatibleProvidernow works with Infomaniak (and other open-model endpoints) out of the box.response_formatis omitted by default instead of hard-coding{ type: 'json_object' }, which current Infomaniak rejects (HTTP 422). Pass the newresponseFormatoption (e.g.{ type: 'json_object' }or ajson_schemaobject) for endpoints that support/require it. Breaking for endpoints that relied on the previous forcedjson_object.- JSON responses are now parsed leniently — a fenced JSON code block or surrounding prose is tolerated
(the outermost
{ … }is extracted), so models without an enforcedresponse_formatdon't cause spurious parse failures. - The default prompt gained a COHÉRENCE block (exact placeholder↔mapping-key identity, values are the
original data never another placeholder, strict
[TYPE_N…]format, mask the value not the adjacent label) to improve reliability across models.
[0.2.0] - Unreleased
Added
legendon every result — abbreviation → French meaning (PER→Personne,M→Masculin), safe to forward to a downstream LLM so it understands the placeholder tokens. Backed by a built-inDEFAULT_LEGENDso coverage is guaranteed even if the model omits entries.- The default prompt now lets the model coin new uppercase abbreviations for entities/attributes/
context it discovers and return their meanings in
legende. PatternDef.meaning— optional human label for a tag, surfaced in thelegend.presets.swiss/presets.genericship French meanings.AnonymizationError(exported) — thrown when anonymization can't complete and no fallback exists; carries the originating error in.cause.
Changed (breaking)
- Regex fallback is now opt-in.
patternsno longer defaults topresets.swiss. With no fallback, an LLM failure throwsAnonymizationError(fail-closed) and the pre-filter is bypassed. At least one ofllmorpatternsis required, or the constructor throws. AnonymizationResultgained a requiredlegendfield;LlmProvider.anonymizeBatchreturnslegend.anonymizeChunks(chunks, seed)—seedis now{ mapping, legend? }(was the bare mapping) and the return includeslegend.
[0.1.0] - Unreleased
Added
- Initial public release.
Anonymizer— pre-filter → LLM → regex fallback, bidirectional validation, deterministic coreference, and de-collision across question and retrieved chunks (anonymize,anonymizeChunks,deanonymize).makeStreamDeanonymizer— streaming-safe de-anonymization that never leaks a split placeholder.openAICompatibleProvider— pluggable LLM detection over any OpenAI-compatible Chat Completions API.presets.swissandpresets.genericregex pattern sets; fully configurable custom patterns.- Regex-only mode (no LLM provider required).
PatternDef.validate— optional second-stage predicate to cut false positives;presets.genericuses it for a Luhn check on credit-card candidates, and de-overlaps its phone/date/IP patterns.openAICompatibleProviderretries transient failures (network/timeout/429/5xx) viaretriesandretryDelayMsoptions; non-transient 4xx and malformed responses are not retried.- Hardened the
nameHintheuristic:g/yflags are stripped internally so.test()is stateless.