freezing-rocket-21802
12/23/2025, 1:01 AMtall-airline-16756
12/23/2025, 1:01 AMtall-airline-16756
12/23/2025, 1:01 AMllm_node (or insert an LLM output processing step) and strip/replace internal tags or tokens before passing text to TTS.
2. Specifically remove or replace tags like <tool_call>, the word found, or other chain-of-thought markers your model emits.
3. Test using short prompts and log the raw LLM stream to see exactly which markers to filter.
Example pattern (conceptual):
async def llm_node(self, chat_ctx, tools, model_settings=None):
async with self.llm.chat(chat_ctx=chat_ctx, tools=tools) as stream:
async for chunk in stream:
content = getattr(chunk.delta, "content", None) if hasattr(chunk, "delta") else str(chunk)
if content:
content = content.replace("<tool_call>", "").replace("found", "")
if hasattr(chunk, "delta") and hasattr(chunk.delta, "content"):
chunk.delta.content = content
yield chunk
Why this changed after upgrading
• Gemini 3 Flash (or its backend) can emit more verbose internal reasoning/tags.
• Newer LiveKit versions may stream intermediate tokens differently, exposing them unless you sanitize the stream.
Extra safeguards you can add
• Centralized content filter node that enforces patterns (regex) or runs a brief safety LLM to rephrase/remove thinking traces before TTS.
• Whitelist acceptable output formats and drop anything that looks like internal metadata.
If you’d like, tell me:
• an example raw model output you’re seeing (paste a short snippet), and
• whether your pipeline uses streaming chunks (yes/no),
and I’ll provide a specific filter snippet you can drop into your llm_node to remove those exact tokens.
Sources: Gemini Live API plugin | LiveKit docs | Google Gemini LLM | LiveKit docs | LLM Output Replacement | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | LLM-Powered Content Filter | LiveKit docsfreezing-rocket-21802
12/23/2025, 1:06 AMtall-airline-16756
12/23/2025, 1:06 AMthoughts vs `delta`/`text`) and you can check that metadata in your llm_node to drop thinking before TTS.
• If you’re using standard inference with Gemini 3 Flash (non‑Live): there isn’t a guaranteed metadata flag that marks “thinking” tokens. Distinction relies on patterns in the text stream (delimiters/tags, token strings, or token sequencing) and on filtering logic you add in llm_node.
Practical, actionable options you can implement now
1. Log raw streamed chunks to see exact markers the model emits (examples like <tool_call>, found, or explicit delimiters).
2. In llm_node, detect and drop thinking chunks by:
◦ Checking chunk fields for thoughts / part_type / role when using Gemini Live; OR
◦ Applying text-based rules for inference streams: regex to remove known tags, drop lines inside delimiters, or drop segments matching chain-of-thought patterns.
1. Add a short classifier/whitelist before TTS: reject or rephrase anything not matching your allowed output format (e.g., must start with a response sentence, or must not contain [...] or <tool_*> tags).
2. If you get intermediate token streaming, buffer until you see a finalizing marker (e.g., model sends an end-of-response event) and only forward buffered text to TTS.
If you share a short raw snippet of what you’re seeing in the stream (a few tokens/chunks that include the thinking text and the intended output), I’ll write a precise llm_node filter or regex you can drop in to remove those thinking tokens.
Sources: Gemini Live API plugin | LiveKit docsfreezing-rocket-21802
12/23/2025, 1:20 AMtall-airline-16756
12/23/2025, 1:21 AM<tool_call>, bracketed text, explicit “thinking” phrases) or run a small post-process step to enforce an allowed output format.
• Whitelist or classifier: enforce simple rules (must start with a sentence, no angle‑bracket tags, length limits) or run a short LLM/text classifier to rephrase/remove thought traces before TTS.
• Centralized llm_node processing: implement a node that inspects chunks, removes internal tags, and only yields cleaned text to the TTS node.
When Live (Gemini Live) differs
• Gemini Live provides explicit thinking metadata/events you can disable or ignore (via thinking_config) so thinking is easier to separate from output. That option is not available for typical non‑live inference.
If you want, paste a short raw snippet of the stream you’re seeing (a few tokens/chunks that include the thinking text and the intended response) and I’ll produce a precise llm_node filter or regex to remove those tokens before TTS.
Sources: LLM Output Replacement | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | Large language models (LLM) | LiveKit Docs | Pipeline nodes and hooks | LiveKit docs | Gemini Live API plugin | LiveKit docs