testing thinking

This commit is contained in:
jknapp 2025-03-16 20:01:21 -07:00
parent f0c534a093
commit 3148979440

View File

@ -179,6 +179,7 @@ class Pipeline:
print(f"{streaming_response} for {payload}") print(f"{streaming_response} for {payload}")
thinking_start = False thinking_start = False
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"]
@ -187,7 +188,7 @@ class Pipeline:
if not thinking_start: if not thinking_start:
thinking_start = True thinking_start = True
yield '<details type="reasoning" done="false">\n<summary>Thinking…</summary>\n' yield '<details type="reasoning" done="false">\n<summary>Thinking…</summary>\n'
print(f"Reasoning content: {delta['reasoningContent']}") #print(f"Reasoning content: {delta['reasoningContent']}")
yield delta["reasoningContent"]["text"] yield delta["reasoningContent"]["text"]
# Handle regular response text # Handle regular response text