-
Notifications
You must be signed in to change notification settings - Fork 612
feat(docs): add component architecture documentation #1226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mdrxy
wants to merge
1
commit into
main
Choose a base branch
from
mdrxy/component-diagram
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,134 @@ | ||||||
| --- | ||||||
| title: Component architecture | ||||||
| --- | ||||||
|
|
||||||
| LangChain's power comes from how its components work together to create sophisticated AI applications. This page provides visual diagrams showing the relationships between different components, helping you understand how they fit together. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## 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 | ||||||
|
|
||||||
| %% Styling | ||||||
| classDef inputStyle fill:#e1f5fe,stroke:#0277bd | ||||||
| classDef embeddingStyle fill:#f3e5f5,stroke:#7b1fa2 | ||||||
| classDef retrievalStyle fill:#e8f5e8,stroke:#388e3c | ||||||
| classDef generationStyle fill:#fff3e0,stroke:#f57c00 | ||||||
| classDef orchestrationStyle fill:#fce4ec,stroke:#c2185b | ||||||
|
|
||||||
| class A,B,C,D inputStyle | ||||||
| class E,F,G embeddingStyle | ||||||
| class H,I,J,K,L retrievalStyle | ||||||
| class M,N,O,P generationStyle | ||||||
| class Q,R orchestrationStyle | ||||||
| ``` | ||||||
|
|
||||||
| ### 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] | ||||||
| ``` | ||||||
|
|
||||||
| ## Next steps | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Now that you understand how components relate to each other, explore specific areas: | ||||||
|
|
||||||
| - **Building your first RAG system**: [Knowledge Base Tutorial](/oss/langchain/knowledge-base) | ||||||
| - **Creating agents**: [Agents Guide](/oss/langchain/agents) | ||||||
| - **Working with tools**: [Tools Guide](/oss/langchain/tools) | ||||||
| - **Setting up memory**: [Memory Guide](/oss/langchain/short-term-memory) | ||||||
| - **Browse integrations**: [All Integrations](/oss/integrations/providers/overview) | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontmatter is missing a required
descriptionfield. According to the documentation guidelines, all MDX files must include bothtitleanddescriptionin their frontmatter. Add a concise description that will be used for SEO and navigation purposes.