veil.config¶
- class veil.config.ApiServerConfig(host: str = '0.0.0.0', port: int = 8000, reload: bool = False)[source]¶
Bases:
object- Parameters:
host (str)
port (int)
reload (bool)
- host: str = '0.0.0.0'¶
- port: int = 8000¶
- reload: bool = False¶
- class veil.config.BaseEntityDetectorConfig(priority=<factory>, hierarchy_position=0)[source]¶
Bases:
BasePolyConfigMarker base for entity detector configuration objects.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
- hierarchy_position: int = 0¶
- priority: Dict[str, int]¶
- class veil.config.BaseEntityResolverConfig[source]¶
Bases:
BasePolyConfigMarker base for entity resolver configuration objects.
- class veil.config.DataHandlerConfig(input_path=None, output_path=None, text_field='text', ground_truth_field=None, doc_id_field=None, text_encoding='utf-8')[source]¶
Bases:
objectConfiguration for input/output data handling.
- Parameters:
input_path (str)
output_path (str)
text_field (str)
ground_truth_field (str | None)
doc_id_field (str | None)
text_encoding (str)
- doc_id_field: str | None = None¶
- ground_truth_field: str | None = None¶
- input_path: str = None¶
- output_path: str = None¶
- text_encoding: str = 'utf-8'¶
- text_field: str = 'text'¶
- class veil.config.EmbeddingsEntityResolverConfig(threshold=0.82, context_chars=0)[source]¶
Bases:
BaseEntityResolverConfigConfiguration for an embeddings-based entity resolver.
For v1 we keep options minimal and local-only.
- Parameters:
threshold (float)
context_chars (int)
- context_chars: int = 0¶
- threshold: float = 0.82¶
- class veil.config.EvaluatorConfig(enabled=True, strict_type=True, report_exact=True, report_exact_by_id=True, report_iou_thresholds=<factory>, use_hungarian_id_mapping=False)[source]¶
Bases:
objectConfiguration for the evaluator.
- Parameters:
enabled (bool)
strict_type (bool)
report_exact (bool)
report_exact_by_id (bool)
report_iou_thresholds (List[float])
use_hungarian_id_mapping (bool)
- enabled: bool = True¶
- report_exact: bool = True¶
- report_exact_by_id: bool = True¶
- report_iou_thresholds: List[float]¶
- strict_type: bool = True¶
- use_hungarian_id_mapping: bool = False¶
- class veil.config.GlinerEntityDetectorConfig(priority=<factory>, hierarchy_position=0, labels=<factory>, model='urchade/gliner_multi-v2.1', cuda_device=0, threshold=0.6, batch_size=8, max_length=384, chunk_overlap=50, nms_iou_threshold=0.8, min_span_chars=3, max_span_chars=80, top_k_per_chunk=100)[source]¶
Bases:
BaseEntityDetectorConfigConfiguration for the Gliner entity detector integration.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
labels (List[str])
model (str)
cuda_device (int)
threshold (float)
batch_size (int)
max_length (int)
chunk_overlap (int)
nms_iou_threshold (float)
min_span_chars (int)
max_span_chars (int)
top_k_per_chunk (int)
- batch_size: int = 8¶
- chunk_overlap: int = 50¶
- cuda_device: int = 0¶
- labels: List[str]¶
- max_length: int = 384¶
- max_span_chars: int = 80¶
- min_span_chars: int = 3¶
- model: str = 'urchade/gliner_multi-v2.1'¶
- nms_iou_threshold: float = 0.8¶
- priority: Dict[str, int]¶
- threshold: float = 0.6¶
- top_k_per_chunk: int = 100¶
- class veil.config.HostedMaskerApiEntityDetectorConfig(priority=<factory>, hierarchy_position=0, api_url='', headers=<factory>, model='', system_prompt='You are a helpful assistant that masks sensitive information.', max_tokens=4000, top_p=1, top_k=40, presence_penalty=0, frequency_penalty=0, temperature=0.6, timeout=30, retries=2, retry_backoff_base=0.5, retry_on_truncation=True, chunk_on_truncation=True, chunk_char_limit=4000, truncation_min_fraction=0.6)[source]¶
Bases:
MaskerApiEntityDetectorConfigConfiguration for the hosted Masker API entity detector integration.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
api_url (str)
headers (Dict[str, str])
model (str)
system_prompt (str)
max_tokens (int)
top_p (float)
top_k (int)
presence_penalty (float)
frequency_penalty (float)
temperature (float)
timeout (float)
retries (int)
retry_backoff_base (float)
retry_on_truncation (bool)
chunk_on_truncation (bool)
chunk_char_limit (int)
truncation_min_fraction (float)
- class veil.config.MaskerApiEntityDetectorConfig(priority=<factory>, hierarchy_position=0, api_url='', headers=<factory>, model='', system_prompt='You are a helpful assistant that masks sensitive information.', max_tokens=4000, top_p=1, top_k=40, presence_penalty=0, frequency_penalty=0, temperature=0.6, timeout=30, retries=2, retry_backoff_base=0.5, retry_on_truncation=True, chunk_on_truncation=True, chunk_char_limit=4000, truncation_min_fraction=0.6)[source]¶
Bases:
BaseEntityDetectorConfigMarker base for masking-API entity detector configuration objects.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
api_url (str)
headers (Dict[str, str])
model (str)
system_prompt (str)
max_tokens (int)
top_p (float)
top_k (int)
presence_penalty (float)
frequency_penalty (float)
temperature (float)
timeout (float)
retries (int)
retry_backoff_base (float)
retry_on_truncation (bool)
chunk_on_truncation (bool)
chunk_char_limit (int)
truncation_min_fraction (float)
- api_url: str = ''¶
- chunk_char_limit: int = 4000¶
- chunk_on_truncation: bool = True¶
- frequency_penalty: float = 0¶
- headers: Dict[str, str]¶
- max_tokens: int = 4000¶
- model: str = ''¶
- presence_penalty: float = 0¶
- priority: Dict[str, int]¶
- retries: int = 2¶
- retry_backoff_base: float = 0.5¶
- retry_on_truncation: bool = True¶
- system_prompt: str = 'You are a helpful assistant that masks sensitive information.'¶
- temperature: float = 0.6¶
- timeout: float = 30¶
- top_k: int = 40¶
- top_p: float = 1¶
- truncation_min_fraction: float = 0.6¶
- class veil.config.MaskerConfig(method='ENTITY_TAG')[source]¶
Bases:
objectConfiguration for the masker.
- Parameters:
method (str)
- method: str = 'ENTITY_TAG'¶
- class veil.config.MetricStoreConfig(enabled: bool = False, output_dir: str = 'veil_runs', save_config_json: bool = True)[source]¶
Bases:
object- Parameters:
enabled (bool)
output_dir (str)
save_config_json (bool)
- enabled: bool = False¶
- output_dir: str = 'veil_runs'¶
- save_config_json: bool = True¶
- class veil.config.OverlapResolverConfig(iou_threshold=0.75, overlap_policy='same_type_only')[source]¶
Bases:
objectConfiguration for overlap resolution between spans from different detectors.
IoU threshold controls when two spans are considered conflicting: - If IoU > threshold, they conflict and the lower-priority span is dropped. - With threshold=0.0, any real overlap is considered a conflict.
- Parameters:
iou_threshold (float)
overlap_policy (str)
- iou_threshold: float = 0.75¶
- overlap_policy: str = 'same_type_only'¶
- class veil.config.PipelineConfig(mode='offline', datahandler=None, api_server=None, entity_detectors=<factory>, entity_resolvers=None, metric_store=<factory>, masker=<factory>, overlap_resolver=<factory>, evaluator=None, concurrency=1, log_level='INFO')[source]¶
Bases:
objectRoot configuration dataclass for a Veil masking run.
- Parameters:
mode (str)
datahandler (DataHandlerConfig | None)
api_server (ApiServerConfig | None)
entity_detectors (List[BaseEntityDetectorConfig])
entity_resolvers (List[BaseEntityResolverConfig] | None)
metric_store (MetricStoreConfig)
masker (MaskerConfig)
overlap_resolver (OverlapResolverConfig)
evaluator (EvaluatorConfig | None)
concurrency (int)
log_level (str)
- api_server: ApiServerConfig | None = None¶
- concurrency: int = 1¶
- classmethod create_from_cli_args()[source]¶
Return one or many PipelineConfig instances based on CLI/YAML combos.
- datahandler: DataHandlerConfig | None = None¶
- entity_detectors: List[BaseEntityDetectorConfig]¶
- entity_resolvers: List[BaseEntityResolverConfig] | None = None¶
- evaluator: EvaluatorConfig | None = None¶
- log_level: str = 'INFO'¶
- masker: MaskerConfig¶
- metric_store: MetricStoreConfig¶
- mode: str = 'offline'¶
- overlap_resolver: OverlapResolverConfig¶
- class veil.config.RegexEntityDetectorConfig(priority=<factory>, hierarchy_position=0, enable_validation=True, min_confidence=0.0, preserve_format=True, case_sensitive=False)[source]¶
Bases:
BaseEntityDetectorConfigConfiguration wrapper for Veil’s RegexEntityDetector engine.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
enable_validation (bool)
min_confidence (float)
preserve_format (bool)
case_sensitive (bool)
- case_sensitive: bool = False¶
- enable_validation: bool = True¶
- min_confidence: float = 0.0¶
- preserve_format: bool = True¶
- priority: Dict[str, int]¶
- class veil.config.SpacyEntityDetectorConfig(priority=<factory>, hierarchy_position=0, model='es_core_news_sm', cuda_device=0)[source]¶
Bases:
BaseEntityDetectorConfigConfiguration for the Spacy entity detector integration.
- Parameters:
priority (Dict[str, int])
hierarchy_position (int)
model (str)
cuda_device (int)
- cuda_device: int = 0¶
- model: str = 'es_core_news_sm'¶
- priority: Dict[str, int]¶