fix: patch bug w/ extended thinking mode involving text leaking into reasoning (#4341)

* fix: patch for bad native reasoning behavior w/ sonnet

* fix: cleanup

* fix: cleanup

* fix: another prompt tune for less flaking
This commit is contained in:
Charles Packer
2025-09-01 20:26:24 -07:00
committed by GitHub
parent f3df0433ae
commit e741f84add
2 changed files with 8 additions and 0 deletions

View File

@@ -289,6 +289,13 @@ class AnthropicStreamingInterface:
if not self.anthropic_mode == EventMode.TEXT:
raise RuntimeError(f"Streaming integrity failed - received BetaTextDelta object while not in TEXT EventMode: {delta}")
# Weird bug happens with native thinking where a single response can contain:
# [reasoning, text, tool_call]
# In these cases, we should pipe text out to null / ignore it
# TODO this will have to be redone to support non-tool calling message sending
if not self.put_inner_thoughts_in_kwarg:
return
# Combine buffer with current text to handle tags split across chunks
combined_text = self.partial_tag_buffer + delta.text