llamaindex
LlamaIndex 0.12+ for RAG and agent applications. Covers Document/Node model, IngestionPipeline, NodeParser variants, VectorStoreIndex, query engines, sub-question decomposition, router engines, Property Graph Index, LlamaParse integration, and observability callbacks. USE WHEN: user mentions "LlamaIndex", "llama_index", "VectorStoreIndex", "IngestionPipeline", "PropertyGraphIndex", "LlamaParse", "SubQuestionQueryEngine" DO NOT USE FOR: LangChain specifics - use `langchain`; RAG architecture theory - use `rag-patterns`; DSPy compiler workflows - use `dspy`
What this skill does
# LlamaIndex
## Installation
```bash
pip install llama-index # meta package
pip install llama-index-llms-anthropic
pip install llama-index-embeddings-openai
pip install llama-index-vector-stores-chroma
pip install llama-parse
```
## Global Settings
```python
from llama_index.core import Settings
from llama_index.llms.anthropic import Anthropic
from llama_index.embeddings.openai import OpenAIEmbedding
Settings.llm = Anthropic(model="claude-sonnet-4-20250514")
Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-small")
Settings.chunk_size = 1024
Settings.chunk_overlap = 200
```
## Documents and Nodes
```python
from llama_index.core import Document
from llama_index.core.schema import TextNode, NodeRelationship, RelatedNodeInfo
doc = Document(
text="...",
metadata={"source": "manual.pdf", "page": 3},
excluded_embed_metadata_keys=["source"], # keep out of embedding input
excluded_llm_metadata_keys=[],
)
node = TextNode(
text="chunk text",
metadata={"page": 3},
relationships={NodeRelationship.SOURCE: RelatedNodeInfo(node_id=doc.doc_id)},
)
```
## SimpleDirectoryReader
```python
from llama_index.core import SimpleDirectoryReader
docs = SimpleDirectoryReader(
input_dir="./data",
recursive=True,
required_exts=[".pdf", ".md", ".txt"],
filename_as_id=True,
).load_data()
```
## IngestionPipeline (with caching + dedup)
```python
from llama_index.core.ingestion import IngestionPipeline, IngestionCache
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.extractors import TitleExtractor, QuestionsAnsweredExtractor
from llama_index.vector_stores.chroma import ChromaVectorStore
from llama_index.core.storage.docstore import SimpleDocumentStore
import chromadb
chroma_client = chromadb.PersistentClient(path="./chroma")
vector_store = ChromaVectorStore(chroma_collection=chroma_client.get_or_create_collection("kb"))
pipeline = IngestionPipeline(
transformations=[
SentenceSplitter(chunk_size=1024, chunk_overlap=200),
TitleExtractor(nodes=5),
QuestionsAnsweredExtractor(questions=3),
Settings.embed_model,
],
vector_store=vector_store,
docstore=SimpleDocumentStore(), # enables upsert + dedup
cache=IngestionCache(),
)
nodes = pipeline.run(documents=docs, show_progress=True)
pipeline.persist("./pipeline_storage")
```
## NodeParser Variants
```python
from llama_index.core.node_parser import (
SentenceSplitter,
SentenceWindowNodeParser,
SemanticSplitterNodeParser,
MarkdownNodeParser,
HierarchicalNodeParser,
CodeSplitter,
)
sentence = SentenceSplitter(chunk_size=512, chunk_overlap=50)
window = SentenceWindowNodeParser.from_defaults(window_size=3,
window_metadata_key="window", original_text_metadata_key="original_text")
semantic = SemanticSplitterNodeParser(
buffer_size=1, breakpoint_percentile_threshold=95, embed_model=Settings.embed_model)
md = MarkdownNodeParser()
hierarchical = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
code = CodeSplitter(language="python", chunk_lines=40, chunk_lines_overlap=10, max_chars=1500)
```
## VectorStoreIndex and Query Engine
```python
from llama_index.core import VectorStoreIndex, StorageContext
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex(nodes=nodes, storage_context=storage_context)
query_engine = index.as_query_engine(
similarity_top_k=5,
response_mode="compact", # compact | refine | tree_summarize | simple_summarize
streaming=True,
)
streaming_response = query_engine.query("How does authentication work?")
for token in streaming_response.response_gen:
print(token, end="")
```
### Retriever + Response Synthesizer (explicit)
```python
from llama_index.core import get_response_synthesizer
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.core.postprocessor import SimilarityPostprocessor
from llama_index.core.retrievers import VectorIndexRetriever
retriever = VectorIndexRetriever(index=index, similarity_top_k=10)
synth = get_response_synthesizer(response_mode="tree_summarize", streaming=True)
engine = RetrieverQueryEngine(
retriever=retriever,
response_synthesizer=synth,
node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=0.7)],
)
```
## Sub-Question Query Engine
```python
from llama_index.core.query_engine import SubQuestionQueryEngine
from llama_index.core.tools import QueryEngineTool, ToolMetadata
tools = [
QueryEngineTool(
query_engine=finance_index.as_query_engine(),
metadata=ToolMetadata(name="finance", description="Financial reports 2022-2024"),
),
QueryEngineTool(
query_engine=product_index.as_query_engine(),
metadata=ToolMetadata(name="product", description="Product documentation"),
),
]
sub_q = SubQuestionQueryEngine.from_defaults(
query_engine_tools=tools,
use_async=True,
verbose=True,
)
answer = sub_q.query("Compare 2023 revenue with product launch timeline")
```
## Router Query Engine
```python
from llama_index.core.query_engine import RouterQueryEngine
from llama_index.core.selectors import LLMSingleSelector, PydanticMultiSelector
router = RouterQueryEngine(
selector=LLMSingleSelector.from_defaults(),
query_engine_tools=tools,
verbose=True,
)
```
## Property Graph Index
```python
from llama_index.core import PropertyGraphIndex
from llama_index.core.indices.property_graph import (
SimpleLLMPathExtractor,
ImplicitPathExtractor,
SchemaLLMPathExtractor,
)
schema_extractor = SchemaLLMPathExtractor(
llm=Settings.llm,
possible_entities=["PERSON", "ORG", "PRODUCT"],
possible_relations=["WORKS_AT", "MAKES", "COMPETES_WITH"],
)
graph_index = PropertyGraphIndex.from_documents(
docs,
kg_extractors=[schema_extractor, ImplicitPathExtractor()],
show_progress=True,
)
graph_index.storage_context.persist(persist_dir="./graph_store")
graph_engine = graph_index.as_query_engine(include_text=True, similarity_top_k=5)
```
## Agents with Tools (FunctionAgent / ReActAgent)
```python
from llama_index.core.agent.workflow import FunctionAgent, AgentWorkflow
from llama_index.core.tools import FunctionTool
def get_weather(city: str) -> str:
"""Return current weather for a city."""
return f"Sunny in {city}"
weather_tool = FunctionTool.from_defaults(fn=get_weather)
agent = FunctionAgent(
tools=[weather_tool],
llm=Settings.llm,
system_prompt="You are a helpful assistant.",
)
import asyncio
async def main():
result = await agent.run("What is the weather in Rome?")
print(result)
asyncio.run(main())
```
## LlamaParse Integration
```python
from llama_parse import LlamaParse
from llama_index.core import VectorStoreIndex
import os
parser = LlamaParse(
api_key=os.environ["LLAMA_CLOUD_API_KEY"],
result_type="markdown",
premium_mode=True,
)
docs = parser.load_data("10k.pdf")
index = VectorStoreIndex.from_documents(docs)
```
## Observability (Callbacks)
```python
from llama_index.core.callbacks import CallbackManager, LlamaDebugHandler, TokenCountingHandler
import tiktoken
debug = LlamaDebugHandler(print_trace_on_end=True)
token_counter = TokenCountingHandler(
tokenizer=tiktoken.encoding_for_model("gpt-4o").encode,
verbose=True,
)
Settings.callback_manager = CallbackManager([debug, token_counter])
# After a query:
print("Embed tokens:", token_counter.total_embedding_token_count)
print("LLM prompt tokens:", token_counter.prompt_llm_token_count)
print("LLM completion tokens:", token_counter.completion_llm_token_count)
```
### Arize Phoenix / OpenTelemetry
```python
import llama_index.core
llama_index.core.set_global_handler("arize_phoenix")
# Launch Phoenix UI: import phoenix as px; px.launch_app()
```
## Persistence and Reload
```python
from llama_index.core import load_index_from_storage, StorageContext
index.stoRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.