Skip to main content

livekit-plugins-duplexjev

Audio end-of-turn detection for LiveKit Agents, powered by DuplexJev. It listens to how the user speaks, not only what they say, and tells your agent whether the user is finished, still talking, just backchanneling ("mm-hmm") or asking you to wait. The same request can also return emotion, laughter / breathing / coughs / sighs and barge-in.

  • Reads the audio, not the transcript. Every answer is one constrained token of a speech LLM: nothing is decoded, so the decision does not wait for STT.
  • Fast. Ten decisions about one utterance take 92 ms on one GPU, against 1,978 ms for ASR → LLM with the same LLM.
  • Accurate. On the CoDeTT turn-taking benchmark (English, zero-shot), DuplexJev-32B-Turn scores 70.0, against 51.4 for Smart Turn v3. See the paper.
  • More than turns, same request. Ask for emotion, non-verbal sounds or your own multiple-choice questions.
  • Chinese and English. CPU only on the agent side: the plugin calls an HTTP API.

Tested with livekit-agents 1.8.6. Maintained by Adventists.ai (AI降临派).

Install

pip install livekit-plugins-duplexjev

Use

from livekit.agents import AgentSession
from livekit.plugins import duplexjev, silero

session = AgentSession(
    stt=..., llm=..., tts=...,
    vad=silero.VAD.load(),
    turn_handling={"turn_detection": duplexjev.TurnDetector(
        api_url="http://localhost:8420",       # your own gateway; omit for the free hosted trial API
        extra_questions=["emotion", "sound"],
        on_answers=lambda a: print({k: v["answer"] for k, v in a.items()}),
    )},
)

AgentSession(turn_detection=duplexjev.TurnDetector(), ...) works too (LiveKit marks that argument as deprecated). A complete agent is in examples/agent.py.

A VAD is required. LiveKit ignores a streaming turn detector when the session has no VAD. The plugin buffers the user's audio, and after about 200 ms of VAD silence LiveKit asks it for a prediction: the last 8 s of the current user turn go to DuplexJev, and P(finished) becomes LiveKit's end_of_turn_probability. Below unlikely_threshold the session waits max_delay instead of min_delay before replying. The VAD's min_silence_duration must be at least 0.25 s (Silero's default is 0.55 s).

STT is optional for the decision. If the session has an STT, LiveKit still waits for its transcript before it commits the turn, as with any turn detector, because the LLM needs the text.

The default URL is our free trial API (rate limited to 30 requests per minute; the round trip from outside mainland China adds network latency). For a live agent, serve the model next to it (DuplexJev-4B-Para needs about 10 GB of GPU memory):

pip install "vllm[audio]>=0.29" duplexjev-vllm "duplexjev[server]>=0.4.1"
vllm serve adventists-ai/DuplexJev-4B-Para --max-model-len 4096 --port 8000 &
duplexjev gateway --vllm http://localhost:8000/v1 --port 8420

Then pass api_url="http://localhost:8420" (or set DUPLEXJEV_API_URL).

Options

argument default
api_url hosted trial API base URL of a duplexjev gateway (or DUPLEXJEV_API_URL)
api_key None bearer key, if your gateway requires one (or DUPLEXJEV_API_KEY)
lang "en" "en" or "zh": wording of the questions (the model hears both languages either way)
unlikely_threshold 0.5 below this P(finished), wait max_delay instead of min_delay
backchannel_threshold None if set, also asks "What should the assistant do now?" and reports P(short acknowledgement) as LiveKit's backchannel probability
extra_questions [] "emotion", "sound", "barge_in", or dicts {"id", "text", "options"}
on_answers None callback with every answer dict; the latest is also on detector.last_answers
window_s 8.0 seconds of the current user turn sent with each request
trim_silence True drop the silence before the user started talking (keeps 0.3 s)
prediction_timeout 4.0 hosted, 1.0 own gateway how long LiveKit waits for a prediction
fallback_probability 1.0 P(finished) reported if the gateway fails, so the conversation never blocks

License

The plugin code is BSD-2-Clause. DuplexJev model weights are CC BY-NC 4.0 (non-commercial); see the model cards. For commercial use, contact jiejin@adventists.ai.

Metadata

Release files for livekit-plugins-duplexjev 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for livekit-plugins-duplexjev 0.1.0
File Size Uploaded
livekit_plugins_duplexjev-0.1.0.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-duplexjev 0.1.0
File Interpreter ABI Platform
livekit_plugins_duplexjev-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / livekit_plugins_duplexjev-0.1.0.tar.gz

Download URL livekit_plugins_duplexjev-0.1.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6ffd582f3e79b262e12ebe37737e8ed4d5f1bfec5ce1a23ab1f2e5056e670af1
BLAKE2b-256 checksum
How to use checksums
3d554c3e818a261f3dbd0a68450113324f0cfa24e5d35920e3dd3808c4b6ac9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / livekit_plugins_duplexjev-0.1.0-py3-none-any.whl

Download URL livekit_plugins_duplexjev-0.1.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8967b18925573a941b0f81d8db02603c7044b99e1e963e3c33211513a5c012ef
BLAKE2b-256 checksum
How to use checksums
d2e25cb9f1d2f75c5ae610a08b894713df04564004b7cdb91c147d76b03ed447
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page