llamaindex
БесплатноБез исполняемых скриптовНе проверенLlamaIndex 0.12+ for RAG and agent applications. Covers Document/Node model, IngestionPipeline, NodeParser variants, VectorStoreIndex, query engines…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
LlamaIndex
Installation
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
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
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
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)
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
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
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)
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
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,
Установить llamaindex в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл 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`
Как установить скилл llamaindex?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл llamaindex запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic