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.