diff --git a/src/docs.json b/src/docs.json index 70bd51f3ef..944cd19c1b 100644 --- a/src/docs.json +++ b/src/docs.json @@ -360,6 +360,7 @@ "group": "Conceptual overviews", "icon": "book", "pages": [ + "oss/python/langchain/component-architecture", "oss/python/concepts/memory", "oss/python/concepts/context", "oss/python/langgraph/graph-api", @@ -723,6 +724,7 @@ "group": "Conceptual overviews", "icon": "book", "pages": [ + "oss/javascript/langchain/component-architecture", "oss/javascript/concepts/memory", "oss/javascript/concepts/context", "oss/javascript/langgraph/graph-api", diff --git a/src/oss/langchain/component-architecture.mdx b/src/oss/langchain/component-architecture.mdx new file mode 100644 index 0000000000..a66a5838ae --- /dev/null +++ b/src/oss/langchain/component-architecture.mdx @@ -0,0 +1,121 @@ +--- +title: Component architecture +--- + +LangChain's power comes from how its components work together to create sophisticated AI applications. This page provides diagrams showcasing the relationships between different components. + +## Core component ecosystem + +The diagram below shows how LangChain's major components connect to form complete AI applications: + +```mermaid +graph TD + %% Input processing + subgraph "📥 Input processing" + A[Text input] --> B[Document loaders] + B --> C[Text splitters] + C --> D[Documents] + end + + %% Embedding & storage + subgraph "🔢 Embedding & storage" + D --> E[Embedding models] + E --> F[Vectors] + F --> G[(Vector stores)] + end + + %% Retrieval + subgraph "🔍 Retrieval" + H[User Query] --> I[Embedding models] + I --> J[Query vector] + J --> K[Retrievers] + K --> G + G --> L[Relevant context] + end + + %% Generation + subgraph "🤖 Generation" + M[Chat models] --> N[Tools] + N --> O[Tool results] + O --> M + L --> M + M --> P[AI response] + end + + %% Orchestration + subgraph "🎯 Orchestration" + Q[Agents] --> M + Q --> N + Q --> K + Q --> R[Memory] + end +``` + +### How components connect + +Each component layer builds on the previous ones: + +1. **Input processing** – Transform raw data into structured documents +2. **Embedding & storage** – Convert text into searchable vector representations +3. **Retrieval** – Find relevant information based on user queries +4. **Generation** – Use AI models to create responses, optionally with tools +5. **Orchestration** – Coordinate everything through agents and memory systems + +## Component categories + +LangChain organizes components into these main categories: + +| Category | Purpose | Key Components | Use Cases | +|----------|---------|---------------|-----------| +| **[Models](/oss/langchain/models)** | AI reasoning and generation | Chat models, LLMs, Embedding models | Text generation, reasoning, semantic understanding | +| **[Tools](/oss/langchain/tools)** | External capabilities | APIs, databases, etc. | Web search, data access, computations | +| **[Agents](/oss/langchain/agents)** | Orchestration and reasoning | ReAct agents, tool calling agents | Nondeterministic workflows, decision making | +| **[Memory](/oss/langchain/short-term-memory)** | Context preservation | Message history, custom state | Conversations, stateful interactions | +| **[Retrievers](/oss/integrations/retrievers)** | Information access | Vector retrievers, web retrievers | RAG, knowledge base search | +| **[Document processing](/oss/integrations/document_loaders)** | Data ingestion | Loaders, splitters, transformers | PDF processing, web scraping | +| **[Vector Stores](/oss/integrations/vectorstores)** | Semantic search | Chroma, Pinecone, FAISS | Similarity search, embeddings storage | + +## Common patterns + +### RAG (Retrieval-Augmented Generation) +```mermaid +graph LR + A[User question] --> B[Retriever] + B --> C[Relevant docs] + C --> D[Chat model] + A --> D + D --> E[Informed response] +``` + +### Agent with tools +```mermaid +graph LR + A[User request] --> B[Agent] + B --> C{Need tool?} + C -->|Yes| D[Call tool] + D --> E[Tool result] + E --> B + C -->|No| F[Final answer] +``` + +### Multi-agent system +```mermaid +graph LR + A[Complex Task] --> B[Supervisor agent] + B --> C[Specialist agent 1] + B --> D[Specialist agent 2] + C --> E[Results] + D --> E + E --> B + B --> F[Coordinated response] +``` + +## Learn more + +Now that you understand how components relate to each other, explore specific areas: + +- [Building your first RAG system](/oss/langchain/knowledge-base) +- [Creating agents](/oss/langchain/agents) +- [Working with tools](/oss/langchain/tools) +- [Setting up memory](/oss/langchain/short-term-memory) +- [Browse integrations](/oss/integrations/providers/overview)