LlamaIndex is an open-source project built on top of LangChain that provides a way to give context to large language models so that they can give more informed responses.
How does it work?
LlamaIndex comes with various data loaders that can be found on the Llama Hub. After loading data in from an API, documents, or any other data source, that data is split into smaller chunks. Then, the smaller chunks are loaded into a vector database, also known as an embedding.
Vector databases are multi-dimensional arrays that allow a large language model to see how closely words are related. Using a vector database allows us to provide more context and give “memory” to a LLM.
Once LlamaIndex has a vector database built, you can query the LLM. LlamaIndex acts as a broker and uses a receiver method to find relevant data from the vector database, which it then sends along to the LLM so that it can answer the query with context. Read more about LangChain indices and receivers.