Enter to search with the selected external provider · Press / anywhere to focus search
Enter opens your selected web provider in a new tab
External jump (enhancement)
Enter = open in new tab

Strengths
- Focus on data connections and RAG, going deeper than LangChain in this area
- Supports 100+ data sources (PDF, databases, APIs, web pages, etc.)
- Advanced RAG technology: HyDE, sentence window, parent-child search, etc.
- LlamaCloud provides managed data processing services
- Can be used with LangChain
Best for
- Enterprise knowledge base question and answer system
- Unified retrieval of multiple data sources
- Natural language query for structured data (database, Excel)
- Document understanding and information extraction
- Build an AI research assistant
Quickly build a RAG system
LlamaIndex provides a very simple API, and you can build a RAG system with just a few lines of code.
Scenario
The simplest documentation Q&A
Prompt example
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings
# Configure LLM
Settings.llm = OpenAI(model="gpt-4o", api_key="your-key")
# Load documents (supports PDF, Word, TXT, etc.)
documents = SimpleDirectoryReader("./docs").load_data()
# Build index (automatic chunking, vectorization)
index = VectorStoreIndex.from_documents(documents)
#Create query engine
query_engine = index.as_query_engine()
#Ask a question
response = query_engine.query("What is the company's core product?")
print(response)
print("\nSource:", response.source_nodes[0].text[:200])Output / what to expect
LlamaIndex autocomplete:
- Document loading and parsing
- Text chunking (default 1024 tokens)
- Vectorized storage
- Retrieve the most relevant snippets
- Generate answers with sources
Tips
SimpleDirectoryReader supports mixed file types, and PDF, Word, and TXT in one directory can all be loaded.
Scenario
Persistent index (avoid repeated construction)
Prompt example
import os
from llama_index.core import (
VectorStoreIndex, SimpleDirectoryReader,
StorageContext, load_index_from_storage
)
PERSIST_DIR = "./storage"
if not os.path.exists(PERSIST_DIR):
# Build and save for the first time
documents = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(documents)
index.storage_context.persist(persist_dir=PERSIST_DIR)
print("Index construction completed and saved")
else:
# Directly load existing indexes
storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
index = load_index_from_storage(storage_context)
print("Load index from cache")
query_engine = index.as_query_engine()
response = query_engine.query("your question")Output / what to expect
The first run will build and save the index,
Subsequent runs will load directly.
Avoid repeated calls to the Embedding API,
Save time and money.
Tips
For large document libraries, persistent indexes are very important and can save a lot of API call costs.