Skip to content

Handle missing streaming thinking signatures#181

Open
xoofx wants to merge 1 commit intoanthropics:nextfrom
xoofx:fix-streaming-thinking-signature-delta
Open

Handle missing streaming thinking signatures#181
xoofx wants to merge 1 commit intoanthropics:nextfrom
xoofx:fix-streaming-thinking-signature-delta

Conversation

@xoofx
Copy link
Copy Markdown

@xoofx xoofx commented Apr 22, 2026

Followup from #180

Summary

  • stop the Microsoft.Extensions.AI Anthropic adapters from throwing when a streaming thinking block omits the initial signature
  • read signature from raw JSON opportunistically for thinking blocks in both the standard and beta adapters
  • add regression coverage for providers that emit the signature later via signature_delta

Why

MiniMax''s Anthropic-compatible streaming API sends a thinking content block without an initial signature, then emits the signature later as a signature_delta. The current adapters access thinking.Signature eagerly, which throws before the stream can continue.

This change keeps the existing signature_delta handling, but avoids assuming the initial block always includes a signature.

Testing

  • dotnet test src/Anthropic.Tests/Anthropic.Tests.csproj -c Release --no-restore --filter "GetStreamingResponseAsync_WithThinkingBlockMissingInitialSignature_DoesNotThrow|GetStreamingResponseAsync_WithThinkingBlockInStream|GetStreamingResponseAsync_WithSignatureDeltaInStream"

@xoofx xoofx requested a review from a team as a code owner April 22, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant