red-oil-58145
12/01/2025, 10:00 AMtall-airline-16756
12/01/2025, 10:00 AMtall-airline-16756
12/01/2025, 10:00 AMon_user_turn_completed lifecycle node to fetch relevant documents (search/vector DB lookup) from the final transcript, then add that content to turn_ctx so the model sees it for generation.
Example pattern:
1. Detect end of user turn with on_user_turn_completed.
2. Call your retrieval function (vector search, DB query) using new_message.text_content().
3. Add retrieved text to the turn context:
turn_ctx.add_message(
role="assistant",
content=f"Retrieved context: {rag_content}"
)
1. Let the pipeline continue to the LLM generation step.
Notes:
• This supports low-latency real-time RAG when turn detection happens in the agent (not inside the model).
• It works with STT → LLM → TTS pipelines by acting on the final transcript before generation.
Would you like a concrete example integrating a specific vector store or guidance on turn-detection settings?
Sources: Pipeline nodes and hooks | LiveKit docs | External data and RAG | LiveKit Docs