Skip to content

Commit 206b829

Browse files
committed
add redactedContent to state only when present
1 parent 8eb5abe commit 206b829

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/strands/event_loop/streaming.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ def handle_content_block_delta(
172172
)
173173

174174
elif redacted_content := delta_content["reasoningContent"].get("redactedContent"):
175-
state.setdefault("redactedContent", b"")
176-
state["redactedContent"] += redacted_content
175+
state["redactedContent"] = state.get("redactedContent", b"") + redacted_content
177176
typed_event = RedactedContentStreamEvent(
178177
redacted_content=redacted_content, delta=delta_content, reasoning=True
179178
)
@@ -302,7 +301,6 @@ async def process_stream(chunks: AsyncIterable[StreamEvent]) -> AsyncGenerator[T
302301
"current_tool_use": {},
303302
"reasoningText": "",
304303
"citationsContent": [],
305-
"redactedContent": b"",
306304
}
307305
state["content"] = state["message"]["content"]
308306

0 commit comments

Comments
 (0)