Typefully

Exploring LangChain's Main Components

Avatar

Share

 • 

3 years ago

 • 

View on X

LangChain: the popular tool that's taking over. Main components ▪️ Schema ▪️ Models ▪️ Prompts ▪️ Indexes ▪️ Memory ▪️ Chains ▪️ Agents Let's review them in more detail 🧵
Schema LLMs work with what is usually called text. It includes ▪️ ChatMessages consist of text + user. Users can be: System, Human, and AI ▪️ Examples: input/output pairs ▪️ Document: a piece of unstructured data
Models can be ▪️ LLMs: take a text string as input, and return a text string as output ▪️ Chat Models: take a list of Chat Messages as input, and return a Chat Message ▪️ Text Embedding Models: take text as input and return a list of floats.
Prompts are inputs to the model. ▪️ They are also called PromptValues. ▪️ PromptTemplate is a class in charge of constructing a PromptValue ▪️ Output Parsers are outputs of the model
Indexes are ways to structure documents so that LLMs can best interact with them. ▪️ Document Loaders ▪️ Text Splitters ▪️ VectorStores relies on embeddings ▪️ Retrievers fetch relevant documents to combine with language models
Memory is the concept of storing and retrieving data in the process of a conversation. 2 main methods: 1. Based on input, fetch any relevant pieces of data 2. Based on the input and output, update the state accordingly
Chains are a sequence of modular components (or other chains) combined in a particular way to accomplish a common use case.
Agents are the language models that drive decision-making. Agents use "tools" and "toolkits" to interact with other resources. An "agent executor" defines the logic for running agents with tools.
If you want to learn more about LangChain, we recommend their official documentation docs.langchain.com/docs/category/components We've also recently found a great schema describing the main components and their interrelations app.heptabase.com/w/12484a51f631edbddd6415dafbad56d8ae119058ece8bcb3e8d9a5a3ba80a45b?id=7d359c3d-b443-4547-a852-d384457cd23b&objectType=cardInstance&objectId=d7c8d573-e627-4669-adc0-94255d800209
Avatar

TuringPost

@TheTuringPost

Newsletter exploring AI & ML - AI 101 - ML techniques - AI Business insights - Global dynamics - ML History Led by @kseniase_ Save hours of research 👇🏼