fix: handle empty assistant content in Responses API (#34272) (#34296)

This commit is contained in:
Sujal M H
2026-01-08 00:51:55 +05:30
committed by GitHub
parent f10225184d
commit 7ad1c19d9c

View File

@@ -4446,7 +4446,15 @@ def _convert_responses_chunk_to_generation_chunk(
} }
) )
elif chunk.type == "response.output_text.done": elif chunk.type == "response.output_text.done":
content.append({"type": "text", "id": chunk.item_id, "index": current_index}) _advance(chunk.output_index, chunk.content_index)
content.append(
{
"type": "text",
"text": "",
"id": chunk.item_id,
"index": current_index,
}
)
elif chunk.type == "response.created": elif chunk.type == "response.created":
id = chunk.response.id id = chunk.response.id
response_metadata["id"] = chunk.response.id # Backwards compatibility response_metadata["id"] = chunk.response.id # Backwards compatibility