langchain-ai
langchain
BlogDocsChangelog

fix(core): merge tool_call_chunks without index in streaming

#34671
Comparing
686f6c61:fix/tool-call-chunks-merge-without-index
(
b144819
) with
master
(
2847814
)
CodSpeed Performance Gauge
-4%
Untouched
13
Skipped
21

Benchmarks

Skipped (21)

Passed

test_async_callbacks_in_sync
libs/core/tests/benchmarks/test_async_callbacks.py
CodSpeed Performance Gauge
-1%
23.6 ms23.7 ms
test_import_time[ChatPromptTemplate]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
662.4 ms683.6 ms
test_import_time[Document]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
188.5 ms195.4 ms
test_import_time[BaseChatModel]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
563.2 ms584 ms
test_import_time[InMemoryVectorStore]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
618.9 ms643.2 ms
test_import_time[Runnable]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
513.3 ms533.8 ms
test_import_time[PydanticOutputParser]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
570.1 ms594 ms
test_import_time[CallbackManager]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
477.4 ms499.1 ms
test_import_time[tool]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-5%
523.8 ms549 ms
test_import_time[HumanMessage]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-5%
262.7 ms276.2 ms
test_import_time[LangChainTracer]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-5%
460.8 ms487.6 ms
test_import_time[RunnableLambda]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-6%
513.6 ms543.7 ms
test_import_time[InMemoryRateLimiter]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-6%
174.4 ms186.3 ms

Commits

Click on a commit to change the comparison range
Base
master
2847814
-4.14%
fix(core): merge tool_call_chunks without index in streaming Fixes #34654 When using agent.stream() with stream_mode=["messages"], tool_call_chunks with index=None were not merging correctly, creating multiple partial tool_calls with empty names that caused 422 errors from OpenAI API. Modified merge_lists() to handle tool_call_chunks without valid index by: - Merging chunks with same non-empty id when continuation (empty name) - Sequential merging for chunks with empty ids (streaming fragments) - Preserving existing behavior for chunks with valid index Added comprehensive unit tests covering edge cases including multiple tool calls, interleaved chunks, and sequential streaming scenarios. All existing tests pass without regression.
b144819
1 day ago
by 686f6c61
© 2026 CodSpeed Technology
Home Terms Privacy Docs