| """
|
| Application constants for VoiceAuth API.
|
|
|
| Defines constant values used throughout the application.
|
| """
|
|
|
|
|
|
|
|
|
|
|
|
|
| TARGET_SAMPLE_RATE: int = 16000
|
|
|
|
|
| AUDIO_CHANNELS: int = 1
|
|
|
|
|
| AUDIO_BIT_DEPTH: int = 16
|
|
|
|
|
| SUPPORTED_AUDIO_MIME_TYPES: set[str] = {
|
| "audio/mpeg",
|
| "audio/mp3",
|
| "audio/x-mpeg",
|
| }
|
|
|
|
|
| MP3_MAGIC_BYTES: tuple[bytes, ...] = (
|
| b"ID3",
|
| b"\xff\xfb",
|
| b"\xff\xfa",
|
| b"\xff\xf3",
|
| b"\xff\xf2",
|
| )
|
|
|
|
|
|
|
|
|
|
|
|
|
| LABEL_TO_ID: dict[str, int] = {
|
| "HUMAN": 0,
|
| "AI_GENERATED": 1,
|
| }
|
|
|
| ID_TO_LABEL: dict[int, str] = {
|
| 0: "HUMAN",
|
| 1: "AI_GENERATED",
|
| }
|
|
|
|
|
| CONFIDENCE_THRESHOLD_HIGH: float = 0.85
|
| CONFIDENCE_THRESHOLD_MEDIUM: float = 0.65
|
| CONFIDENCE_THRESHOLD_LOW: float = 0.50
|
|
|
|
|
|
|
|
|
|
|
|
|
| AI_INDICATORS: list[str] = [
|
| "unnatural pitch consistency",
|
| "robotic speech patterns",
|
| "synthetic formant transitions",
|
| "irregular breathing patterns",
|
| "mechanical prosody",
|
| "uniform spectral distribution",
|
| "absence of micro-variations",
|
| "artificial voice modulation",
|
| "synthetic vibrato patterns",
|
| "digital compression artifacts",
|
| ]
|
|
|
|
|
| HUMAN_INDICATORS: list[str] = [
|
| "natural speech variations",
|
| "authentic prosody",
|
| "organic voice characteristics",
|
| "natural breathing patterns",
|
| "dynamic pitch modulation",
|
| "genuine emotional inflections",
|
| "natural micro-pauses",
|
| "authentic formant patterns",
|
| "organic vibrato characteristics",
|
| "natural voice timbre",
|
| ]
|
|
|
|
|
| CONFIDENCE_DESCRIPTORS: dict[str, str] = {
|
| "very_high": "Strong evidence of",
|
| "high": "Clear indicators of",
|
| "medium": "Likely signs of",
|
| "low": "Possible characteristics of",
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
| REQUEST_ID_HEADER: str = "X-Request-ID"
|
|
|
|
|
| RATE_LIMIT_LIMIT_HEADER: str = "X-RateLimit-Limit"
|
| RATE_LIMIT_REMAINING_HEADER: str = "X-RateLimit-Remaining"
|
| RATE_LIMIT_RESET_HEADER: str = "X-RateLimit-Reset"
|
|
|
|
|
| API_KEY_PREFIX: str = "sk_"
|
|
|