Tried the new amd feature, seems like the initial ...
# ask-ai
b
Tried the new amd feature, seems like the initial transcript also goes into the main stt pipeline, chaotic...
✅ 1
t
Thanks for reaching out, Jura. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I hear you: the AMD initial transcript is also being picked up by the main STT pipeline, which makes the output chaotic. This can happen when AMD runs while regular STT/audio input is still enabled. AMD routes its transcript into the LLM for classification, and if you don’t stop or pause the main STT during AMD, the same audio segment can be processed twice. Two ways to avoid this: • Best practice: run the AMD detector fully before starting the main session and keep main STT/audio input paused until AMD finishes (example flow:
detector.execute()
→ check result → start normal STT). • Alternative: if you must run both, add logic to discard or dedupe STT segments that overlap AMD timestamps (drop the initial transcript when AMD result exists). Can you tell me which integration you’re using (SDK/language) and whether you run AMD before or concurrently with your session? With that I can give concrete code patterns for pausing STT or deduping transcripts. Sources: Detect voicemail and IVR with outbound phone agents | LiveKit, with interactive elements
b
python
t
Thanks — helpful to know you’re on Python. Below are two practical approaches you can use: pause main STT while AMD runs, or dedupe overlapping transcripts. Pick one that fits your architecture. 1) Pause main STT during AMD (recommended) • Run AMD first, with audio/STT input disabled for the main pipeline. • Only start the main session/STT after AMD finishes and you’ve decided to continue. Example pattern (pseudo-Python, adapt to your SDK calls):
Copy code
# 1. Initialize detector and STT client but DO NOT start main STT stream
detector = AMDDetector(...)
main_stt = STTClient(...)

# 2. Run AMD and wait for result
amd_result = detector.execute(audio_source)  # blocks until AMD completes

# 3. Inspect AMD result (human, voicemail, IVR, unavailable)
if amd_result.is_human:
    # 4. Start main STT/audio only after AMD finishes
    main_stt.start_stream(audio_source)
else:
    # handle voicemail/IVR path without starting main STT
    handle_non_human(amd_result)
2) Dedupe overlapping transcripts (if you must run both concurrently) • Track AMD transcript timestamps and drop or ignore main-STT transcripts that overlap that time range. • Use a short grace window around AMD timestamps to account for latency. Example dedupe logic:
Copy code
amd_intervals = []  # list of (start_ms, end_ms) from AMD

# when AMD emits transcript segments:
amd_intervals.append((seg.start_ms, seg.end_ms))

# when main STT emits a transcript segment:
def is_overlapping(seg):
    for s,e in amd_intervals:
        if not (seg.end_ms < s or seg.start_ms > e):
            return True
    return False

if not is_overlapping(main_seg):
    process_main_transcript(main_seg)
else:
    # drop or mark as duplicate
    discard(main_seg)
Which approach would you like a full example for in your exact SDK (LiveKit Python client or another STT lib)? If you share the functions you call to start STT/AMD, I’ll tailor the code to your setup. , with interactive elements
b
detection_options
DetectionOptions
Override the default timing thresholds and classification prompt. Pass a dict with any of the following keys:
human_speech_threshold
(default
2.5
),
human_silence_threshold
(default
0.5
),
machine_silence_threshold
(default
1.5
),
no_speech_threshold
(default
10.0
),
timeout
(default
20.0
), or
prompt
. All thresholds are in seconds. Values not provided fall back to library defaults. explain more in detail for each params, so little detail on doc
t
Thanks — I’ll explain each
DetectionOptions
parameter in detail and give guidance on how changing them affects AMD behavior. I’m responding to your request for more detail about
human_speech_threshold
,
human_silence_threshold
,
machine_silence_threshold
,
no_speech_threshold
,
timeout
, and
prompt
. •
human_speech_threshold
(seconds) ◦ What it is: minimum continuous duration of detected human-like speech required before the detector will consider the call reached a human. ◦ Effect: Higher values require a longer uninterrupted human speech segment to classify as human (reduces false positives from short utterances); lower values make the detector quicker to mark “human” but can increase false positives from brief sounds. ◦ When to raise/lower: raise for noisy environments or if human answers typically speak longer; lower for short greetings or languages with brief responses. Default: 2.5s. •
human_silence_threshold
(seconds) ◦ What it is: allowable silence after human speech before concluding the human segment has ended (used to separate speech segments). ◦ Effect: A longer silence threshold keeps a human classification active across short pauses (prevents splitting one utterance into multiple segments); a shorter value treats pauses as end-of-speech sooner. ◦ When to adjust: increase if humans pause frequently or speak with gaps; decrease if you want faster transition detection after a pause. Default: 0.5s. •
machine_silence_threshold
(seconds) ◦ What it is: silence duration after machine/voicemail-like audio before the detector decides the machine segment ended. ◦ Effect: Longer threshold tolerates pauses inside machine/voicemail messages (prevents premature end); shorter threshold ends machine detection faster. ◦ When to change: raise for longer voicemail messages or IVR prompts with pauses; lower to speed up detection if machine audio is concise. Default: 1.5s. •
no_speech_threshold
(seconds) ◦ What it is: time of continuous near-silence (no speech) that the detector interprets as “no one answered” or the line is silent. ◦ Effect: Shorter values classify silence as no-answer sooner; longer values wait longer before deciding nothing was spoken. ◦ When to adjust: lower if you want fast failover for unanswered calls; raise if carrier delays or ringback tones may produce silence initially. Default: 10.0s. •
timeout
(seconds) ◦ What it is: the maximum total time AMD will run before giving up and returning a best-effort classification. ◦ Effect: Shorter time bounds overall AMD latency but risks inconclusive/incorrect results; longer time increases confidence at the cost of latency. ◦ When to change: shorten for low-latency flows that can tolerate some misclassifications; lengthen when accuracy is paramount. Default: 20.0s. •
prompt
(string) ◦ What it is: custom LLM prompt used to classify the AMD transcript into categories (human, voicemail, IVR, unavailable, etc.). ◦ Effect: Tailors classification rules, examples, or language handling — a more specific prompt can reduce misclassification for your call types or languages. ◦ When to customize: when default prompt misclassifies language, dialects, or particular IVR/voicemail styles; include examples or rules for edge cases. ◦ Guidance: keep prompt concise, include positive and negative examples, and mention expected labels and confidence thresholds if supported. Best-practice tips • Start with defaults, then tune one parameter at a time while testing with representative call samples. • If you see false human detections from short noises, increase
human_speech_threshold
. • If voicemails get split or mis-timed, increase
machine_silence_threshold
. • Use
timeout
to balance accuracy vs. latency for your outbound workflow. • Use
prompt
to improve classification on unusual languages/IVRs — include labeled examples. If you’d like, share a few sample call recordings or describe the typical answer behavior (short greetings, long voicemails, IVR prompts, noisy lines), and I’ll recommend concrete threshold values for Python usage. , with interactive elements