Learn how to use retrieval augmented generation using the AI SDK and Node
Retrieval Augmented Generation (RAG) is a technique that enhances the capabilities of language models by providing them with relevant information from external sources during the generation process.
This approach allows the model to access and incorporate up-to-date or specific knowledge that may not be present in its original training data.
This example uses the following essay as an input (essay.txt). This example uses a simple in-memory vector database to store and retrieve relevant information. Alternatively, you can check out our Knowledge Base Agent example which uses Upstash Search to generate embeddings and manage the knowledge base.