testing thinking
This commit is contained in:
parent
64b2254f09
commit
391253ec2f
@ -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 '</thinking>\n\n'
|
||||
if "contentBlockDelta" in chunk:
|
||||
delta = chunk["contentBlockDelta"]["delta"]
|
||||
|
||||
@ -188,10 +191,6 @@ class Pipeline:
|
||||
yield '<thinking>\n'
|
||||
yield delta["reasoningContent"]["text"]
|
||||
|
||||
if "contentBlockStop" in chunk: # and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
|
||||
print("Thinking End")
|
||||
yield '</thinking>\n\n'
|
||||
|
||||
# Handle regular response text
|
||||
if "text" in delta:
|
||||
yield delta["text"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user