Registry / llm-agents / langchain-community

langchain-community

JSON →
library0.4.2pypypi✓ verified 25d ago

LangChain Community provides a collection of third-party integrations for the LangChain ecosystem. These integrations implement base interfaces defined in LangChain Core, enabling connectivity to various LLM providers, document loaders, vector stores, and other tools within any LangChain application. It is actively maintained and currently at version 0.4.1.

pip install langchain-community
INSTALL
IMPORT
SIG · LANGCHAIN-COMMUNIT
L
langchain-community
llm-agentspythonv0.4.2
Install
16.3s avg
Import
1282ms
Disk
219MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.328s · 210.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 16.3s · import 1.236s · 214MB
219MB installed
● package 219MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TextLoader
from langchain_community.document_loaders import TextLoader
from langchain.document_loaders import TextLoader
Many document loaders were moved from `langchain` to `langchain_community` in v0.2.
FakeEmbeddings
from langchain_community.embeddings import FakeEmbeddings
This provides a simple, dependency-free embedding for testing and quickstarts.
FAISS
from langchain_community.vectorstores import FAISS
A popular in-memory vector store, moved to `langchain_community`.
ChatOpenAI
from langchain_openai import ChatOpenAI
from langchain_community.chat_models import ChatOpenAI
Provider-specific chat models like `ChatOpenAI` are now in dedicated packages (e.g., `langchain-openai`), not directly in `langchain-community`.

This quickstart demonstrates how to load documents using `TextLoader` from `langchain-community`, create a simple vector store with `FAISS` and `FakeEmbeddings` (both from `langchain-community`), and then use an OpenAI Chat Model (from `langchain-openai`) with a basic RAG (Retrieval Augmented Generation) chain. It highlights using components from `langchain-community` alongside a common LLM provider package.

import os from langchain_community.document_loaders import TextLoader from langchain_community.embeddings import FakeEmbeddings from langchain_community.vectorstores import FAISS from langchain_core.prompts import ChatPromptTemplate from langchain_core.output_parsers import StrOutputParser from langchain_openai import ChatOpenAI # Requires 'pip install langchain-openai' # Create a dummy text file for demonstration with open("example.txt", "w") as f: f.write("LangChain is a framework for developing applications powered by large language models (LLMs).") f.write("\nIt enables applications that are context-aware and can reason over data.") # Set your OpenAI API key (replace with actual key or environment variable) # For a real application, use `os.environ.get("OPENAI_API_KEY", "")` os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "sk-YOUR_OPENAI_KEY_HERE") # 1. Load documents using a loader from langchain-community loader = TextLoader("example.txt") documents = loader.load() print(f"Loaded {len(documents)} document(s).") # 2. Create embeddings (using a fake one for simplicity in 'community' quickstart) # For real use, install a provider package like `langchain-openai` and use its embeddings. embeddings = FakeEmbeddings() # 3. Create a vector store from documents and embeddings vectorstore = FAISS.from_documents(documents, embeddings) print("Vector store created.") # 4. Perform a similarity search as a retriever retriever = vectorstore.as_retriever() # 5. Define a Chat Model (from a dedicated provider package, e.g., langchain-openai) # Ensure OPENAI_API_KEY is set in your environment. chat_model = ChatOpenAI(api_key=os.environ.get("OPENAI_API_KEY")) # 6. Create a prompt template prompt = ChatPromptTemplate.from_messages([ ("system", "You are an AI assistant. Answer the question based ONLY on the provided context."), ("human", "Context: {context}\nQuestion: {question}") ]) # 7. Build a RAG chain chain = ( {"context": retriever, "question": StrOutputParser()} | prompt | chat_model | StrOutputParser() ) # 8. Invoke the chain question = "What is LangChain's primary purpose?" response = chain.invoke(question) print(f"\nQuestion: {question}") print(f"Answer: {response}") # Clean up the dummy file os.remove("example.txt")
Debug
Known issues
breakingMinor versions of `langchain-community` (e.x., 0.x.y to 0.y.z) may introduce breaking changes. Unlike `langchain` and `langchain-core`, it does not strictly adhere to semantic versioning due to the nature of community contributions and third-party integrations.
fix
Always check the changelog or release notes before upgrading minor versions of `langchain-community`. Pin your `langchain-community` version to prevent unexpected breakage.
affects: 0.1.0 and later
breakingMany third-party integrations (e.g., specific Document Loaders, Vector Stores, LLMs) were moved from the main `langchain` package to `langchain-community` or dedicated provider packages (e.g., `langchain-openai`, `langchain-anthropic`) starting with LangChain v0.2. Attempting to import from old paths will result in `ImportError`.
fix
Update your import statements: `from langchain.module import Class` becomes `from langchain_community.module import Class` or `from langchain_provider.module import Class`. Ensure the necessary integration package (e.g., `langchain-community`, `langchain-openai`) is installed.
affects: 0.2.0 and later (for `langchain` main package), 0.0.1 and later (for `langchain-community` after the split)
gotchaUsing specific integrations within `langchain-community` often requires installing additional, sometimes optional, Python packages (e.g., `beautifulsoup4` for `WebBaseLoader`, `faiss-cpu` for `FAISS`, `openai` for `langchain-openai` classes). A `ModuleNotFoundError` for a seemingly related package means a sub-dependency is missing.
fix
Refer to the specific integration's documentation to identify and install its required dependencies (e.g., `pip install langchain-community[webloaders]` or `pip install beautifulsoup4`). If using a dedicated provider package, install it (e.g., `pip install langchain-openai`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'langchain_community'
The `langchain-community` package is not installed in your Python environment or your virtual environment is not active.
fix
pip install langchain-community
ModuleNotFoundError: No module named 'langchain.llms'
Components like LLMs, Chat Models, and Vector Stores were moved from the main `langchain` package to `langchain-community` or specific partner packages (e.g., `langchain-openai`) in LangChain v0.2.0+ due to a modularization effort.
fix
Change the import path to `from langchain_community.llms import OpenAI` (or `from langchain_community.chat_models import ChatOpenAI`, `from langchain_community.vectorstores import FAISS`, etc.) and ensure `langchain-community` (and relevant partner packages like `langchain-openai`) is installed.
AttributeError: module 'langchain' has no attribute 'verbose'
This attribute or similar top-level configuration/utility functions have been removed or refactored in newer versions of LangChain (post-v0.2.0 modularization).
fix
Remove the usage of `langchain.verbose` or consult the latest LangChain documentation for the equivalent new way to achieve the desired functionality (e.g., configuring logging directly or using `langchain_core` components).
LangChainDeprecationWarning: Importing vector stores from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain_community.vectorstores instead:
You are using an old import path for a component (like vector stores, document loaders, or embeddings) that has been moved to the `langchain-community` package as part of the LangChain v0.2.0+ modularization.
fix
Update your import statement, for example, change `from langchain.vectorstores import FAISS` to `from langchain_community.vectorstores import FAISS`.
ImportError: cannot import name 'Chroma' from 'langchain_community.vectorstores'
The Chroma vector store integration has been moved from `langchain_community.vectorstores` to its own dedicated `langchain-chroma` package.
fix
pip install langchain-chroma
from langchain_chroma import Chroma
Install Issues
1 verified issue
ImportError: Chroma moved from langchain.vectorstores to langchain_communityAll platforms · langchain 0.2+
Upgrade
Version history
0.4.2latest on PyPI · released May 22, 2026
Audit
Dependencies
langchain-corerequired`langchain-community` builds upon the core abstractions defined in `langchain-core`.
langchain-openaioptionalMany specific LLM/ChatModel integrations (e.g., OpenAI) have moved to dedicated provider packages for better modularity.
langchainoptionalThe main LangChain library for higher-level chains, agents, and retrieval algorithms.
Agent activity
37 hits · last 30 days
node
31
OpenAI (training)
1
Resources
langchain-community — pip install langchain-community · libregistry