clever-dinner-59010
12/31/2025, 9:21 AMtall-airline-16756
12/31/2025, 9:21 AMtall-airline-16756
12/31/2025, 9:22 AMtool_choice to 'none'. That disables tool usage (function/tool calls) and prevents the model from performing tool-based reasoning steps.
Example:
from livekit.plugins import aws
session = AgentSession(
llm=aws.LLM(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
tool_choice='none' # disables tool usage / tool-based reasoning
),
)
If you need to also suppress internal "chain-of-thought" style outputs and the model supports that natively, tell me which Bedrock model you're using (e.g., Amazon Nova) and I can suggest additional parameters to adjust.
Sources: Amazon Bedrock LLM plugin guide | LiveKit docsclever-dinner-59010
12/31/2025, 9:23 AMtall-airline-16756
12/31/2025, 9:23 AMtool_choice="auto" (or "required") in the AWS LLM config to allow tool usage.
• Suppress internal reasoning by filtering LLM output:
◦ Override your agent’s llm_node (or wrap the LLM stream) to inspect streamed tokens and drop or replace any chain-of-thought/internal-reasoning fragments (e.g., thinking markers, internal tags, or patterns you observe) before forwarding to TTS or the user.
◦ Example pattern: stream chunks from self.llm.chat(...), skip chunks containing reasoning markers (or strip them), and yield only user-facing content.
Optional advanced approaches:
• Buffer the model output, run a quick filter/moderation step (a small LLM or rule-based filter) to remove reasoning text, then emit the cleaned output.
• If you’re using Nova Sonic (realtime speech-to-speech) mention that and I’ll tailor the stream handling example for realtime models.
If you want, share a short sample of the model output (the reasoning tokens you see) or confirm whether you’re using Nova Sonic or a standard Nova LLM, and I’ll provide a specific code snippet to insert into llm_node.
Sources: Amazon Nova Sonic integration guide | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | LLM-Powered Content Filter | LiveKit docs | Amazon Bedrock LLM plugin guide | LiveKit docsclever-dinner-59010
12/31/2025, 9:26 AMname_provided tool to acknowledge the name. </thinking>\n"], interrupted=False, transcript_confidence=None, hash=None, created_at=1767170010.8826632) created_at=1767170023.0970216
This is how I am seeing the outputtall-airline-16756
12/31/2025, 9:26 AMllm_node.
Options
• Stream filter (preferred): intercept the LLM output stream, drop or strip any fragments containing "<thinking>" before yielding to TTS or the user.
• Post-process buffer: collect the model response, remove reasoning blocks with a regex, then emit the cleaned text (useful if you need whole-message context).
Example: override llm_node to strip "<thinking>...</thinking>" while leaving tool usage enabled
import re
THINK_TAG_RE = re.compile(r"<thinking>.*?</thinking>", flags=re.DOTALL)
async def llm_node(self, chat_ctx, tools, model_settings=None):
async def process_stream():
async with self.llm.chat(chat_ctx=chat_ctx, tools=tools, tool_choice="auto") as stream:
async for chunk in stream:
if chunk is None:
continue
# extract text content from stream chunk (adjust per chunk shape)
content = getattr(chunk.delta, "content", None) if hasattr(chunk, "delta") else str(chunk)
if not content:
yield chunk
continue
# remove thinking blocks
cleaned = THINK_TAG_RE.sub("", content)
# skip empty results (or yield sanitized chunk)
if cleaned.strip() == "":
continue
# replace chunk content with cleaned text — adjust depending on chunk type/structure
chunk_clean = chunk # clone/modify as appropriate for your stream object
if hasattr(chunk_clean, "delta") and hasattr(chunk_clean.delta, "content"):
chunk_clean.delta.content = cleaned
else:
chunk_clean = cleaned
yield chunk_clean
return process_stream()
Notes
• Keep tool_choice="auto" (or "required") to allow tool calls.
• If your streamed chunk structure differs, adapt how you extract/replace content.
• If reasoning appears in multiple patterns (e.g., different tags or prefixes like "Thinking:"), add regex patterns for those too.
If you want, paste a raw streamed chunk object (or indicate whether you’re using Nova Sonic realtime vs standard Nova) and I’ll give the exact minimal patch you can drop into your agent.