Skip to content

fix: correct Amazon Comprehend PII masking docs [closes DOC-1120] - #4006

Merged
Lauren Hirata Singh (lnhsingh) merged 2 commits into
mainfrom
open-swe/doc-1120-comprehend-pii
Aug 25, 2026
Merged

fix: correct Amazon Comprehend PII masking docs [closes DOC-1120]#4006
Lauren Hirata Singh (lnhsingh) merged 2 commits into
mainfrom
open-swe/doc-1120-comprehend-pii

Conversation

@open-swe

@open-swe open-swe Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

The Amazon Comprehend section of /langsmith/mask-inputs-outputs referenced comprehend.batch_detect_pii_entities, which does not exist in boto3 (and the linked AWS reference page was API_BatchDetectEntities, a generic-entity API, not a PII API). The per-run comprehend_anonymize example also only inspected data['messages'] or data['choices'][0]['message'], so PII slipped through for any run whose payload didn't match that exact shape (tool calls, retrievers, custom run types, etc.).

This PR rewrites both examples to recurse over the full payload and call the real detect_pii_entities API (with a per-flush dedupe cache in the batch example), adds a Warning callout explaining the lack of a Comprehend batch PII endpoint, and adds a short example showing how to wire Comprehend into create_anonymizer for use with LangChain agent middleware.

Release Note

none

Test Plan

  • Manually verify the rendered Amazon Comprehend section on a Mintlify preview build

Opened collaboratively by Kathryn May and open-swe.

- Replace fictitious comprehend.batch_detect_pii_entities with a recursive
  walk that calls the real detect_pii_entities API. AWS Comprehend does
  not expose a batch PII endpoint; batch_detect_entities returns generic
  entities (not PII).
- Recurse over the full input/output payload so PII is scrubbed across
  spans of every shape, not just chat-completion shaped ones.
- Add a Warning callout documenting the lack of a batch PII API and
  pointing to start_pii_entities_detection_job for true bulk workloads.
- Add a short section showing how to plug Comprehend into the existing
  create_anonymizer helper for use with langchain agent middleware.

Co-authored-by: Kathryn May <44557882+katmayb@users.noreply.github.com>
@github-actions github-actions Bot added langsmith For docs changes to LangSmith internal labels May 14, 2026
@lnhsingh

Copy link
Copy Markdown
Collaborator

Copilot resolve the merge conflicts in this pull request

Co-authored-by: lnhsingh <15386648+lnhsingh@users.noreply.github.com>

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved the merge conflict and merged main into this branch in commit 989b41f.

@github-actions

Copy link
Copy Markdown
Contributor

Mintlify preview branch generated: preview-opensw-1787674483-6bd21af

Site preview: https://langchain-5e9cc07a-preview-opensw-1787674483-6bd21af.mintlify.site

Important

Preview links may take a few minutes to start working while the deployment finishes.

Changed documentation pages (preview deep links):

@lnhsingh
Lauren Hirata Singh (lnhsingh) merged commit c2ca117 into main Aug 25, 2026
27 checks passed
@lnhsingh
Lauren Hirata Singh (lnhsingh) deleted the open-swe/doc-1120-comprehend-pii branch August 25, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal langsmith For docs changes to LangSmith

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants