Langchain is a framework that allows to integrate Large Language Models into an application.
Its composed of three main components:
- 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.
- Summarize: this is composed by a chain, which is a pipeline containing the following processes:
- Prompt: structures an LLM to perform the summarization;
- LLM: the actual model that performs the summarization.
- Answer: this is composed by another chain, which contains:
- A memory, which stores conversations;
- A prompt, which structures the model to generate an answer based on the summary and the memory;
- 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: