🤖 AI/ML

LlamaIndex

LlamaIndex

A framework connecting LLMs with data. Specialized for implementing RAG.

📖 Detailed Explanation

LlamaIndex is an open-source framework that connects LLMs with external data. It specializes in implementing RAG (Retrieval-Augmented Generation), and it indexes and searches various data sources such as PDFs, web pages, and databases in a form that LLMs can understand.

It began in 2022 under the name GPT Index, created by Jerry Liu, and developed into LlamaIndex. As of 2025, version v0.11 has been released, supporting more than 50 data connectors (Google Drive, Notion, Slack, etc.) and advanced features such as hybrid search and Agentic Retrieval.

LlamaIndex's core components are Data Connectors (data loading), Index Structures (vector/keyword indexes), Query Engines (search and response generation), and Agents (performing complex tasks). With LlamaParse, even complex PDFs can be parsed accurately.

In practice, it is used when building in-house document-based chatbots, customer support AI, technical document search systems, and the like. Compared with LangChain, it is more specialized in document search, and in 2025 benchmarks it achieved a 35% improvement in search accuracy and a 40% improvement in processing speed.

💻 Code Example

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.core import Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding

# LLM과 임베딩 모델 설정
Settings.llm = OpenAI(model="gpt-4o-mini", temperature=0.1)
Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-small")

# 문서 로드 (PDF, txt, docx 등 자동 인식)
documents = SimpleDirectoryReader("./company_docs").load_data()
print(f"로드된 문서: {len(documents)}개")

# 벡터 인덱스 생성 (청킹 + 임베딩 자동 처리)
index = VectorStoreIndex.from_documents(documents)

# 쿼리 엔진 생성
query_engine = index.as_query_engine(
    similarity_top_k=5,  # 상위 5개 관련 문서 검색
    response_mode="compact"  # 응답 형식
)

# 질문에 대한 답변 생성
response = query_engine.query(
    "2024년 4분기 매출 실적은 어떻게 되나요?"
)
print(f"답변: {response}")
print(f"출처: {[node.metadata for node in response.source_nodes]}")

# 영구 저장소에 인덱스 저장
index.storage_context.persist(persist_dir="./storage")

# 저장된 인덱스 로드
from llama_index.core import StorageContext, load_index_from_storage
storage_context = StorageContext.from_defaults(persist_dir="./storage")
loaded_index = load_index_from_storage(storage_context)

📊 Performance & Cost

This is pricing information for the LlamaIndex ecosystem as of January 2025.

Services Price Features
LlamaIndex Open Source Free (MIT License) Building RAG pipelines
LlamaParse Free Free 1,000 pages/day
LlamaParse Pro $4.99/month 100,000 pages/month
LlamaCloud Starter $49/month 5,000 pages, 5GB storage
LlamaCloud Team $299/month 100,000 pages, 50GB storage
LlamaCloud Enterprise Contact required Unlimited, VPC deployment
Supported Data Sources Count Examples
LlamaHub Loaders 300+ PDF, Notion, Slack, DB, etc.
Vector Stores 40+ Pinecone, Milvus, Weaviate, etc.

🗣️ Say It Like This in Practice

💬 In a Meeting
"We built our internal knowledge search chatbot with LlamaIndex. We indexed 30,000 documents from Confluence, Notion, and Google Drive, so it searches for relevant documents and generates answers with GPT-4o. Repeated questions from employees decreased by 70%."
💬 In an Interview
"LlamaIndex is a framework optimized for building RAG pipelines. Document chunking, embedding, vector search, and response synthesis are all abstracted, so you can build prototypes quickly and scale up to the production level."
💬 In a Technical Discussion
"The latest LlamaIndex supports the Agentic RAG pattern. Beyond simple search, you can easily implement advanced retrieval strategies such as Multi-hop question decomposition and Self-RAG. Techniques like HyDE and RAPTOR are also provided built-in."

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

⚠️ Common Mistakes & Cautions

❌
Using the default chunking settings as is

A chunking size that doesn't fit the characteristics of the documents degrades search quality. Technical documents and conversation logs need different settings.

✅
The right approach

Adjust chunk_size (256–1024) and chunk_overlap (10–20%) according to the document type. Use LlamaParse for complex PDFs and a dedicated parser for table data.

🔗 Related Terms

📚 Learn More