-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
AssertionError in turn_detector: “end_of_utterance prediction should always return a result”
Description
When running the LiveKit Agents voice bot inside Docker (GCP VM), the turn detector fails as soon as the user speaks after the bot’s first speech. The MultilingualModel().predict_end_of_turn
method returns None
, triggering an assertion error.
Steps to Reproduce
- Clone the repository and place the provided
Dockerfile
,docker-compose.yml
,requirements.txt
, and code snippet (below) into the project root. - Build and start the container:
docker-compose up --build
- Wait for the bot to initialize and deliver its first speech.
- Speak to the bot (first or subsequent utterances).
- Observe the following error in logs: AssertionError: end_of_utterance prediction should always return a result
Code Snippet (AgentSession Configuration)
from livekit.agents import AgentSession
from livekit.plugins.turn_detector.multilingual import MultilingualModel
# ...
session = AgentSession(
stt=stt,
llm=llm,
tts=tts,
vad=silero.VAD.load(),
turn_detection=MultilingualModel(),
allow_interruptions=True,
min_interruption_duration=1,
min_interruption_words=3
)
Relevant Log Excerpt
{"message": "Error in _bounce_eou_task", "level": "ERROR", "name": "livekit.agents", "pid": 25, "job_id": "AJ_mKhPTx564xvC", "timestamp": "2025-05-31T20:24:58.014345+00:00"}
Traceback (most recent call last):
File ".../livekit/agents/voice/audio_recognition.py", line 321, in _bounce_eou_task
end_of_turn_probability = await turn_detector.predict_end_of_turn(chat_ctx)
File ".../livekit/plugins/turn_detector/base.py", line 205, in predict_end_of_turn
assert result is not None, "end_of_utterance prediction should always returns a result"
AssertionError: end_of_utterance prediction should always returns a result
Environment
- GCP VM: e2-small (2 vCPUs, 2 GB RAM) on Intel Broadwell (x86_64)
- Dockerfile (Python 3.11.6-slim):
ARG PYTHON_VERSION=3.11.6
FROM python:${PYTHON_VERSION}-slim
ENV PYTHONUNBUFFERED=1
ARG UID=10001
RUN adduser --disabled-password --gecos "" --home "/home/appuser" --shell "/sbin/nologin" --uid "${UID}" appuser
RUN apt-get update && apt-get install -y gcc python3-dev && rm -rf /var/lib/apt/lists/*
USER appuser
RUN mkdir -p /home/appuser/.cache && chown -R appuser /home/appuser/.cache
WORKDIR /home/appuser
COPY requirements.txt .
RUN python -m pip install --user --no-cache-dir -r requirements.txt
COPY . .
RUN python main.py download-files
EXPOSE 8081
CMD ["python", "main.py", "start"]
docker-compose.yml
services:
lk-agent:
build: .
ports:
- "8081:8081"
env_file:
- .env
command: ["python", "main.py", "start"]
requirements.txt
livekit==1.0.8
livekit-agents==1.0.23
livekit-plugins-turn-detector==1.0.23
silero==1.0.23
# …other dependencies as listed
Expected Behavior
The turn detector should always return a valid probability/result when the user speaks, allowing uninterrupted conversation flow
Actual Behavior
MultilingualModel().predict_end_of_turn returns None, causing an AssertionError and halting the voice bot’s processing
Additional Context
- The error does not occur before the bot’s first speech.
- It happens immediately when the user attempts to speak (“end_of_turn” logic never yields a non-None result).
- Disabling turn detection allows the session to continue without crashing.
DollarAkshay, oozzal and KevinCharger
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working