| 112 | |
| 113 | |
| 114 | def _get_default_option(format: InputFormat) -> FormatOption: |
| 115 | format_to_default_options = { |
| 116 | InputFormat.XLSX: FormatOption( |
| 117 | pipeline_cls=SimplePipeline, backend=MsExcelDocumentBackend |
| 118 | ), |
| 119 | InputFormat.DOCX: FormatOption( |
| 120 | pipeline_cls=SimplePipeline, backend=MsWordDocumentBackend |
| 121 | ), |
| 122 | InputFormat.PPTX: FormatOption( |
| 123 | pipeline_cls=SimplePipeline, backend=MsPowerpointDocumentBackend |
| 124 | ), |
| 125 | InputFormat.MD: FormatOption( |
| 126 | pipeline_cls=SimplePipeline, backend=MarkdownDocumentBackend |
| 127 | ), |
| 128 | InputFormat.ASCIIDOC: FormatOption( |
| 129 | pipeline_cls=SimplePipeline, backend=AsciiDocBackend |
| 130 | ), |
| 131 | InputFormat.HTML: FormatOption( |
| 132 | pipeline_cls=SimplePipeline, backend=HTMLDocumentBackend |
| 133 | ), |
| 134 | InputFormat.XML_USPTO: FormatOption( |
| 135 | pipeline_cls=SimplePipeline, backend=PatentUsptoDocumentBackend |
| 136 | ), |
| 137 | InputFormat.XML_PUBMED: FormatOption( |
| 138 | pipeline_cls=SimplePipeline, backend=PubMedDocumentBackend |
| 139 | ), |
| 140 | InputFormat.IMAGE: FormatOption( |
| 141 | pipeline_cls=StandardPdfPipeline, backend=DoclingParseV2DocumentBackend |
| 142 | ), |
| 143 | InputFormat.PDF: FormatOption( |
| 144 | pipeline_cls=StandardPdfPipeline, backend=DoclingParseV2DocumentBackend |
| 145 | ), |
| 146 | InputFormat.JSON_DOCLING: FormatOption( |
| 147 | pipeline_cls=SimplePipeline, backend=DoclingJSONBackend |
| 148 | ), |
| 149 | } |
| 150 | if (options := format_to_default_options.get(format)) is not None: |
| 151 | return options |
| 152 | else: |
| 153 | raise RuntimeError(f"No default options configured for {format}") |
| 154 | |
| 155 | |
| 156 | class DocumentConverter: |