pub struct RAGInjectionGuard { /* private fields */ }Expand description
Guard for detecting hidden instructions in RAG-retrieved documents.
Scans document content for patterns that indicate indirect prompt injection attacks embedded in retrieved context. Pure regex/pattern-based detection.
Requires Professional license.
Implementations§
Source§impl RAGInjectionGuard
impl RAGInjectionGuard
Sourcepub fn new(name: impl Into<String>) -> Result<Self, LicenseError>
pub fn new(name: impl Into<String>) -> Result<Self, LicenseError>
Create a new RAG injection guard with default configuration.
§License Requirement
RAGInjectionGuard requires a Professional or Enterprise license. Returns an error if the license requirement is not met.
Sourcepub fn new_with_license(
name: impl Into<String>,
license: &LicenseInfo,
) -> Result<Self, LicenseError>
pub fn new_with_license( name: impl Into<String>, license: &LicenseInfo, ) -> Result<Self, LicenseError>
Create a new RAG injection guard with a pre-validated license.
Avoids re-checking the global validator when the caller already holds
validated LicenseInfo.
Sourcepub fn with_config(
name: impl Into<String>,
config: RAGInjectionConfig,
) -> Result<Self, LicenseError>
pub fn with_config( name: impl Into<String>, config: RAGInjectionConfig, ) -> Result<Self, LicenseError>
Create with custom configuration and license validation.
Returns an error if the license tier is below Professional.
Sourcepub fn with_config_with_license(
name: impl Into<String>,
config: RAGInjectionConfig,
license: &LicenseInfo,
) -> Result<Self, LicenseError>
pub fn with_config_with_license( name: impl Into<String>, config: RAGInjectionConfig, license: &LicenseInfo, ) -> Result<Self, LicenseError>
Create with custom configuration and a pre-validated license.
Sourcepub fn with_action(self, action: GuardAction) -> Self
pub fn with_action(self, action: GuardAction) -> Self
Set the action taken when an injection is detected.
Sourcepub fn with_scan_decoded_base64(self, enabled: bool) -> Self
pub fn with_scan_decoded_base64(self, enabled: bool) -> Self
Set whether to scan decoded base64 content.