The
llm-guard package has a dependency on PyTorch, which may cause installation issues on Intel Mac machines. The base SDK will install and function correctly without llm-guard, with limited prompt injection scanning capabilities. When llm-guard is not available, Netra will log appropriate warnings and continue to operate with fallback behavior.Basic Usage
Common Attack Patterns Detected
The scanner detects various types of prompt injection attempts:-
Instruction Override
-
System Prompt Manipulation
-
Role Manipulation
Scan Results
The scanner returns aScanResult object with the following attributes:
Custom Models for Prompt Injection Detection
TheInputScanner supports custom models through themodel_configurationparameter, allowing you to use specialized models for Prompt Injection Detection.
Follow this configuration structure to provide your custom models.
Custom Model Example
Advanced Usage
Using the Scanner
Blocking Malicious Inputs
Example Scenarios
Integration with Chat Applications
Performance Considerations
- Latency
- The scanner is optimized for low latency
- Average scan time: < 100ms
- Resource Usage
- Minimal memory footprint
- Efficient CPU usage
Security Features
- Pattern Recognition
- Advanced pattern matching
- Context-aware detection
- Machine Learning
- ML-based detection
- Regular model updates
- Custom Rules
- Add custom detection rules
- Customize confidence thresholds