Skip to content

Commit 0c4f2b9

Browse files
authored
fix: use ResponseOutputRefusal for refusal content part added event (#2013)
1 parent 3b9368d commit 0c4f2b9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/agents/models/chatcmpl_stream_handler.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,10 @@ async def handle_stream(
309309
yield ResponseContentPartAddedEvent(
310310
content_index=state.refusal_content_index_and_output[0],
311311
item_id=FAKE_RESPONSES_ID,
312-
output_index=state.reasoning_content_index_and_output
313-
is not None, # fixed 0 -> 0 or 1
314-
part=ResponseOutputText(
315-
text="",
316-
type="output_text",
317-
annotations=[],
312+
output_index=(1 if state.reasoning_content_index_and_output else 0),
313+
part=ResponseOutputRefusal(
314+
refusal="",
315+
type="refusal",
318316
),
319317
type="response.content_part.added",
320318
sequence_number=sequence_number.get_and_increment(),

0 commit comments

Comments
 (0)