Update README.md
Browse files
README.md
CHANGED
@@ -13,4 +13,13 @@ tags:
|
|
13 |
# How does RAG works?
|
14 |
1. Ready/ Preprocess your input data i.e. tokenization & vectorization
|
15 |
2. Feed the processed data to the Language Model.
|
16 |
-
3. Indexing the stored data that matches the context of the query.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# How does RAG works?
|
14 |
1. Ready/ Preprocess your input data i.e. tokenization & vectorization
|
15 |
2. Feed the processed data to the Language Model.
|
16 |
+
3. Indexing the stored data that matches the context of the query.
|
17 |
+
# Implementing RAG with llama-index
|
18 |
+
### 1. Load relevant data and build an index
|
19 |
+
from llama_index import VectorStoreIndex, SimpleDirectoryReader
|
20 |
+
documents = SimpleDirectoryReader("data").load_data()
|
21 |
+
index = VectorStoreIndex.from_documents(documents)
|
22 |
+
### 2. Query your data
|
23 |
+
query_engine = index.as_query_engine()
|
24 |
+
response = query_engine.query("What did the author do growing up?")
|
25 |
+
print(response)
|