Today, we’re excited to announce the release of LangChain v0.3 for both Python and JavaScript ecosystems.
What's changed
Python
- All packages have been upgraded from Pydantic 1 to Pydantic 2 internally. Use of Pydantic 2 in user code is fully supported with all packages without the need for bridges like
langchain_core.pydantic_v1
orpydantic.v1
. - Pydantic 1 will no longer be supported as it reached its end-of-life in June 2024.
- Python 3.8 will no longer be supported as its end-of-life is October 2024.
These are the only breaking changes for the Python version.
JavaScript
- All LangChain packages now have
@langchain/core
as a peer dependency instead of a direct dependency to help avoid type errors around core version conflicts.- You will now need to explicitly install
@langchain/core
rather than relying on an internally resolved version from other packages.
- You will now need to explicitly install
- Callbacks are now backgrounded and non-blocking by default rather than blocking.
- This means that if you are using e.g. LangSmith for tracing in a serverless environment, you will need to await the callbacks to ensure they finish before your function ends.
- Removed deprecated document loader and self-query entrypoints from
langchain
in favor of entrypoints in@langchain/community
and integration packages. - Removed deprecated Google PaLM entrypoints from community in favor of entrypoints in
@langchain/google-vertexai
and@langchain/google-genai
. - Deprecated using objects with a
"type"
as aBaseMessageLike
in favor of the more OpenAI-likeMessageWithRole
What's new
We’ve made a number of improvements during the development of LangChain v0.2 that we’d like to highlight here:
- Moved more integrations from
langchain-community
to their ownlangchain-{name}
packages. This is a non-breaking change, as the legacy implementations are left inlangchain-community
and marked as deprecated. This allows us to better manage the dependencies of, test, and version these integrations. You can see all the latest integration packages in the Python API reference and JS API Reference. - Revamped integration docs and API reference. Read more here.
- Simplified tool definition and usage. Read more here.
- Added utilities for interacting with chat models: universal model constructor (python, js), utilities to trim, filter and merge messages (python, js), rate limiter (python).
- Added the ability to dispatch custom events (python, js).
How to update your code
To help you migrate to the newest version of LangChain we’ve written how-to guides for Python and JavaScript.
Documentation
LangChain documentation is versioned and documentation for previous versions will remain live at the following URLs: Python 0.1, Python 0.2, JS 0.1, JS 0.2
LangGraph
LangGraph is a library for building stateful, multi-actor applications with LLMs, used to create agent and multi-agent workflows. As of LangChain v0.2, LangGraph has been the recommended way to build agents. LangGraph comes with a pre-built LangGraph object equivalent to the LangChain AgentExecutor which makes it easy to use an out of the box agent solution. See here for documentation on how to migrate.
What’s coming
We are expecting to improve LangChain’s multi-modal capabilities during the 0.3 release, and continue our work on improving documentation and reliability of integrations.
We’d love to hear from you on GitHub on all things LangChain v0.3. And if you’re new to LangChain, follow our quickstart guide (Python, JavaScript) to get started.