Name | llama-index-readers-docling JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | llama-index readers docling integration |
upload_time | 2025-02-11 04:47:42 |
maintainer | None |
docs_url | None |
author | Panos Vagenas |
requires_python | <3.13,>=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Docling Reader
## Overview
Docling Reader uses [Docling](https://github.com/DS4SD/docling) to enable fast and easy extraction of PDF, DOCX, HTML, and other document types, into Markdown or JSON-serialized Docling format, for usage in LlamaIndex pipelines for RAG / QA etc.
## Installation
```console
pip install llama-index-readers-docling
```
## Usage
### Markdown export
By default, Docling Reader exports to Markdown. Basic usage looks like this:
```python
from llama_index.readers.docling import DoclingReader
reader = DoclingReader()
docs = reader.load_data(file_path="https://arxiv.org/pdf/2408.09869")
print(f"{docs[0].text[389:442]}...")
# > ## Abstract
# >
# > This technical report introduces Docling...
```
### JSON export
Docling Reader can also export Docling's native format to JSON:
```python
from llama_index.readers.docling import DoclingReader
reader = DoclingReader(export_type=DoclingReader.ExportType.JSON)
docs = reader.load_data(file_path="https://arxiv.org/pdf/2408.09869")
print(f"{docs[0].text[:53]}...")
# > {"schema_name": "DoclingDocument", "version": "1.0.0"...
```
> [!IMPORTANT]
> To appropriately parse Docling's native format, when using JSON export make sure
> to use a Docling Node Parser in your pipeline.
### With Simple Directory Reader
The Docling Reader can also be used directly in combination with Simple Directory Reader, for example:
```python
from llama_index.core import SimpleDirectoryReader
dir_reader = SimpleDirectoryReader(
input_dir="/path/to/docs",
file_extractor={".pdf": reader},
)
docs = dir_reader.load_data()
print(docs[0].metadata)
# > {'file_path': '/path/to/docs/2408.09869v3.pdf',
# > 'file_name': '2408.09869v3.pdf',
# > 'file_type': 'application/pdf',
# > 'file_size': 5566574,
# > 'creation_date': '2024-10-06',
# > 'last_modified_date': '2024-10-03'}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-docling",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Panos Vagenas",
"author_email": "pva@zurich.ibm.com",
"download_url": "https://files.pythonhosted.org/packages/c7/97/de0a01f45892edbd623c905549cc301197ea4363cce430ffdd082cb8a450/llama_index_readers_docling-0.3.1.tar.gz",
"platform": null,
"description": "# Docling Reader\n\n## Overview\n\nDocling Reader uses [Docling](https://github.com/DS4SD/docling) to enable fast and easy extraction of PDF, DOCX, HTML, and other document types, into Markdown or JSON-serialized Docling format, for usage in LlamaIndex pipelines for RAG / QA etc.\n\n## Installation\n\n```console\npip install llama-index-readers-docling\n```\n\n## Usage\n\n### Markdown export\n\nBy default, Docling Reader exports to Markdown. Basic usage looks like this:\n\n```python\nfrom llama_index.readers.docling import DoclingReader\n\nreader = DoclingReader()\ndocs = reader.load_data(file_path=\"https://arxiv.org/pdf/2408.09869\")\nprint(f\"{docs[0].text[389:442]}...\")\n# > ## Abstract\n# >\n# > This technical report introduces Docling...\n```\n\n### JSON export\n\nDocling Reader can also export Docling's native format to JSON:\n\n```python\nfrom llama_index.readers.docling import DoclingReader\n\nreader = DoclingReader(export_type=DoclingReader.ExportType.JSON)\ndocs = reader.load_data(file_path=\"https://arxiv.org/pdf/2408.09869\")\nprint(f\"{docs[0].text[:53]}...\")\n# > {\"schema_name\": \"DoclingDocument\", \"version\": \"1.0.0\"...\n```\n\n> [!IMPORTANT]\n> To appropriately parse Docling's native format, when using JSON export make sure\n> to use a Docling Node Parser in your pipeline.\n\n### With Simple Directory Reader\n\nThe Docling Reader can also be used directly in combination with Simple Directory Reader, for example:\n\n```python\nfrom llama_index.core import SimpleDirectoryReader\n\ndir_reader = SimpleDirectoryReader(\n input_dir=\"/path/to/docs\",\n file_extractor={\".pdf\": reader},\n)\ndocs = dir_reader.load_data()\nprint(docs[0].metadata)\n# > {'file_path': '/path/to/docs/2408.09869v3.pdf',\n# > 'file_name': '2408.09869v3.pdf',\n# > 'file_type': 'application/pdf',\n# > 'file_size': 5566574,\n# > 'creation_date': '2024-10-06',\n# > 'last_modified_date': '2024-10-03'}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers docling integration",
"version": "0.3.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1de5972c698596b2d9e44a2a7aeeae40b7a88159f852fe7eeb468af96daa5a06",
"md5": "6823a2ca1dd86ea970c15e9cd85cf98b",
"sha256": "637bb53a6fcbec55fa047ff5b945be3f6bb945673b6c906fc2d3f6c0dc57d74c"
},
"downloads": -1,
"filename": "llama_index_readers_docling-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6823a2ca1dd86ea970c15e9cd85cf98b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 3759,
"upload_time": "2025-02-11T04:47:40",
"upload_time_iso_8601": "2025-02-11T04:47:40.409099Z",
"url": "https://files.pythonhosted.org/packages/1d/e5/972c698596b2d9e44a2a7aeeae40b7a88159f852fe7eeb468af96daa5a06/llama_index_readers_docling-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c797de0a01f45892edbd623c905549cc301197ea4363cce430ffdd082cb8a450",
"md5": "3880d5627e196301cd153712a50c91cf",
"sha256": "ad3cfa651d020a96518760ff1b8deb388626b70e5d34f1527352cecb30667310"
},
"downloads": -1,
"filename": "llama_index_readers_docling-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "3880d5627e196301cd153712a50c91cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 3430,
"upload_time": "2025-02-11T04:47:42",
"upload_time_iso_8601": "2025-02-11T04:47:42.118592Z",
"url": "https://files.pythonhosted.org/packages/c7/97/de0a01f45892edbd623c905549cc301197ea4363cce430ffdd082cb8a450/llama_index_readers_docling-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 04:47:42",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-docling"
}