Pdf Datasource
This module contains functionality related to the Pdf datasource.
Configuration
PDFDatasourceConfiguration
Bases: DatasourceConfiguration
Configuration for PDF data source.
This class defines the configuration parameters required for extracting data from PDF files. It inherits from the base DatasourceConfiguration class.
Source code in src/extraction/datasources/pdf/configuration.py
11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Document
PDFDocument
Bases: BaseDocument
Document representation for PDF file content.
Extends BaseDocument to handle PDF-specific document processing including metadata filtering for embeddings and LLM contexts.
Source code in src/extraction/datasources/pdf/document.py
4 5 6 7 8 9 10 11 | |
Manager
PDFDatasourceManagerFactory
Bases: Factory
Factory for creating datasource managers.
Provides type-safe creation of datasource managers based on configuration.
| Attributes: |
|
|---|
Source code in src/extraction/datasources/pdf/manager.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Parser
PDFDatasourceParser
Bases: BaseParser[PDFDocument]
Parser for PDF documents that converts them to structured PDFDocument objects.
Uses MarkItDown to convert PDF files to markdown format for easier processing.
Source code in src/extraction/datasources/pdf/parser.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
__init__(parser=MarkItDown())
Initialize the PDF parser.
| Attributes: |
|
|---|
Source code in src/extraction/datasources/pdf/parser.py
20 21 22 23 24 25 26 27 | |
parse(file_path)
Parses the given PDF file into a structured document.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/extraction/datasources/pdf/parser.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
PDFDatasourceParserFactory
Bases: Factory
Factory for creating PDF parser instances.
Creates and configures PDFDatasourceParser objects according to the provided configuration.
Source code in src/extraction/datasources/pdf/parser.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
Reader
PDFDatasourceReader
Bases: BaseReader
Source code in src/extraction/datasources/pdf/reader.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
__init__(configuration, logger=LoggerConfiguration.get_logger(__name__))
Initialize PDF reader.
| Parameters: |
|
|---|
Source code in src/extraction/datasources/pdf/reader.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
read_all_async()
async
Asynchronously yield PDF file paths from the configured directory.
Retrieves a list of PDF files from the base path, applies any configured export limit, and yields each file path individually.
| Returns: |
|
|---|
Source code in src/extraction/datasources/pdf/reader.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
PDFDatasourceReaderFactory
Bases: Factory
Factory for creating PDF reader instances.
Implements the factory pattern to produce configured PDFDatasourceReader objects based on the provided configuration settings.
Source code in src/extraction/datasources/pdf/reader.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |