1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Input and output security inspection for LLM applications.
//!
//! `llm-inspect` sits between your application and a large language model and
//! answers two questions:
//!
//! 1. **Is this input safe to send?** — [`Inspector::scan`] looks for personal
//! data (PII), credentials (secrets) and prompt-injection patterns. Text is
//! normalized first (NFKC, zero-width characters removed) so that full-width
//! letters or hidden characters do not bypass the rules. [`Inspector::redact`]
//! masks what it found.
//! 2. **Is this output safe to act on?** — [`OutputValidator::validate`] checks
//! that a model response is JSON that matches a JSON Schema, that selected
//! fields only contain allow-listed values, and that no HTML slipped in.
//!
//! Rules are plain regular expressions declared in TOML, so they can be audited
//! and extended without recompiling. The bundled rule set is a starting point,
//! not a guarantee: **pattern matching cannot detect every attack or every piece
//! of personal data.** Treat it as one layer in a defense-in-depth design, next
//! to human approval, least privilege and audit logging.
//!
//! # Example
//!
//! ```
//! use llm_inspect::{Decision, Inspector};
//!
//! let inspector = Inspector::with_default_rules();
//! let report = inspector.scan("My AWS key is AKIAIOSFODNN7EXAMPLE, please deploy.");
//! assert_eq!(report.decision, Decision::Block);
//! assert_eq!(report.findings[0].rule_id, "secret.aws_access_key");
//!
//! let redacted = inspector.redact("Contact me at taro@example.com");
//! assert_eq!(redacted.text, "Contact me at [REDACTED:PII]");
//! ```
pub use Error;
pub use Inspector;
pub use ;
pub use ;
pub use ;
pub use ;