Core API¶
BaseSignal
¶
Bases: ABC
Abstract base class for all content detection signals.
A 'Signal' is a specialized detector that analyzes content of a specific type (text, image, audio) and produces a probabilistic assessment of whether it is AI-generated.
Subclasses must implement
name: Unique string identifier.dtype: Input data type supported.run(): The core detection logic.
Source code in veridex/core/signal.py
name
abstractmethod
property
¶
Unique identifier for the signal.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A short, snake_case name (e.g., 'zlib_entropy', 'perplexity'). |
dtype
abstractmethod
property
¶
Data type this signal operates on.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
One of 'text', 'image', 'audio', 'video'. |
run(input_data)
abstractmethod
¶
Execute the detection logic on the provided input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
Any
|
The content to analyze. Type should match |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DetectionResult |
DetectionResult
|
The result containing score, confidence, and metadata. |
Source code in veridex/core/signal.py
check_dependencies()
¶
Optional hook to check if required heavy dependencies are installed.
This is called before expensive operations or at initialization time.
Raises:
| Type | Description |
|---|---|
ImportError
|
If required extra dependencies (e.g., torch, transformers) are missing. |
Source code in veridex/core/signal.py
detect(input_data)
¶
Public alias for run().
It is recommended to use this method instead of run() directly, as it may include
future pre/post-processing steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
Any
|
The content to analyze. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DetectionResult |
DetectionResult
|
The detection result. |
Source code in veridex/core/signal.py
DetectionResult
¶
Bases: BaseModel
Standardized output model for all detection signals.
This model encapsulates the result of a detection signal, providing a normalized score, a confidence level, and optional metadata or error information.
Attributes:
| Name | Type | Description |
|---|---|---|
score |
float
|
Normalized probability score indicating AI-likelihood. Range [0.0, 1.0], where 0.0 is confidently Human and 1.0 is confidently AI. |
confidence |
float
|
A measure of the reliability of the score estimation. Range [0.0, 1.0], where 1.0 means the signal is fully confident in its assessment. Confidence interpretation: - 0.0-0.3: Low confidence (heuristics, untrained models, errors) - 0.4-0.6: Moderate confidence (statistical methods, limited data) - 0.7-0.9: High confidence (trained models with good predictions) - 0.9-1.0: Very high confidence (strong model predictions, clear patterns) For model-based signals, confidence is extracted from model outputs (softmax probabilities, margins, etc.). For heuristic signals, confidence reflects empirical reliability. |
metadata |
Dict[str, Any]
|
Dictionary containing signal-specific intermediate values, features, or debug information used to derive the score. |
error |
Optional[str]
|
Error message if the signal failed to execute.
If present, |