feat(comprehend): add Amazon Comprehend PII redaction utility#611
Open
EazyHood wants to merge 1 commit into
Open
feat(comprehend): add Amazon Comprehend PII redaction utility#611EazyHood wants to merge 1 commit into
EazyHood wants to merge 1 commit into
Conversation
Adds a Comprehend class that detects PII via Amazon Comprehend (DetectPiiEntities) and returns a redacted prompt, ready to chain into existing Endpoint classes (OpenAI, GeminiAI, ...). - arakoodev/src/comprehend: Comprehend.redact() / detectPii() + static applyRedaction() with safe reverse-offset replacement - tests covering offset handling, custom masks, empty/invalid input - examples/redact-pii-with-comprehend: redaction -> OpenAI chain demo - register ./comprehend export and @aws-sdk/client-comprehend dep Closes arakoodev#290
|
CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Before we can accept your contribution, we ask that you sign the Arakoo Contributor License Agreement. You can sign the CLA by adding a new comment to this pull request and pasting exactly the following text. I have read the Arakoo CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
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.
What
Adds an Amazon Comprehend PII redaction utility to the JS SDK so sensitive
data can be stripped from a prompt before it is chained into an existing
Endpoint class (
OpenAI,GeminiAI,LlamaAI, ...).Acceptance criteria
information in prompts —
Comprehend.redact()returns a cleaned string thatfeeds straight into
OpenAI.chat({ prompt }).arakoodev/src/comprehend/src/tests/...cover offsethandling, multiple entities, custom masks, and empty/invalid input.
examples/redact-pii-with-comprehenddemonstratesthe redaction → LLM chain.
example needs live AWS + OpenAI credentials to run end-to-end. Let me know if
a video is required for sign-off and I'll attach it.
Details
arakoodev/src/comprehend/Comprehend.redact(text, { languageCode?, mask? })— detect + redactComprehend.detectPii(text, languageCode?)— rawPiiEntity[]Comprehend.applyRedaction()— pure, reverse-offset replacement so earliermasks never shift later entity offsets (unit-tested in isolation)
./comprehendsubpath export and added@aws-sdk/client-comprehendas a dependency.AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_REGIONfallbacks./claim #290
Closes #290