Install the integration:
bash
pip install 'poma[llamaindex]'The LlamaIndex integration gives you three helpers:
PomaFileReaderto load supported files intoDocumentobjectsPomaChunksetNodeParserto turn documents into structure-aware nodesPomaCheatsheetRetrieverLIto 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.
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.