Layoutir
LayoutIRReader #
Bases: BasePydanticReader
LayoutIR Reader.
Production-grade document ingestion engine using LayoutIR's compiler-like architecture. Processes PDFs and documents through IR (Intermediate Representation) to preserve complex layouts, tables, and multi-column structures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_gpu
|
bool
|
Whether to use GPU acceleration. Defaults to False. |
required |
api_key
|
Optional[str]
|
API key for remote processing. Defaults to None. |
required |
model_name
|
Optional[str]
|
Model name to use for processing. Defaults to None. |
required |
chunk_strategy
|
str
|
Chunking strategy to use. Options: "semantic", "fixed". Defaults to "semantic". |
required |
max_heading_level
|
int
|
Maximum heading level for semantic chunking. Defaults to 2. |
required |
Source code in .build/python/llama-index-integrations/readers/llama-index-readers-layoutir/llama_index/readers/layoutir/base.py
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
lazy_load_data #
lazy_load_data(
file_path: Union[str, Path, List[str], List[Path]],
extra_info: Optional[Dict[str, Any]] = None,
) -> Iterable[Document]
Lazily load documents from given file path(s) using LayoutIR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Union[str, Path, List[str], List[Path]]
|
Path to PDF/document file(s). |
required |
extra_info
|
Optional[Dict[str, Any]]
|
Additional metadata to include. Defaults to None. |
None
|
Yields:
| Name | Type | Description |
|---|---|---|
Document |
Iterable[Document]
|
LlamaIndex Document objects with preserved layout structure. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If GPU is requested but PyTorch is not installed. |
Source code in .build/python/llama-index-integrations/readers/llama-index-readers-layoutir/llama_index/readers/layoutir/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
options: members: - LayoutIRReader