@@ -1260,9 +1260,9 @@ async def _process_harmony_streaming_events(
12601260 _increment_sequence_number_and_return : Callable [[BaseModel ],
12611261 BaseModel ],
12621262 ) -> AsyncGenerator [BaseModel , None ]:
1263- current_content_index = 0 # FIXME: this number is never changed
1263+ current_content_index = - 1
12641264 current_output_index = 0
1265- current_item_id = "" # FIXME: this number is never changed
1265+ current_item_id : str = ""
12661266 sent_output_item_added = False
12671267
12681268 async for ctx in result_generator :
@@ -1353,6 +1353,7 @@ async def _process_harmony_streaming_events(
13531353 and ctx .parser .current_recipient is None ):
13541354 if not sent_output_item_added :
13551355 sent_output_item_added = True
1356+ current_item_id = f"msg_{ random_uuid ()} "
13561357 yield _increment_sequence_number_and_return (
13571358 openai_responses_types .
13581359 ResponseOutputItemAddedEvent (
@@ -1368,6 +1369,7 @@ async def _process_harmony_streaming_events(
13681369 status = "in_progress" ,
13691370 ),
13701371 ))
1372+ current_content_index += 1
13711373 yield _increment_sequence_number_and_return (
13721374 openai_responses_types .
13731375 ResponseContentPartAddedEvent (
@@ -1398,6 +1400,7 @@ async def _process_harmony_streaming_events(
13981400 and ctx .parser .current_recipient is None ):
13991401 if not sent_output_item_added :
14001402 sent_output_item_added = True
1403+ current_item_id = f"msg_{ random_uuid ()} "
14011404 yield _increment_sequence_number_and_return (
14021405 openai_responses_types .
14031406 ResponseOutputItemAddedEvent (
@@ -1412,6 +1415,7 @@ async def _process_harmony_streaming_events(
14121415 status = "in_progress" ,
14131416 ),
14141417 ))
1418+ current_content_index += 1
14151419 yield _increment_sequence_number_and_return (
14161420 openai_responses_types .
14171421 ResponseContentPartAddedEvent (
@@ -1444,6 +1448,7 @@ async def _process_harmony_streaming_events(
14441448 ) and ctx .parser .current_recipient == "python" :
14451449 if not sent_output_item_added :
14461450 sent_output_item_added = True
1451+ current_item_id = f"tool_{ random_uuid ()} "
14471452 yield _increment_sequence_number_and_return (
14481453 openai_responses_types .
14491454 ResponseOutputItemAddedEvent (
@@ -1516,6 +1521,7 @@ async def _process_harmony_streaming_events(
15161521 raise ValueError (
15171522 f"Unknown function name: { function_name } " )
15181523
1524+ current_item_id = f"tool_{ random_uuid ()} "
15191525 yield _increment_sequence_number_and_return (
15201526 openai_responses_types .ResponseOutputItemAddedEvent (
15211527 type = "response.output_item.added" ,
0 commit comments