One concrete example of this is vector stores for document retrieval, often used for semantic search or question answering.
With this method, larger documents are split up into
smaller chunks and then each chunk of text is passed to an embedding function which creates an embedding for that piece of text.
Those are embeddings are then stored in a database. When a new search query or question comes in, an embedding is
created for that query/question and then documents with embeddings most similar to that embedding are fetched.
Examples of vector database companies include Pinecone and Weaviate.
Although this is perhaps the most common way of document retrieval, people are starting to think about alternative
data structures and indexing techniques specifically for working with language models. For a leading example of this,
check out LlamaIndex - a collection of data structures created by and optimized
for language models.
Augmenting#
So you’ve fetched your relevant data - now what? How do you pass them to the language model in a format it can understand?
For a detailed overview of the different ways of doing so, and the tradeoffs between them, please see
this documentation
Use Cases#
LangChain supports the above three methods of augmenting LLMs with external data.
These methods can be used to underpin several common use cases, and they are discussed below.
For all three of these use cases, all three methods are supported.
It is important to note that a large part of these implementations is the prompts
that are used. We provide default prompts for all three use cases, but these can be configured.
This is in case you discover a prompt that works better for your specific application.
Question-Answering
Summarization
previous
Generate Examples
next
Question Answering
 Contents
  
Overview
Related Literature
Fetching
Text Splitting
Relevant Documents
Augmenting
Use Cases
By Harrison Chase