open-guardrail-guards
v1.6.2
Published
38 built-in guards for LLM safety: PII, prompt injection, toxicity, bias, API key detection, encoding attack, Korean ISMS-P/PIPA, EU AI Act
Maintainers
Readme
open-guardrail-guards
30 built-in guards for open-guardrail — the open-source guardrail engine for LLM applications.
Install
npm install open-guardrail-guards open-guardrail-coreOr use the all-in-one package: npm install open-guardrail
Guards (30)
Security
promptInjection— Detect jailbreak and prompt injection attemptsregex— Custom pattern matching (ReDoS safe)keyword— Deny/allow keyword lists
Privacy
pii— Detect and mask PII (email, phone, card, SSN)
Content
toxicity— Profanity, hate speech, threats, harassmenttopicDeny/topicAllow— Topic controlbias— Gender, racial, religious, age bias detectionlanguage— Restrict to allowed languages
Format
wordCount— Min/max word/character limitsschemaGuard— JSON schema output validation
AI Delegation
llmJudge— Delegate judgment to external LLMhallucination— Fact-check via LLMrelevance/groundedness— RAG verification via LLM
Operational
costGuard— Token usage and cost limitsrateLimit— Per-key request rate limitingdataLeakage— System prompt leak detectionsentiment— Emotional tone control
Agent Safety
toolCallValidator— Tool call argument validation (email, uuid, SQL injection)codeSafety— Dangerous code pattern detection (eval, exec, rm -rf)
Advanced
copyright— Copyright notices, trademarks, verbatim reproductionwatermarkDetect— AI-generated text detectionmultiTurnContext— Multi-turn manipulation detection
Korea / ISMS-P / PIPA
piiKr— Korean PII (주민등록번호, 여권, 면허, 사업자등록번호)profanityKr— Korean profanity (초성, 변형 포함)residentId— Resident ID checksum + maskingcreditInfo— Financial info protectionismsP/pipa— Korean compliance presets
Usage
import { promptInjection, pii, keyword } from 'open-guardrail-guards';
import { pipe } from 'open-guardrail-core';
const result = await pipe(
promptInjection({ action: 'block' }),
pii({ entities: ['email'], action: 'mask' }),
keyword({ denied: ['hack'], action: 'block' }),
).run('user input');License
MIT
