Skip to content

moderation.labels() documented for Node.js but missing from @stream-io/node-sdk #323

Description

@NitinKumar77

What we're trying to do

We run user-generated text (post captions, comments, chat messages, etc.)
through moderation.check() with a custom config_key. When Stream flags
something (recommended_action: "flag"), we currently star out profanity
ourselves using a local static word list before showing it to users who've
opted into a content filter.

The problem: Stream's own classifier is clearly smarter than our word list.
For example, ffffffffucccccccccccccccccccckkkkkkkk (letters repeated to
dodge exact-match filters) gets correctly flagged by Stream as VULGARITY
via its llm provider — but our local regex-based masking can't catch it
since it's not a literal dictionary match. Stream's model clearly understood
this was profanity; we just have no way to get a masked/starred version of
that understanding back from the API. We only get labels/severity metadata,
not the masked text itself.

We looked at two paths to get Stream to hand us pre-masked text instead of
reinventing word-matching ourselves:

  1. mask_flag blocklist action — per your own docs
    (https://getstream.io/moderation/docs/node/guides/mask-sensitive-content/),
    this is explicitly "only supported for Chat Moderation." We're not using
    Stream Chat channels — we call the generic Check API directly for custom
    app content — so this isn't available to us.

  2. moderation.labels()'s documented masked_content field
    (https://getstream.io/moderation/docs/node/content-moderation/labels/) —
    this looked like exactly what we needed, but the method doesn't actually
    exist in @stream-io/node-sdk (checked our installed 0.7.51 and the
    latest published 0.7.62 — no labels method anywhere on
    ModerationApi/StreamModerationClient, confirmed by pulling the source
    directly).

##issue

typeof client.moderation.labels: undefined
typeof client.moderation.check: function
client.moderation.labels is NOT a function on the actual client instance.

Confirmed at runtime, not just by reading source — typeof client.moderation.labels returns undefined on an actual StreamClient instance.

The ask

Is there a supported way — today, or planned — to get an LLM-masked/starred
version of flagged text back from the Node SDK for non-Chat, custom
entity_type content
(i.e. through moderation.check() or an equivalent),
rather than only labels/severity/recommended_action? Since your classifier
already determines which words triggered the flag, having it return the
masked string directly would save every custom-content integration from
re-implementing (and inevitably under-covering) profanity masking on our own.

Environment

  • @stream-io/node-sdk: 0.7.51
  • Node.js: v24.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions