Langchain is a framework that allows to integrate Large Language Models into an application.

Its composed of three main components:

  1. Retrieve: this is composed by a document loader, which is used to load content from a source. If the documents are large, we can use a component called text splitter, which splits a document into smaller semantically meaningful chunks.
  2. Summarize: this is composed by a chain, which is a pipeline containing the following processes:
    1. Prompt: structures an LLM to perform the summarization;
    2. LLM: the actual model that performs the summarization.
  3. Answer: this is composed by another chain, which contains:
    1. A memory, which stores conversations;
    2. A prompt, which structures the model to generate an answer based on the summary and the memory;
    3. The LLM that generates the answer. This LLM can be a different LLM from the one used in the summarization process.

The modularity of this framework allows the application to use a different LLM for each purpose (one for a certain types of queries, and another one for other types of queries).

Nearly any LLM can be integrated into Langchain, until it has some APIs to interface with it.


Related:


nlp resources: