@andersmyrmel/vard
@andersmyrmel/vard is a TypeScript library for prompt injection detection in LLM applications. It uses a Zod-inspired chainable API: you define security requirements and validate user input, receiving strongly typed, sanitized data for use in LLM prompts. Detection is pattern-based and covers categories such as system prompt leaks, encoding attacks, and obfuscation. It offers presets (strict, moderate, lenient) with configurable thresholds, and threat actions including block, sanitize, warn, and allow.
npm / PyPI packages
Open source ↗