demos: add peyeeye PII redaction & rehydration filter chain#923
Open
tim-peyeeye wants to merge 1 commit intokatanemo:mainfrom
Open
demos: add peyeeye PII redaction & rehydration filter chain#923tim-peyeeye wants to merge 1 commit intokatanemo:mainfrom
tim-peyeeye wants to merge 1 commit intokatanemo:mainfrom
Conversation
Mirrors the pii_anonymizer demo: a FastAPI input/output filter pair that delegates PII detection to the Peyeeye API (https://api.peyeeye.ai). - /redact/{path:path} redacts user text in chat completions, Anthropic messages, and Responses-API request bodies. - /rehydrate/{path:path} restores placeholders in the LLM response, then best-effort deletes the stateful session. Fail-closed semantics: any unexpected response shape from /v1/redact, or a length mismatch between sent and returned text counts, raises a 502 rather than forwarding partially-redacted data. Auth errors map to 500. Stateful (default) and stateless (sealed skey_... blob) session modes are both supported via PEYEEYE_SESSION_MODE. Includes 24 pytest cases covering the round trip, length-guard, unexpected-shape guard, multimodal content lists, Anthropic and Responses formats, and stateless mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
demos/filter_chains/peyeeye/example, mirroring the existingpii_anonymizerdemo. It's a FastAPI input/output filter pair that delegates PII detection to the Peyeeye API (https://api.peyeeye.ai) and rehydrates placeholders on the response path./redact/{path:path}redacts user text across chat completions, Anthropic messages, and Responses-API request bodies./rehydrate/{path:path}restores placeholders in the LLM response and best-effort deletes the stateful session.skey_...blob) session modes viaPEYEEYE_SESSION_MODE.Fail-closed semantics
Any unexpected response shape from
/v1/redact, or a length mismatch between sent and returned text counts, raises a 502 rather than forwarding partially-redacted data. Auth errors map to 500.Tests
24 pytest cases covering the round trip, length-guard, unexpected-shape guard, multimodal content lists, Anthropic and Responses formats, and stateless mode.
pre-commit runis clean.Files
peyeeye.py— FastAPI app with the two filter routesconfig.yaml— plano filter-chain config wiring redact/rehydrateDockerfile,pyproject.toml,start_agents.sh,run_demo.sh,test.shREADME.md— setup + env-var reference (PEYEEYE_API_KEY,PEYEEYE_API_BASE,PEYEEYE_SESSION_MODE,PEYEEYE_LOCALE)test_peyeeye.py— 24 pytest cases