diff --git a/src/agents/models/chatcmpl_stream_handler.py b/src/agents/models/chatcmpl_stream_handler.py index 5faf06c14..31d015a76 100644 --- a/src/agents/models/chatcmpl_stream_handler.py +++ b/src/agents/models/chatcmpl_stream_handler.py @@ -309,12 +309,10 @@ async def handle_stream( yield ResponseContentPartAddedEvent( content_index=state.refusal_content_index_and_output[0], item_id=FAKE_RESPONSES_ID, - output_index=state.reasoning_content_index_and_output - is not None, # fixed 0 -> 0 or 1 - part=ResponseOutputText( - text="", - type="output_text", - annotations=[], + output_index=(1 if state.reasoning_content_index_and_output else 0), + part=ResponseOutputRefusal( + refusal="", + type="refusal", ), type="response.content_part.added", sequence_number=sequence_number.get_and_increment(),