Creates and caches regex‑based PII content inspectors for text filtering.
// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { RE2JS, RE2Set } from 're2js';
import { logger } from '@librechat/data-schemas';
import {
MAX_PII_CUSTOM_REGEX_CHARACTERS,
MAX_PII_CUSTOM_REGEX_INSTRUCTIONS,
MAX_PII_PATTERN_ID_LENGTH,
MAX_PII_PATTERN_LABEL_LENGTH,
MAX_PII_PATTERN_LENGTH,
MAX_PII_PATTERNS_PER_SOURCE,
getPiiRegexProgramSize,
} from 'librechat-data-provider';
import type {
FilterPiiCategory,
MessageFilterPiiConfig,
FilterPiiCustomPatternConfig,
} from 'librechat-data-provider';
import type { ProtectionFinding, TextContentFragment } from '../types';
interface CompiledPattern {
readonly id: string;
readonly label: string;
readonly patte
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key