Home Knowledge Base LLM Application Frameworks

LLM Application Frameworks

LangChain

Overview Most popular framework for building LLM applications. Provides abstractions for chains, agents, memory, and tools.

Key Components

ComponentPurpose
ChainsSequential LLM calls
AgentsDynamic tool selection
MemoryConversation history
RetrieversRAG integration
ToolsExternal capabilities

Example: ReAct Agent

from langchain.agents import create_react_agent
from langchain_openai import ChatOpenAI
from langchain.tools import WikipediaTool

llm = ChatOpenAI(model="gpt-4o")
tools = [WikipediaTool()]
agent = create_react_agent(llm, tools, prompt)

result = agent.invoke({"input": "What is the capital of France?"})

LlamaIndex

Overview Specialized for data-intensive LLM applications, particularly RAG. Excellent for indexing and querying documents.

Key Components

ComponentPurpose
DocumentsData containers
NodesChunked text units
IndicesSearch structures
Query EnginesRAG pipelines
Response SynthesizersAnswer generation

Example: RAG

from llama_index import VectorStoreIndex, SimpleDirectoryReader

# Load and index documents
documents = SimpleDirectoryReader("data/").load_data()
index = VectorStoreIndex.from_documents(documents)

# Query
query_engine = index.as_query_engine()
response = query_engine.query("What is the main topic?")

Comparison

FeatureLangChainLlamaIndex
Primary focusGeneral LLM appsData/RAG
Agent supportExcellentGood
RAG capabilitiesGoodExcellent
Community sizeLargestLarge
ComplexityHigherLower

Other Frameworks

FrameworkHighlights
HaystackProduction RAG
Semantic KernelMicrosoft, enterprise
DSPyPrompt optimization
CrewAIMulti-agent

When to Use

langchainllamaindexframework

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.