Persist a chunk tibble from docling_chunk() — optionally carrying the
embedding list-column added by docling_embed() — to a columnar file via
the arrow package. List-columns (headings, pages, doc_items,
embedding) are stored natively, so the file round-trips back to the same
shape with arrow::read_parquet() / arrow::read_feather() and is directly
queryable from 'Python', 'DuckDB', 'Spark' and other 'Arrow'-aware tools —
a convenient hand-off format for RAG indexing pipelines.
Arguments
- chunks
A data frame, typically from
docling_chunk()ordocling_embed().- path
Output file path. The format is chosen by extension:
.parquetwrites 'Parquet';.featheror.arrowwrite 'Feather' v2 (the 'Arrow' IPC format).- ...
Additional arguments passed on to
arrow::write_parquet()orarrow::write_feather()(for examplecompression).
Examples
if (FALSE) { # \dontrun{
doc <- docling_convert("paper.pdf")
chunks <- docling_chunk(doc, max_tokens = 512)
docling_write_chunks(chunks, "paper-chunks.parquet")
# Read back, or query from any Arrow-aware tool
arrow::read_parquet("paper-chunks.parquet")
} # }