Skip to content

Fix AttributeError when Anthropic response leads with a thinking block - #187

Open
potsju wants to merge 1 commit into
alexzhang13:mainfrom
potsju:fix/anthropic-thinking-block-text-extraction
Open

potsju wants to merge 1 commit into
alexzhang13:mainfrom
potsju:fix/anthropic-thinking-block-text-extraction

Conversation

@potsju

@potsju potsju commented Sep 20, 2026

Copy link
Copy Markdown

AnthropicClient.completion()/acompletion() indexed response.content[0]
directly, assuming it was always the text block. When extended thinking
is enabled, Anthropic returns a ThinkingBlock first, which has no .text
attribute and crashes the call. Extract the first block with type=="text"
instead, and raise a clear error if none is present.

AnthropicClient.completion()/acompletion() indexed response.content[0]
directly, assuming it was always the text block. When extended thinking
is enabled, Anthropic returns a ThinkingBlock first, which has no .text
attribute and crashes the call. Extract the first block with type=="text"
instead, and raise a clear error if none is present.
@potsju
potsju marked this pull request as ready for review September 20, 2026 03:01

This branch has not been deployed

No deployments
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