@@ -1245,9 +1245,9 @@ async def _process_harmony_streaming_events(
12451245 created_time : int ,
12461246 _send_event : Callable [[BaseModel ], str ],
12471247 ) -> AsyncGenerator [str , None ]:
1248- current_content_index = 0 # FIXME: this number is never changed
1248+ current_content_index = - 1
12491249 current_output_index = 0
1250- current_item_id = "" # FIXME: this number is never changed
1250+ current_item_id : str = ""
12511251 sent_output_item_added = False
12521252
12531253 async for ctx in result_generator :
@@ -1337,6 +1337,8 @@ async def _process_harmony_streaming_events(
13371337 and ctx .parser .current_recipient is None ):
13381338 if not sent_output_item_added :
13391339 sent_output_item_added = True
1340+ # wut
1341+ current_item_id = f"msg_{ random_uuid ()} "
13401342 yield _send_event (
13411343 openai_responses_types .
13421344 ResponseOutputItemAddedEvent (
@@ -1352,6 +1354,7 @@ async def _process_harmony_streaming_events(
13521354 status = "in_progress" ,
13531355 ),
13541356 ))
1357+ current_content_index += 1
13551358 yield _send_event (
13561359 openai_responses_types .
13571360 ResponseContentPartAddedEvent (
@@ -1382,6 +1385,7 @@ async def _process_harmony_streaming_events(
13821385 and ctx .parser .current_recipient is None ):
13831386 if not sent_output_item_added :
13841387 sent_output_item_added = True
1388+ current_item_id = f"msg_{ random_uuid ()} "
13851389 yield _send_event (
13861390 openai_responses_types .
13871391 ResponseOutputItemAddedEvent (
@@ -1396,6 +1400,7 @@ async def _process_harmony_streaming_events(
13961400 status = "in_progress" ,
13971401 ),
13981402 ))
1403+ current_content_index += 1
13991404 yield _send_event (
14001405 openai_responses_types .
14011406 ResponseContentPartAddedEvent (
@@ -1428,6 +1433,7 @@ async def _process_harmony_streaming_events(
14281433 ) and ctx .parser .current_recipient == "python" :
14291434 if not sent_output_item_added :
14301435 sent_output_item_added = True
1436+ current_item_id = f"tool_{ random_uuid ()} "
14311437 yield _send_event (
14321438 openai_responses_types .
14331439 ResponseOutputItemAddedEvent (
@@ -1498,6 +1504,7 @@ async def _process_harmony_streaming_events(
14981504 raise ValueError (
14991505 f"Unknown function name: { function_name } " )
15001506
1507+ current_item_id = f"tool_{ random_uuid ()} " ,
15011508 yield _send_event (
15021509 openai_responses_types .ResponseOutputItemAddedEvent (
15031510 type = "response.output_item.added" ,
0 commit comments