{"library":"langchain-classic","title":"LangChain Classic","description":"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.","status":"deprecated","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langchain","tags":["LLM","AI","Generative AI","NLP","Framework","Legacy"],"install":[{"cmd":"pip install langchain-classic","lang":"bash","label":"Install LangChain Classic"}],"dependencies":[{"reason":"Required Python version for the package.","package":"python","optional":false},{"reason":"Commonly used LLM provider for quickstart examples.","package":"openai","optional":true},{"reason":"Required peer dependency for some functionalities within langchain-classic, as it re-exports components from langchain-core.","package":"langchain-core","optional":false},{"reason":"General dependency often used in LangChain for configuration and loading.","package":"pyyaml","optional":false},{"reason":"Used for data validation and settings management.","package":"pydantic","optional":false},{"reason":"HTTP client for making API calls.","package":"requests","optional":false}],"imports":[{"note":"Legacy chains are directly imported from `langchain.chains` in classic. In modern LangChain, these are often in `langchain_community` or replaced by new patterns.","wrong":"from langchain_community.chains import LLMChain","symbol":"LLMChain","correct":"from langchain.chains import LLMChain"},{"note":"LLM integrations were directly under `langchain.llms` or `langchain.chat_models`. In modern LangChain, specific provider integrations moved to separate packages like `langchain_openai`.","wrong":"from langchain_openai import OpenAI","symbol":"OpenAI","correct":"from langchain.llms import OpenAI"},{"note":"Prompt templates were directly under `langchain.prompts`. In modern LangChain, core prompt components moved to `langchain_core.prompts`.","wrong":"from langchain_core.prompts import PromptTemplate","symbol":"PromptTemplate","correct":"from langchain.prompts import PromptTemplate"}],"quickstart":{"code":"import os\nfrom langchain.llms import OpenAI\nfrom langchain.prompts import PromptTemplate\nfrom langchain.chains import LLMChain\n\n# Set your OpenAI API key as an environment variable (e.g., export OPENAI_API_KEY=\"sk-...\")\n# For this example, we use os.environ.get to prevent errors if the key is not set.\nopenai_api_key = os.environ.get('OPENAI_API_KEY', '')\n\nif not openai_api_key:\n    print(\"Warning: OPENAI_API_KEY environment variable not set. Please set it to run the example.\")\n    print(\"Skipping LLM interaction.\")\nelse:\n    llm = OpenAI(openai_api_key=openai_api_key, temperature=0.7)\n\n    prompt = PromptTemplate(\n        input_variables=[\"topic\"],\n        template=\"Tell me a short, funny joke about {topic}.\"\n    )\n\n    chain = LLMChain(llm=llm, prompt=prompt)\n\n    try:\n        response = chain.run(\"developers\")\n        print(f\"Joke about developers:\\n{response}\")\n    except Exception as e:\n        print(f\"An error occurred during LLM interaction: {e}\")\n        print(\"Please ensure your OPENAI_API_KEY is valid and has access to the OpenAI API.\")\n","lang":"python","description":"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."},"warnings":[{"fix":"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.","message":"LangChain Classic's API is fundamentally incompatible with the modern LangChain (v1.0+) ecosystem, including `langchain-core`, `langchain-community`, and partner packages. Direct migration requires significant code changes.","severity":"breaking","affected_versions":"All versions"},{"fix":"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.","message":"The `langchain-classic` package is explicitly for backward compatibility with pre-v1.0 LangChain and is not actively developed for new features.","severity":"deprecated","affected_versions":"All versions"},{"fix":"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.","message":"Attempting to mix `langchain-classic` with newer `langchain` packages (e.g., `langchain-core`, `langchain-community`, `langchain-openai`) will likely lead to dependency conflicts, import errors, and runtime issues due to incompatible APIs and overlapping namespaces.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To access the latest advancements in LLM technology and LangChain's framework, a migration to the modern `langchain` architecture is necessary.","message":"LangChain Classic will not receive new features, performance optimizations, or regular bug fixes available in the ongoing development of the main `langchain` library. This includes updates for new LLM capabilities or provider integrations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}