JSONPorter. This is useful for exporting your chunked data for use in other applications or for archiving.
Export Chonkie’s Chunks into a JSON file.
JSONPorter. This is useful for exporting your chunked data for use in other applications or for archiving.
from chonkie import JSONPorter
from chonkie.types.base import Chunk
chunks = [
Chunk(
id="chunk1",
text="This is the first chunk.",
metadata={"source": "document1.txt"}
),
Chunk(
id="chunk2",
text="This is the second chunk.",
metadata={"source": "document2.txt"}
)
]
porter = JSONPorter()
porter.export(chunks)
Was this page helpful?