What is LlamaIndex?
LlamaIndex is a data framework for LLM applications. It specializes in RAG (Retrieval Augmented Generation) — connecting LLMs to your private data through embeddings and vector search.
Step 1: Install LlamaIndex
# Install core package
pip install llama-index
# Install all extras
pip install llama-index-all
Step 2: Build a RAG Pipeline
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
# Load documents
documents = SimpleDirectoryReader("data").load_data()
# Create index
index = VectorStoreIndex.from_documents(documents)
# Create query engine
query_engine = index.as_query_engine()
# Query
response = query_engine.query("What does the data say about AI?")
print(response)
🎉 LlamaIndex is Ready!
You can now build RAG applications with your own data. Explore more tools.