Support claude-sonnet-5 extended thinking in ChatSnowflake - #431
Draft
cpsievert wants to merge 3 commits into
Draft
Support claude-sonnet-5 extended thinking in ChatSnowflake#431cpsievert wants to merge 3 commits into
cpsievert wants to merge 3 commits into
Conversation
claude-sonnet-5 on Snowflake Cortex streams thinking/signature deltas under a new 'anthropic' delta type, which previously raised 'Unexpected streaming delta type'. Accumulate these deltas into ContentThinking (with the signature preserved in extra) for both streaming and non-streaming responses.
CI's pyright resolves pillow_heif's stubs and flags register_heif_opener as a private re-export; this failure is present on main as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-sonnet-5on Snowflake Cortex streams extended thinking as a new"anthropic"delta type — separatethinkingandsignaturefragments attached to the same content item — whichChatSnowflake()previously rejected withValueError: Unexpected streaming delta type: anthropic.This PR teaches the provider to accumulate those fragments (concatenating repeated
thinking/signaturepieces into a single item) and to surface them asContentThinking, with the signature preserved inextraso it can be round-tripped on subsequent requests. Both the streaming and non-streaming paths are handled.Verification
Adds two tests that chat and stream with
claude-sonnet-5viaChatSnowflake()and assert the final turn contains aContentThinkingblock.pytest tests/test_provider_snowflake.py— 8 passed (requires live Snowflake credentials).