fix(anthropic): empty thinking cause content block not stop#1135
fix(anthropic): empty thinking cause content block not stop#1135looplj merged 3 commits intorelease/v0.9.xfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a specific bug in the Anthropic stream processing where an empty 'thinking' block could lead to an incorrect state, preventing other content blocks from being properly closed. The changes ensure robust handling of content block termination by explicitly closing any active blocks before introducing a synthetic thinking block, thereby improving the reliability of stream parsing and event generation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the Anthropic inbound stream transformer to correctly handle the closure of text and tool content blocks when a signature arrives without explicit thinking content. It introduces logic to enqueue content_block_stop events for any active text or tool blocks before creating a synthetic thinking block, and adds a hasToolContentStarted flag to track tool content state. New test cases validate this behavior for both text and tool content. Additionally, a new test data file gemini-thought.jsonl is added, likely supporting similar 'thinking' block or signature processing for Gemini models. There is no feedback to provide.
Uh oh!
There was an error while loading. Please reload this page.