From 391253ec2f81604004c8601ada0e9477dd14c1b3 Mon Sep 17 00:00:00 2001 From: jknapp Date: Sun, 16 Mar 2025 21:24:11 -0700 Subject: [PATCH] testing thinking --- claude_sonnet-3-7-bedrock.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/claude_sonnet-3-7-bedrock.py b/claude_sonnet-3-7-bedrock.py index aa38517..df481ce 100644 --- a/claude_sonnet-3-7-bedrock.py +++ b/claude_sonnet-3-7-bedrock.py @@ -178,6 +178,9 @@ class Pipeline: streaming_response = self.bedrock_runtime.converse_stream(**payload) thinking_block = None for chunk in streaming_response["stream"]: + if "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block: + print("Thinking End") + yield '\n\n' if "contentBlockDelta" in chunk: delta = chunk["contentBlockDelta"]["delta"] @@ -188,10 +191,6 @@ class Pipeline: yield '\n' yield delta["reasoningContent"]["text"] - if "contentBlockStop" in chunk: # and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block: - print("Thinking End") - yield '\n\n' - # Handle regular response text if "text" in delta: yield delta["text"]