mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-11 05:45:01 +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:
|
while i < n:
|
||||||
block = blocks[i]
|
block = blocks[i]
|
||||||
|
|
||||||
# Ordinary block – just yield a shallow copy
|
# Skip non-reasoning blocks or blocks already in Responses format
|
||||||
if block.get("type") != "reasoning":
|
if block.get("type") != "reasoning" or "summary" in block:
|
||||||
yield dict(block)
|
yield dict(block)
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
elif "reasoning" not in block:
|
elif "reasoning" not in block and "summary" not in block:
|
||||||
|
# {"type": "reasoning", "id": "rs_..."}
|
||||||
yield {**block, "summary": []}
|
yield {**block, "summary": []}
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
@ -2563,7 +2563,7 @@ def test_convert_to_v1_from_chat_completions(
|
|||||||
),
|
),
|
||||||
AIMessage(
|
AIMessage(
|
||||||
[
|
[
|
||||||
{"type": "reasoning", "id": "abc123"},
|
{"type": "reasoning", "id": "abc123", "summary": []},
|
||||||
{
|
{
|
||||||
"type": "reasoning",
|
"type": "reasoning",
|
||||||
"id": "abc234",
|
"id": "abc234",
|
||||||
|
Loading…
Reference in New Issue
Block a user