cognee/cognee/tasks/documents/extract_chunks_from_documents.py
hajdul88 9e7ab6492a
feat: outsources chunking parameters to extract chunk from documents … (#289)
* feat: outsources chunking parameters to extract chunk from documents task
2024-12-17 11:31:31 +01:00

7 lines
349 B
Python

from cognee.modules.data.processing.document_types.Document import Document
async def extract_chunks_from_documents(documents: list[Document], chunk_size: int = 1024, chunker = 'text_chunker'):
for document in documents:
for document_chunk in document.read(chunk_size = chunk_size, chunker = chunker):
yield document_chunk