Files
langchain/libs/partners
Christian Bromann bfc65cc04f fix(anthropic): keep initial text on content_block_start (#38442)
## Summary
- Fix `ChatAnthropic._make_message_chunk_from_anthropic_event` dropping
the first text chunk of an assistant turn when Anthropic carries the
opening text on the `content_block_start` event rather than a following
`text_delta`. This most often hits the assistant turn right after a tool
result.
- The dropped content streams to clients but never reaches the
aggregated `AIMessage`, so anything reading message history back (e.g. a
checkpointer) sees a truncated message (`Here's the answer.` → `'s the
answer.`). Reported via Pylon 25478 (Zip), whose `<canvaspreview>`
parser broke because the dropped chunk was the opening `<can` tag.
- Add a `content_block_start` branch for `text` and `thinking` blocks:
emit non-empty start-event content on both the string
(`coerce_content_to_string=True`) and structured content paths; empty
starts still emit no chunk (preserving prior behavior) and update
`block_start_event` so following deltas resolve against the current
block.

---------

Co-authored-by: Mason Daugherty <mason@langchain.dev>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2026-06-26 17:17:00 -04:00
..
2026-06-26 02:46:31 -04:00

FAQ

Looking for an integration not listed here? Check out the integrations documentation and the note in the libs/ README about third-party maintained packages.

Integration docs

For full documentation, see the primary and API reference docs for integrations.