File size: 1,006 Bytes
288d21e 2b89a5e 0e41b25 10a669b e19099e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
---
datasets:
- chromadb/paul_graham_essay
language:
- en
tags:
- RAG
- Retrieval Augmented Generation
- llama-index
---
# 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?
1. Ready/ Preprocess your input data i.e. tokenization & vectorization
2. Feed the processed data to the Language Model.
3. 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 llama_index import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
### 2. Query your data
query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
print(response)
# My application of RAG on ChatGPT
Check RAG.ipynb |