Following the TRUE 95/5 principle, we should use the simplest tool for each job:
# Index and search with built-in CLI
llamaindex-cli rag --files "./docs" --question "How does X work?"
# Interactive chat mode
llamaindex-cli rag --files "./docs" --chat
# Download pre-built packs
llamaindex-cli download-llamapack CodeHierarchyAgentPack
llamaindex-cli download-llamapack SubQuestionQueryEnginePack
# Create new LlamaIndex app
llamaindex-cli rag --files "./docs" --create-llama# Indexing - one line
VectorStoreIndex.from_documents(docs, storage_context=storage_context)
# Search - one line
index.as_query_engine().query("question")
# Property Graph - one line
PropertyGraphIndex.from_documents(docs)# SubQuestion engine - breaks complex questions
SubQuestionQueryEngine.from_defaults(query_engines)
# Router engine - routes to different indexes
RouterQueryEngine.from_defaults(query_engines)
# Graph RAG - knowledge graph queries
GraphRAGQueryEngine.from_defaults(graph_index)find_violations()- 95/5 rule checking (business logic)suggest_libraries()- Custom prompting- Integration with claude-parser
- CLI wrappers for convenience
- ❌
enterprise_architecture.py→ Use CodeHierarchyAgentPack - ❌ Complex graph building → Use PropertyGraphIndex.from_documents()
- ❌ Manual caching → Already removed ✅
# For code analysis
llamaindex-cli download-llamapack CodeHierarchyAgentPack -d ./packs
# For complex Q&A
llamaindex-cli download-llamapack SubQuestionQueryEnginePack -d ./packs
# For multi-step reasoning
llamaindex-cli download-llamapack ChainOfThoughtPack -d ./packs
# For structured output
llamaindex-cli download-llamapack StructuredOutputPack -d ./packs-
Replace enterprise_architecture.py with CodeHierarchyAgentPack
- Current: 113 LOC custom code
- Better: Download and use the pack
-
Add SubQuestionQueryEngine for complex queries
- Current: Simple search only
- Better: Break down complex questions
-
Add RouterQueryEngine for multi-domain
- Current: Manual collection selection
- Better: Automatic routing
# 200+ lines of custom code
class EnterpriseArchitecture(SemanticSearch):
def complex_custom_logic(self):
# Reinventing what LlamaIndex already has# Step 1: Try CLI
llamaindex-cli rag --files "./code" --question "Show me the architecture"
# Step 2: If CLI doesn't work, use SDK one-liner
PropertyGraphIndex.from_documents(docs).as_query_engine().query("architecture")
# Step 3: Only if needed, minimal Python wrapper
def analyze_architecture(path):
return PropertyGraphIndex.from_documents(
SimpleDirectoryReader(path).load_data()
).as_query_engine().query("extract architecture")- Download CodeHierarchyAgentPack and replace enterprise_architecture.py
- Test if llamaindex-cli can work with our Qdrant setup
- Add SubQuestionQueryEngine for complex queries
- Add RouterQueryEngine for automatic index selection
- Document which approach to use for each feature
- CLI: 0 lines of code, but limited to chromadb
- SDK One-liners: 1-3 lines per feature, works with Qdrant
- Custom Python: 100+ lines, maintenance burden
Decision: Use SDK one-liners as our primary pattern since CLI doesn't support Qdrant.