What is LangChain?

LangChain is an open source framework for building applications based on large language models (LLMs). LLMs are large deep-learning models pre-trained on large amounts of data that can generate responses to user queries—for example, answering questions or creating images from text-based prompts. 

Chains

Chains are the fundamental principle that holds various AI components in LangChain to provide context-aware responses. A chain is a series of automated actions from the user’s query to the model’s output. For example, developers can use a chain for:

  • Connecting to different data sources.
  • Generating unique content.
  • Translating multiple languages.
  • Answering user queries. 

Links

Chains are made of links. Each action that developers string together to form a chained sequence is called a link. With links, developers can divide complex tasks into multiple, smaller tasks. Examples of links include:

  • Formatting user input. 
  • Sending a query to an LLM. 
  • Retrieving data from cloud storage.
  • Translating from one language to another.

In the LangChain framework, a link accepts input from the user and passes it to the LangChain libraries for processing. LangChain also allows link reordering to create different AI workflows.