This commit is contained in:
Chester Curme 2025-07-10 18:18:53 -04:00
parent 8da2bec1c3
commit 72bb858eec
2 changed files with 5 additions and 4 deletions

View File

@ -485,12 +485,13 @@ def _implode_reasoning_blocks(blocks: list[dict[str, Any]]) -> Iterable[dict[str
while i < n:
block = blocks[i]
# Ordinary block just yield a shallow copy
if block.get("type") != "reasoning":
# Skip non-reasoning blocks or blocks already in Responses format
if block.get("type") != "reasoning" or "summary" in block:
yield dict(block)
i += 1
continue
elif "reasoning" not in block:
elif "reasoning" not in block and "summary" not in block:
# {"type": "reasoning", "id": "rs_..."}
yield {**block, "summary": []}
i += 1
continue

View File

@ -2563,7 +2563,7 @@ def test_convert_to_v1_from_chat_completions(
),
AIMessage(
[
{"type": "reasoning", "id": "abc123"},
{"type": "reasoning", "id": "abc123", "summary": []},
{
"type": "reasoning",
"id": "abc234",