Orchestrates VAD→STT→LLM→TTS pipeline with barge-in, silence detection, call recording, and ntfy push notifications. The core brain of a real-time voice AI.
"""Per-call pipeline: VAD -> STT -> LLM -> TTS -> audio out.""" import asyncio import collections import logging import os import re import threading import time import wave from datetime import datetime from pathlib import Path from typing import Callable, Awaitable import numpy as np from config import Config from audio import mulaw_decode, _ULAW_TO_LIN, SileroVAD, SAMPLE_RATE_8K from stt import SpeechToText from llm import LLMClient from tts import TTS from prompts import get_greeting log = logging.getLogger(__name__) # Minimum audio duration (seconds) worth sending to STT. MIN_AUDIO_DURATION_S = 0.8 # Cooldown after TTS finishes before listening (seconds). ECHO_COOLDOWN_S = 0.5 # Tag the LLM emits to signal "hang up the call" HANGUP_TAG = "[HANGUP]" # --- Barge-in detection con ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key