Skip to content

ingest

diapason.tools.storage.ingest

Document ingestion — file reading, type detection, directory walking.

DocumentMeta dataclass

Metadata about an ingested document.

detect_file_type(path)

Map a file extension to one of: text, markdown, pdf, code.

ingest_path(path, *, config=None)

Ingest a file or directory into chunks.

If path is a file, reads and chunks it. If path is a directory, recursively walks it (skipping hidden and common non-content directories) and chunks each file.

read_document(path)

Read a file and return (text, metadata).

Raises

ImportError If the file is a PDF and pdfplumber is not installed. FileNotFoundError If path does not exist.