llm_shield_anonymize/
lib.rs1pub mod anonymizer;
4pub mod config;
5pub mod detector;
7pub mod placeholder;
8pub mod replacer;
9pub mod types;
10pub mod vault;
11
12pub use anonymizer::{Anonymizer, AnonymizeResult};
14pub use config::{AnonymizerConfig, PlaceholderFormat};
15pub use detector::EntityDetector;
16pub use placeholder::PlaceholderGenerator;
17pub use replacer::replace_entities;
18pub use types::{EntityMatch, EntityMapping, EntityType};
19
20pub type Result<T> = std::result::Result<T, AnonymizationError>;
22
23#[derive(Debug, thiserror::Error)]
25pub enum AnonymizationError {
26 #[error("Empty input text")]
27 EmptyInput,
28
29 #[error("Invalid entity range: {0}")]
30 InvalidRange(String),
31
32 #[error("Detector error: {0}")]
33 DetectorError(String),
34
35 #[error("Vault error: {0}")]
36 VaultError(String),
37
38 #[error("Session not found: {0}")]
39 SessionNotFound(String),
40
41 #[error("Placeholder generation failed: {0}")]
42 PlaceholderError(String),
43}