Generative AI with LangChain: Build large language model (LLM) apps with Python, ChatGPT, and other LLMs
amazon.com
Generative AI with LangChain: Build large language model (LLM) apps with Python, ChatGPT, and other LLMs
LangChain enables building dynamic, data-aware applications that go beyond what is possible by simply accessing LLMs via API calls.
LLMs are known to return the most probable answers within the context, which can sometimes yield fabricated information, termed hallucinations. This is a feature as well as a bug since it highlights their creative potential.
Templates give flexibility in terms of input and the available collection of prompts is battle-tested in a range of applications.
There’s functionality in LangChain for knowledge graphs for retrieval; however, LangChain also provides memory components to automatically create a knowledge graph based on our conversation messages.
In LangChain, we first load documents through data loaders. Then we can transform them and pass these documents to a vector store as embedding. We can then query the vector store or a retriever associated with the vector store. Retrievers in LangChain can wrap the loading and vector storage into a single step.
DocArray as our in-memory vector storage. DocArray provides various features like advanced indexing, comprehensive serialization protocols, a unified Pythonic interface, and more. Further, it offers efficient and intuitive handling of multimodal data for tasks such as natural language processing, computer vision, and audio processing.
We could have retrieved embeddings for long documents – instead, we’ve retrieved the vectors only for each single word.
Document loaders have a load() method that loads data from the configured source and returns it as documents. They may also have a lazy_load() method for loading data into memory as and when they are needed.
LangChain supports a map reduce approach for processing documents using LLMs, which allows for efficient processing and analysis of documents. A chain can be applied to each document individually and then we combine the outputs into a single document.