LangChain.js shipped @langchain/[email protected] on 2026-09-27: ports explicit prompt-cache options across Chat Completions and Responses, preserves content-block breakpoints, and maps cache-write usage to cache_creation. A same-tag fix serializes promptCacheRetention: "in-memory" as API-legal "in_memory" and unifies precedence (per-call → modelKwargs → constructor); Chat Completions no longer drops modelKwargs.

Key Takeaways

  • ✓Shipped: @langchain/[email protected] / npm 1.6.0
  • ✓Explicit prompt cache options + content-block breakpoints; cache-write → cache_creation (PR #11232)
  • ✓Fix: serialize in-memory as in_memory; precedence per-call > modelKwargs > constructor (PR #11735)
  • ✓Install: npm i @langchain/[email protected]
  • ✓Follow-on: @langchain/[email protected] bumps this dependency the same day
🔬

In-Depth Technical Analysis

Core Background & Industry Pain Points

Without explicit prompt-cache plumbing, LangChain.js apps overpay on repeated long prefixes; hyphenated in-memory retention values were rejected by the API.

Architecture Highlights & Internals

@langchain/[email protected] (PR #11232) forwards explicit cache options on Completions and Responses, keeps content-block breakpoints, and maps cache-write usage to cache_creation. PR #11735 serializes in-memory→in_memory and fixes precedence plus Chat Completions modelKwargs.

Authoritative Benchmarks & Measured Scores

No public latency/cost leaderboard in the release notes. Compare cache_creation/cache-read tokens and bills on a fixed long-prefix script before/after upgrade.

Developer Hands-on Guide

npm i @langchain/[email protected]. Pass promptCacheOptions / key / retention per the Chat OpenAI docs. Bump @langchain/xai to 1.4.15 if needed.