Files
langchain/libs/langchain
Mason Daugherty 4717cfc83b feat(openai): support explicit prompt caching (#38762)
`ChatOpenAI` now supports OpenAI explicit prompt-cache options and
content-block breakpoints, and exposes cache-write token counts through
`input_token_details["cache_creation"]`.
[(Docs)](https://developers.openai.com/api/docs/guides/prompt-caching?prompt-cache-api=responses#prompt-cache-breakpoints)

---

OpenAI users can now configure explicit prompt caching through
`ChatOpenAI` without cache controls being dropped when messages are
converted for the Responses API.

The change preserves `prompt_cache_breakpoint` on text, image, and file
content blocks; forwards request-level cache options and legacy
retention settings; and reports `cache_write_tokens` as `cache_creation`
usage metadata, including priority and flex service-tier variants. It
also raises the minimum OpenAI SDK version to 2.45.0 so the integration
can rely on the SDK's current prompt-caching schemas instead of
compatibility normalization.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 14:11:10 -04:00
..

🦜🔗 LangChain Classic

PyPI - Version PyPI - License PyPI - Downloads Twitter

Looking for the JS/TS version? Check out LangChain.js.

To help you ship LangChain apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.

Quick Install

uv add langchain-classic

🤔 What is this?

Legacy chains, langchain-community re-exports, indexing API, deprecated functionality, and more.

In most cases, you should be using the main langchain package.

📖 Documentation

For full documentation, see the API reference. For conceptual guides, tutorials, and examples on using LangChain, see the LangChain Docs.

📕 Releases & Versioning

See our Releases and Versioning policies.

💁 Contributing

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

For detailed information on how to contribute, see the Contributing Guide.

Resources

  • LangChain Academy — comprehensive, free courses on LangChain libraries and products, made by the LangChain team
  • Code of Conduct — community guidelines and standards