mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 21:08:59 +00:00
fix
This commit is contained in:
parent
8da2bec1c3
commit
72bb858eec
@ -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
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user