LlamaIndex Quickstart
Start by loading documents, building a searchable index and asking one grounded question. Add multiple sources, reranking and routing only after that loop is understood.
#Install
bashpip install llama-index
#Minimal retrieval example
Put suitable text/PDF files in data:
pythonfrom llama_index.core import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader("data").load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() response = query_engine.query("What are the key points in these documents?") print(response)
This source example can invoke configured external embedding and language models. Configure providers explicitly and understand their costs before running it; it was not executed as part of this translation.
#Verify the first loop
Check that the documents loaded, relevant content is retrieved and the answer stays grounded in those documents. Adding components before this check makes failures harder to locate.
#Framework focus
LlamaIndex emphasizes data ingestion, indexing and retrieval. LangChain covers broader application composition and agent workflows. Both have evolved; choose using the actual workflow rather than the source's promotional comparison of which is categorically easier or more advanced.
#Data readers
LlamaHub↗ provides integrations. A source example is:
pythonfrom llama_index.readers.notion import NotionPageReader reader = NotionPageReader(integration_token="YOUR_TOKEN") documents = reader.load_data(page_ids=["PAGE_ID"])
Install the matching integration package and grant access only to intended data. A connector establishes access, not answer reliability.