Chain Component

Learn how to use a simple LLM chain and combine multiple chains in your applications.

Types of chains

Chains help in abstracting multistep actions in a simple way. There are many types of chains supported by langchaingo. Here are some of the commonly used chains:

  • LLM chain: This is the simplest form of a chain that combines a prompt template and an LLM.

  • ConversationalRetrievalChain: This chain can be used to have a conversational interaction using a document as context or source of information. It takes in a question, fetches the required documents and passes them (along with the conversation) to an LLM for a response.

  • StuffDocumentsChain: This chain accepts a list of documents, formats them all into a prompt, and then passes it to an LLM. One has to make sure that the final size of the prompt and the document fit within the LLM context window.

Get hands-on with 1400+ tech skills courses.