deepset-ai--haystack
c56bef871b
CodeQL / Analyze (python) (push) Has been cancelled
Update Platform Components Table / update (push) Has been cancelled
Docker image release / Build base image (push) Has been cancelled
Sync docs with Docusaurus / sync (push) Has been cancelled
Tests / Check if changed (push) Has been cancelled
Tests / format (push) Has been cancelled
Tests / check-imports (push) Has been cancelled
Tests / Unit / macos-latest (push) Has been cancelled
Tests / Unit / ubuntu-latest (push) Has been cancelled
Tests / Unit / windows-latest (push) Has been cancelled
Tests / mypy (push) Has been cancelled
Tests / Integration / ubuntu-latest (push) Has been cancelled
Tests / Integration / macos-latest (push) Has been cancelled
Tests / Integration / windows-latest (push) Has been cancelled
Tests / notify-slack-on-failure (push) Has been cancelled
Tests / Mark tests as completed (push) Has been cancelled
62 行
1.8 KiB
Markdown
62 行
1.8 KiB
Markdown
---
|
|
title: "Markitdown"
|
|
id: integrations-markitdown
|
|
description: "Markitdown integration for Haystack"
|
|
slug: "/integrations-markitdown"
|
|
---
|
|
|
|
|
|
## haystack_integrations.components.converters.markitdown.markitdown_converter
|
|
|
|
### MarkItDownConverter
|
|
|
|
Converts files to Haystack Documents using [MarkItDown](https://github.com/microsoft/markitdown).
|
|
|
|
MarkItDown is a Microsoft library that converts many file formats to Markdown,
|
|
including PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx), HTML, images,
|
|
audio, and more. All processing is performed locally.
|
|
|
|
### Usage example
|
|
|
|
```python
|
|
from haystack_integrations.components.converters.markitdown import MarkItDownConverter
|
|
|
|
converter = MarkItDownConverter()
|
|
result = converter.run(sources=["document.pdf", "report.docx"])
|
|
documents = result["documents"]
|
|
```
|
|
|
|
#### __init__
|
|
|
|
```python
|
|
__init__(store_full_path: bool = False) -> None
|
|
```
|
|
|
|
Initializes the MarkItDownConverter.
|
|
|
|
**Parameters:**
|
|
|
|
- **store_full_path** (<code>bool</code>) – If `True`, the full file path is stored in the Document metadata.
|
|
If `False`, only the file name is stored. Defaults to `False`.
|
|
|
|
#### run
|
|
|
|
```python
|
|
run(
|
|
sources: list[str | Path | ByteStream],
|
|
meta: dict[str, Any] | list[dict[str, Any]] | None = None,
|
|
) -> dict[str, list[Document]]
|
|
```
|
|
|
|
Converts files to Documents using MarkItDown.
|
|
|
|
**Parameters:**
|
|
|
|
- **sources** (<code>list\[str | Path | ByteStream\]</code>) – List of file paths or ByteStream objects to convert.
|
|
- **meta** (<code>dict\[str, Any\] | list\[dict\[str, Any\]\] | None</code>) – Optional metadata to attach to the Documents. Can be a single dict
|
|
applied to all Documents, or a list of dicts aligned with `sources`.
|
|
|
|
**Returns:**
|
|
|
|
- <code>dict\[str, list\[Document\]\]</code> – A dictionary with key `documents` containing the converted Documents.
|