LangChain is a framework that revolves around large language models (LLMs). It enables the development of applications using LLMs for various purposes like chatbots, generative question-answering, summarization, and more.


The framework allows you to “chain” together different components to create advanced use cases with LLMs. These components include prompt templates, LLMs themselves (such as GPT-3 or BLOOM), agents that use LLMs to make decisions, and memory for short-term or long-term storage.

Why LangChain?

The key advantages of using LangChain are:

  1. Components: LangChain offers modular abstractions and implementations for working with LLMs. These components are designed to be user-friendly, even if you’re not utilizing the entire LangChain framework.
  2. Use-Case Specific Chains: Chains in LangChain are configurations of components specifically designed to accomplish particular use cases. These chains provide a higher-level interface for easily starting with a specific application and are customizable according to your needs.

LangChain simplifies the process of working with LLMs by breaking down text into chunks or summaries, embedding them in a vector space, and searching for similar chunks when questions are asked. This approach allows for preprocessing, real-time collection, and interaction with the LLM. It’s useful not only for question-answering but also for scenarios like code and semantic search.

How LangChain works?
How LangChain works?

The LangChain framework consists of several modules:

  1. Schema: This module includes interfaces and base classes used throughout the library.
  2. Models: It provides integrations with various LLMs, chat models, and embedding models.
  3. Prompts: This module handles prompt templates and functionality related to working with prompts, including output parsers and example selectors.
  4. Indexes: It offers patterns and functionality for working with your own data, preparing it for interaction with language models. This includes document loaders, vector stores, text splitters, and retrievers.
  5. Memory: Memory is the concept of persisting state between calls of a chain or agent. LangChain provides a standard interface, various memory implementations, and examples of chains or agents that utilize memory.
  6. Chains: Chains involve sequences of calls to LLMs or other utilities, going beyond a single LLM call. LangChain provides a standard interface for chains, integrations with other tools, and end-to-end chains for common applications.
  7. Agents: Agents make decisions using LLMs, taking actions based on observations and repeating the process. LangChain provides a standard interface for agents, a selection of agents to choose from, and examples of end-to-end agents.

For more detailed information about these modules and how to use them, you can refer to the documentation and API references provided by LangChain.

Let’s get started

Open In Colab

Reference

แชร์ให้เพื่อน:

Surapong Kanoktipsatharporn on Linkedin
Surapong Kanoktipsatharporn
CTO at Bua Labs
The ultimate test of your knowledge is your capacity to convey it to another.

Published by Surapong Kanoktipsatharporn

The ultimate test of your knowledge is your capacity to convey it to another.