Quick Start (5 min)¶
This guide will get you up and running with Veridex in under 5 minutes.
Installation¶
Veridex is modular. You can install the core library, or include dependencies for specific modalities (text, image, audio, video).
Core Installation¶
With Modal Dependencies¶
pip install "veridex[text]" # For advanced text signals (transformers)
pip install "veridex[image]" # For image signals (diffusers, torch)
pip install "veridex[all]" # Install everything
Text Detection Example¶
Here's how to check if a text is generated by AI using the PerplexitySignal. This signal analyzes the complexity of the text; AI models often produce "lower perplexity" (more predictable) text than humans.
from veridex.text import PerplexitySignal
# Initialize the signal
# (No arguments needed for default heuristic mode)
signal = PerplexitySignal()
# Analyze text
text = "This is a sample text to analyze. AI often writes very predictable sentences."
result = signal.detect(text)
# Print the result
print(f"AI Probability Score: {result.score:.4f}")
print(f"Confidence: {result.confidence:.4f}")
print(f"Metadata: {result.metadata}")
Image Detection Example¶
For image detection, you can use signals like DIRESignal (Diffusion Reconstruction Error) or CLIPSignal. Note that these require heavy dependencies (veridex[image]).
from veridex.image import DIRESignal
# Initialize the signal (will verify if torch/diffusers are installed)
try:
signal = DIRESignal()
# Path to an image file
image_path = "path/to/image.jpg"
result = signal.detect(image_path)
if result.error:
print(f"Error: {result.error}")
else:
print(f"AI Probability Score: {result.score:.4f}")
print(f"Confidence: {result.confidence:.4f}")
except ImportError:
print("Please install image dependencies: pip install veridex[image]")
Understanding the Result¶
All signals return a DetectionResult object with the following fields:
| Field | Type | Description |
|---|---|---|
score |
float |
Probability that the content is AI-generated. Range [0.0, 1.0]. 0.0 = Human, 1.0 = AI. |
confidence |
float |
How reliable the signal considers this specific assessment. Range [0.0, 1.0]. |
metadata |
dict |
Signal-specific metrics (e.g., perplexity values, entropy scores) for debugging or advanced logic. |
error |
str |
If present, the detection failed. Check this field before trusting the score. |
Next Steps¶
- Explore Text Signals to learn about DetectGPT, Binoculars, and more.
- Learn about Image Signals like DIRE and Frequency Analysis.
- See the API Reference for detailed documentation.