Name | llama-index-readers-docling JSON |
Version |
0.2.1
JSON |
| download |
home_page | None |
Summary | llama-index readers docling integration |
upload_time | 2024-10-27 21:25:23 |
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/b8/0c/2b3c6f18afcdb92a41dadb0ef25bd49780240c1c4fee328b67db7293b8e0/llama_index_readers_docling-0.2.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.2.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df7f6a9df95f2bb17609bf62eecc3ff1d753b3dc417b065024e8401fb1c76e32",
"md5": "6164bb9c9ee8294e7ad5e47bf2cccd06",
"sha256": "f64189a83fe7749219b5d75315596df12d9cd3a7e20de5a1c277122f28270f90"
},
"downloads": -1,
"filename": "llama_index_readers_docling-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6164bb9c9ee8294e7ad5e47bf2cccd06",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 3722,
"upload_time": "2024-10-27T21:25:22",
"upload_time_iso_8601": "2024-10-27T21:25:22.411645Z",
"url": "https://files.pythonhosted.org/packages/df/7f/6a9df95f2bb17609bf62eecc3ff1d753b3dc417b065024e8401fb1c76e32/llama_index_readers_docling-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b80c2b3c6f18afcdb92a41dadb0ef25bd49780240c1c4fee328b67db7293b8e0",
"md5": "e75fd8bb04ef250f4db4cfd0eb22f28a",
"sha256": "f30b3af6892fb2192a1fc7df03a96ef5cbac21c8dfd76a99144d46ee59e381ed"
},
"downloads": -1,
"filename": "llama_index_readers_docling-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "e75fd8bb04ef250f4db4cfd0eb22f28a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 3400,
"upload_time": "2024-10-27T21:25:23",
"upload_time_iso_8601": "2024-10-27T21:25:23.864620Z",
"url": "https://files.pythonhosted.org/packages/b8/0c/2b3c6f18afcdb92a41dadb0ef25bd49780240c1c4fee328b67db7293b8e0/llama_index_readers_docling-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-27 21:25:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-docling"
}