这是indexloc提供的服务,不要输入任何密码
Skip to content

AssertionError in turn_detector: “end_of_utterance prediction should always return a result” #2465

@AlejoPrietoDavalos

Description

@AlejoPrietoDavalos

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

  1. Clone the repository and place the provided Dockerfile, docker-compose.yml, requirements.txt, and code snippet (below) into the project root.
  2. Build and start the container:
    docker-compose up --build
  3. Wait for the bot to initialize and deliver its first speech.
  4. Speak to the bot (first or subsequent utterances).
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions