You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For backward compatibility, converters are added new "_async" methods, in complement of the original (sync). Sync method is marked deprecated. Youtube converted is executed in a thread context (the lib isn't natively async) and OpenAI integration use the AsyncOpenAI class, also marking sync class as deprecated.
Copy file name to clipboardExpand all lines: README.md
+25-22Lines changed: 25 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,37 +9,39 @@
9
9
10
10
> [!IMPORTANT]
11
11
> Breaking changes between 0.0.1 to 0.1.0:
12
-
> * Dependencies are now organized into optional feature-groups (further details below). Use `pip install 'markitdown[all]'` to have backward-compatible behavior.
12
+
>
13
+
> * Dependencies are now organized into optional feature-groups (further details below). Use `pip install 'markitdown[all]'` to have backward-compatible behavior.
13
14
> * convert\_stream() now requires a binary file-like object (e.g., a file opened in binary mode, or an io.BytesIO object). This is a breaking change from the previous version, where it previously also accepted text file-like objects, like io.StringIO.
14
15
> * The DocumentConverter class interface has changed to read from file-like streams rather than file paths. *No temporary files are created anymore*. If you are the maintainer of a plugin, or custom DocumentConverter, you likely need to update your code. Otherwise, if only using the MarkItDown class or CLI (as in these examples), you should not need to change anything.
15
16
16
17
MarkItDown is a lightweight Python utility for converting various files to Markdown for use with LLMs and related text analysis pipelines. To this end, it is most comparable to [textract](https://github.com/deanmalmgren/textract), but with a focus on preserving important document structure and content as Markdown (including: headings, lists, tables, links, etc.) While the output is often reasonably presentable and human-friendly, it is meant to be consumed by text analysis tools -- and may not be the best option for high-fidelity document conversions for human consumption.
17
18
18
19
MarkItDown currently supports the conversion from:
19
20
20
-
- PDF
21
-
- PowerPoint
22
-
- Word
23
-
- Excel
24
-
- Images (EXIF metadata and OCR)
25
-
- Audio (EXIF metadata and speech transcription)
26
-
- HTML
27
-
- Text-based formats (CSV, JSON, XML)
28
-
- ZIP files (iterates over contents)
29
-
- Youtube URLs
30
-
- EPubs
31
-
- ... and more!
21
+
* PDF
22
+
* PowerPoint
23
+
* Word
24
+
* Excel
25
+
* Images (EXIF metadata and OCR)
26
+
* Audio (EXIF metadata and speech transcription)
27
+
* HTML
28
+
* Text-based formats (CSV, JSON, XML)
29
+
* ZIP files (iterates over contents)
30
+
* Youtube URLs
31
+
* EPubs
32
+
* ... and more!
32
33
33
34
## Why Markdown?
34
35
35
36
Markdown is extremely close to plain text, with minimal markup or formatting, but still
36
37
provides a way to represent important document structure. Mainstream LLMs, such as
37
-
OpenAI's GPT-4o, natively "_speak_" Markdown, and often incorporate Markdown into their
38
+
OpenAI's GPT-4o, natively "*speak*" Markdown, and often incorporate Markdown into their
38
39
responses unprompted. This suggests that they have been trained on vast amounts of
39
40
Markdown-formatted text, and understand it well. As a side benefit, Markdown conventions
40
41
are also highly token-efficient.
41
42
42
43
## Prerequisites
44
+
43
45
MarkItDown requires Python 3.10 or higher. It is recommended to use a virtual environment to avoid dependency conflicts.
44
46
45
47
With the standard Python installation, you can create and activate a virtual environment using the following commands:
MarkItDown has optional dependencies for activating various file formats. Earlier in this document, we installed all optional dependencies with the `[all]` option. However, you can also install them individually for more control. For example:
99
102
100
103
```bash
@@ -144,7 +147,7 @@ More information about how to set up an Azure Document Intelligence Resource can
144
147
145
148
### Python API
146
149
147
-
Basic usage in Python:
150
+
Basic usage in Python. All functions are available in async and sync versions:
148
151
149
152
```python
150
153
from markitdown import MarkItDown
@@ -164,13 +167,13 @@ result = md.convert("test.pdf")
164
167
print(result.text_content)
165
168
```
166
169
167
-
To use Large Language Models for image descriptions, provide `llm_client` and `llm_model`:
170
+
To use Large Language Models for image descriptions, provide `llm_client`(AsyncOpenAI) and `llm_model` (str), and enable the `[openai]` optional dependency group:
0 commit comments