testing thinking

This commit is contained in:
jknapp 2025-03-16 21:15:31 -07:00
parent 8824b8a591
commit 0f7c22e3aa

View File

@ -178,7 +178,6 @@ class Pipeline:
streaming_response = self.bedrock_runtime.converse_stream(**payload) streaming_response = self.bedrock_runtime.converse_stream(**payload)
thinking_block = None thinking_block = None
for chunk in streaming_response["stream"]: for chunk in streaming_response["stream"]:
print(chunk)
if "contentBlockDelta" in chunk: if "contentBlockDelta" in chunk:
delta = chunk["contentBlockDelta"]["delta"] delta = chunk["contentBlockDelta"]["delta"]
@ -189,8 +188,8 @@ class Pipeline:
yield '<thinking>\n' yield '<thinking>\n'
yield delta["reasoningContent"]["text"] yield delta["reasoningContent"]["text"]
if "contentBlockStop" in chunk: #and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block: if "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
yield '</thinking>\n\n' yield '</thinking>\n\n'
# Handle regular response text # Handle regular response text
if "text" in delta: if "text" in delta: