petter2025 commited on
Commit
089578b
·
verified ·
1 Parent(s): f195c5e

Delete audio_detector.py

Browse files
Files changed (1) hide show
  1. audio_detector.py +0 -46
audio_detector.py DELETED
@@ -1,46 +0,0 @@
1
- """
2
- Audio quality detector for transcription confidence.
3
- """
4
-
5
- import logging
6
- from typing import Dict, Any
7
- from agentic_reliability_framework.runtime.agents.base import BaseAgent, AgentSpecialization
8
- from ai_event import AIEvent
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
- class AudioQualityDetector(BaseAgent):
13
- """
14
- Detects low‑confidence transcriptions based on average log probability.
15
- Expects `retrieval_scores[0]` to contain the average log probability.
16
- """
17
-
18
- def __init__(self):
19
- super().__init__(AgentSpecialization.DETECTIVE)
20
- self._threshold = -5.0 # average log prob threshold
21
-
22
- async def analyze(self, event: AIEvent) -> Dict[str, Any]:
23
- """
24
- Analyze audio transcription event.
25
- """
26
- avg_log_prob = event.retrieval_scores[0] if event.retrieval_scores else -10.0
27
- flags = []
28
- if avg_log_prob < self._threshold:
29
- flags.append('low_confidence')
30
-
31
- # Confidence derived from log prob (higher log prob → higher confidence)
32
- confidence = max(0, min(1.0, 1.0 + avg_log_prob / 10.0))
33
-
34
- return {
35
- 'specialization': 'audio_quality',
36
- 'confidence': confidence,
37
- 'findings': {
38
- 'flags': flags,
39
- 'avg_log_prob': avg_log_prob
40
- },
41
- 'recommendations': [
42
- 'Use clearer audio',
43
- 'Try a different model',
44
- 'Check for background noise'
45
- ] if flags else []
46
- }