Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/agents/models/chatcmpl_stream_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ async def handle_stream(
)

if reasoning_content and state.reasoning_content_index_and_output:
# Ensure summary list has at least one element
if not state.reasoning_content_index_and_output[1].summary:
state.reasoning_content_index_and_output[1].summary = [
Summary(text="", type="summary_text")
]

yield ResponseReasoningSummaryTextDeltaEvent(
delta=reasoning_content,
item_id=FAKE_RESPONSES_ID,
Expand Down Expand Up @@ -201,7 +207,7 @@ async def handle_stream(
)

# Create a new summary with updated text
if state.reasoning_content_index_and_output[1].content is None:
if not state.reasoning_content_index_and_output[1].content:
state.reasoning_content_index_and_output[1].content = [
Content(text="", type="reasoning_text")
]
Expand Down