Source: http://www.poma-ai.com/docs/sdk/integrations/llamaindex

# LlamaIndex Integration

LlamaIndex's built-in `SentenceSplitter` and `HierarchicalNodeParser` handle basic chunking, but they still produce isolated text fragments without structural context. POMA's LlamaIndex integration replaces the parsing step with **chunkset nodes** — structure-aware units that preserve the full document hierarchy from section headers down to individual sentences.

The integration provides drop-in replacements for LlamaIndex's document loading, node parsing, and retrieval steps — your existing index and query engine code stays the same.

## Installation

Install the integration:

```bash
pip install 'poma[llamaindex]'
```

The LlamaIndex integration gives you three helpers:

- `PomaFileReader` to load supported files into `Document` objects
- `PomaChunksetNodeParser` to turn documents into structure-aware nodes
- `PomaCheatsheetRetrieverLI` to wrap an existing retriever and return cheatsheet nodes

## Parse documents into chunkset nodes

```python
from poma import PrimeCut
from poma.integrations.llamaindex import PomaFileReader, PomaChunksetNodeParser

client = PrimeCut()
documents = PomaFileReader().load_data("./docs")
parser = PomaChunksetNodeParser(client=client)
nodes = parser.get_nodes_from_documents(documents, show_progress=True)

print(len(nodes))
print(nodes[0].metadata.keys())
```

Each node keeps the original chunkset data and the matching chunks in metadata.
The parser expects each input document to carry a valid `metadata["source_path"]`.

## Wrap an existing retriever

```python
from llama_index.core import VectorStoreIndex
from poma.integrations.llamaindex import PomaCheatsheetRetrieverLI

index = VectorStoreIndex(nodes)
base_retriever = index.as_retriever(similarity_top_k=4)
retriever = PomaCheatsheetRetrieverLI(base_retriever)

response = retriever.as_query_engine().query("How do I authenticate?")
print(str(response))
```

`PomaCheatsheetRetrieverLI` groups hits by document and returns a structure-preserving cheatsheet per document.

## Why replace SentenceSplitter?

LlamaIndex's `SentenceSplitter` and even `HierarchicalNodeParser` still treat documents as flat text — they pick better cut points, but the resulting nodes are still isolated fragments without structural context. POMA's `PomaChunksetNodeParser` preserves the document's hierarchy as chunkset nodes, so retrieval returns facts with their full lineage (section → subsection → paragraph). The result is retrieval that keeps its context and [needs far less of it per answer](/document-ingestion-chunking-rag).

For a detailed comparison of all chunking strategies, see [The Ultimate Guide to RAG Chunking Strategies](/rag-chunking-strategies-text-splitters).

## Continue reading

- [LangChain integration](/sdk/integrations/langchain) — same approach for LangChain pipelines
- [Quickstart](/sdk/getting-started/quickstart) — get started with PrimeCut in 4 lines
- [Chunking strategies comparison](/rag-chunking-strategies-text-splitters) — SentenceSplitter vs. all alternatives
- [Pricing](https://www.poma-ai.com/pricing) — PrimeCut Adaptive: 1 credit per page, minute, or 1,000 tokens extracted (whichever is more); 1 credit = €0.01, easy jobs cost less