Chains

Chains are a key part of the LangChain framework that is used to combine Prompt Templates with Large Language Model to carry out a sequence of operations on text or our data.

LangChain offers many chain types

LLM Chain

This is one of the most basic types of chains and is used to chain a prompt template and a prompt often with a Output Parser

Sequential Chain

Sequential Chains are used when you need to use the output of a first chain and pass it another chain, it to chain chains together, often the prompt template has the variable in place for the input variable and the chain has a output key to pass the output_key of the current chain as an input to the next chain.

Router Chain

Router chain can be used when we have specialised chains for certain tasks, such as one for medical related information and other for architecture related questions, using this chain, we can direct the information to the desired one.