Shrideep/Retrieval_Augmented_Generation
2
Summary:
Retrieval Augmented Generation (RAG) is a technique to specialize a language model with a specific knowledge domain by feeding in relevant data so that it can give better answers.
How does RAG works?
- Ready/ Preprocess your input data i.e. tokenization & vectorization
- Feed the processed data to the Language Model.
- Indexing the stored data that matches the context of the query.
Implementing RAG with llama-index
1. Load relevant data and build an index
from llamaindex import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader("data").loaddata() index = VectorStoreIndex.from_documents(documents)
2. Query your data
queryengine = index.asqueryengine() response = queryengine.query("What did the author do growing up?") print(response)
My application of RAG on ChatGPT
Check RAG.ipynb
