LangChain Classic is a legacy Python package providing the original API for building applications with Large Language Models (LLMs) through composability. It represents the state of the `langchain` library prior to its major architectural refactor (pre-0.1.0/0.2.0, before v1.0), which split the project into `langchain-core`, `langchain-community`, and partner packages. This package is in maintenance mode for backward compatibility and does not receive new features; it is not recommended for new projects.
pip install langchain-classicVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic LLM interaction using an `LLMChain` with an OpenAI model and a `PromptTemplate`, typical of `langchain-classic` usage. Ensure `OPENAI_API_KEY` is set in your environment variables.
For new projects, use `langchain` (v1.0+) and its modular components (`langchain-core`, `langchain-openai`, etc.). For existing projects, consider a full migration to the new API or continue using `langchain-classic` in isolation.
New development should target the latest `langchain` package (v1.0+) and its structured approach to agents, models, and tools. Refer to the official LangChain migration guides.
Maintain strict separation. If using `langchain-classic`, avoid installing or using any other `langchain-*` packages that are part of the v1.0+ ecosystem, unless explicitly stated in `langchain-classic` documentation as compatible dependencies. Check `pip freeze` for installed `langchain` related packages.
To access the latest advancements in LLM technology and LangChain's framework, a migration to the modern `langchain` architecture is necessary.
To install versions of LangChain corresponding to 'LangChain Classic' (pre-v1.0), use `pip install langchain<1.0`. For example, `pip install 'langchain==0.1.20'` for a specific pre-v1.0 version. Refer to other warnings for details on migrating to LangChain v1.0+ or continuing with classic versions.