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, …).

import { Comprehend } from "@arakoodev/edgechains.js/comprehend";
import { OpenAI } from "@arakoodev/edgechains.js/ai";

const comprehend = new Comprehend();
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const safePrompt = await comprehend.redact("My email is jane@doe.com"); // -> "My email is [EMAIL]"
const answer = await openai.chat({ prompt: safePrompt });

Acceptance criteria

  • New class chainable with the Endpoint classes to redact sensitive information in prompts — Comprehend.redact() returns a cleaned string that feeds straight into OpenAI.chat({ prompt }).
  • Test cases — arakoodev/src/comprehend/src/tests/... cover offset handling, multiple entities, custom masks, and empty/invalid input.
  • Working example — examples/redact-pii-with-comprehend demonstrates the redaction → LLM chain.
  • Demonstration video — happy to record/add one; flagging that the 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 + redact
    • Comprehend.detectPii(text, languageCode?) — raw PiiEntity[]
    • Comprehend.applyRedaction() — pure, reverse-offset replacement so earlier masks never shift later entity offsets (unit-tested in isolation)
  • Registered the ./comprehend subpath export and added @aws-sdk/client-comprehend as a dependency.
  • Credentials follow the SDK convention: constructor options with AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION fallbacks.

/claim #290

Closes #290

Claim

Total prize pool $75
Total paid $0
Status Pending
Submitted June 13, 2026
Last updated June 13, 2026

Contributors

JH

Jhonatan Del Rio Mejia

@EazyHood

100%

Sponsors

AR

Arakoo.ai

@arakoodev

$25
GI

gittare

@gittare

$50