ingest
ingest
¶
Document ingestion — file reading, type detection, directory walking.
Classes¶
DocumentMeta
dataclass
¶
Metadata about an ingested document.
Functions¶
detect_file_type
¶
Map a file extension to one of: text, markdown, pdf, docx, code.
Source code in src/openjarvis/tools/storage/ingest.py
read_document
¶
read_document(path: Path) -> Tuple[str, DocumentMeta]
Read a file and return (text, metadata).
| RAISES | DESCRIPTION |
|---|---|
ImportError
|
If the file is a PDF and |
FileNotFoundError
|
If path does not exist. |
OSError
|
If the file is a |
Source code in src/openjarvis/tools/storage/ingest.py
ingest_path
¶
ingest_path(path: Path, *, config: Optional[ChunkConfig] = None) -> List[Chunk]
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.
Source code in src/openjarvis/tools/storage/ingest.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |