Skip to content

aws: Bedrock LLM logs a WARNING "unknown chunk type" for every reasoning delta (seen with OpenAI GPT-6, gpt-oss, Claude thinking) #7415

Description

@kimnamu

Bug Description

Thanks for the Bedrock plugin. While testing OpenAI GPT-6 on Bedrock through aws.LLM, everything worked apart from a warning that shows up on most turns.

ConverseStream sends reasoning as contentBlockDelta.delta.reasoningContent: redactedContent bytes for GPT-6, text/signature for gpt-oss and Claude extended thinking. LLMStream._parse_chunk only handles toolUse and text deltas (llm.py L360-L368). Every reasoning delta falls into the else branch and logs WARNING aws bedrock llm: unknown chunk type, with the raw chunk in lk.pii.chunk. The response text is still correct.

model, us-east-1, one 250-word answer "unknown chunk type" warnings on main
us.openai.gpt-6-luna, default effort 1
us.openai.gpt-6-luna, reasoning.effort=high 2
us.openai.gpt-6-sol, default / high 0 / 1
openai.gpt-oss-120b-1:0 1
us.anthropic.claude-sonnet-4-6 with thinking enabled 3 (2 text, 1 signature)

GPT-6 Luna hits this at default settings: 6 of 6 short prompts at default effort logged it (Sol: 1 of 6).

Expected Behavior

Reasoning deltas are skipped quietly, the way the anthropic plugin skips thinking deltas (anthropic/llm.py L367-L388). The warning stays for delta types that really are unknown.

Reproduction Steps

cat > repro.py <<'PY'
import asyncio, logging
from livekit.agents.llm import ChatContext
from livekit.plugins import aws

logging.basicConfig(level=logging.WARNING)

async def main():
    ctx = ChatContext()
    ctx.add_message(role="user", content="Write about 250 words explaining how a hash map works.")
    await aws.LLM(model="us.openai.gpt-6-luna").chat(chat_ctx=ctx).collect()

asyncio.run(main())
PY
uv run python repro.py
WARNING:livekit.plugins.aws:aws bedrock llm: unknown chunk type

Operating System

macOS 26 (not OS-specific)

Models Used

AWS Bedrock us.openai.gpt-6-luna, us.openai.gpt-6-sol, openai.gpt-oss-120b-1:0, us.anthropic.claude-sonnet-4-6 via aws.LLM

Package Versions

livekit-agents==1.8.2
livekit-plugins-aws==1.8.2   # main at b4df92e
aiobotocore==3.8.0
botocore==1.43.46
python==3.13

Session/Room/Call IDs

N/A, reproduces with aws.LLM alone.

Proposed Solution

            elif "text" in delta:
                ...
            elif "reasoningContent" in delta:
                # Reasoning deltas (text/signature, or the redactedContent OpenAI GPT-6
                # streams) are not surfaced; skip them quietly, as the anthropic plugin
                # does for thinking deltas.
                pass
            else:
                logger.warning("aws bedrock llm: unknown chunk type", extra={"lk.pii.chunk": chunk})

I have this with a hermetic test and can open a PR.

Additional Context

Delta shape

ReasoningContentBlockDelta in the botocore bedrock-runtime model has text, redactedContent and signature. The chunk GPT-6 Luna logged:

{'contentBlockDelta': {'delta': {'reasoningContent': {'redactedContent': b'rsn_rru6BQHg...'}}, 'contentBlockIndex': 0}}

The count per answer varies from run to run; it always equals the number of reasoning deltas in the stream.

Surfacing reasoning as its own stream would be a feature, not this fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions