llama-index-readers-smart-pdf-loader


Namellama-index-readers-smart-pdf-loader JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
Summaryllama-index readers smart_pdf_loader integration
upload_time2024-04-15 18:31:40
maintaineransukla
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords pdf layout pdf table pdf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Smart PDF Loader

```bash
pip install llama-index-readers-smart-pdf-loader
```

SmartPDFLoader is a super fast PDF reader that understands the layout structure of PDFs such as nested sections, nested lists, paragraphs and tables.
It uses layout information to smartly chunk PDFs into optimal short contexts for LLMs.

## Requirements

Install the llmsherpa library if it is not already present:

```
pip install llmsherpa
```

## Usage

Here's an example usage of the SmartPDFLoader:

```python
from llama_index.readers.smart_pdf_loader import SmartPDFLoader

llmsherpa_api_url = "https://readers.llmsherpa.com/api/document/developer/parseDocument?renderFormat=all"
pdf_url = "https://arxiv.org/pdf/1910.13461.pdf"  # also allowed is a file path e.g. /home/downloads/xyz.pdf
pdf_loader = SmartPDFLoader(llmsherpa_api_url=llmsherpa_api_url)
documents = pdf_loader.load_data(pdf_url)
```

Now you can use the documents with other LlamaIndex components. For example, for retrieval augmented generation, try this:

```python
from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()

response = query_engine.query("list all the tasks that work with bart")
print(response)

response = query_engine.query("what is the bart performance score on squad")
print(response)
```

## More Examples

SmartPDFLoader is based on LayoutPDFReader from [llmsherpa](https://github.com/nlmatics/llmsherpa) library. See the [documentation](<(https://github.com/nlmatics/llmsherpa)>) there to explore other ways to use the library for connecting data from your PDFs with LLMs.

- [Summarize a section using prompts](https://github.com/nlmatics/llmsherpa#summarize-a-section-using-prompts)
- [Analyze a table using prompts](https://github.com/nlmatics/llmsherpa#analyze-a-table-using-prompts)
- [Vector search and RAG](https://github.com/nlmatics/llmsherpa#vector-search-and-retrieval-augmented-generation-with-smart-chunking)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-readers-smart-pdf-loader",
    "maintainer": "ansukla",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": "pdf layout, pdf table, pdf",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/b0/05008a9c052b3cec0d12f53659b53489f773b3431647ae5da2ffa5118f33/llama_index_readers_smart_pdf_loader-0.1.4.tar.gz",
    "platform": null,
    "description": "# Smart PDF Loader\n\n```bash\npip install llama-index-readers-smart-pdf-loader\n```\n\nSmartPDFLoader is a super fast PDF reader that understands the layout structure of PDFs such as nested sections, nested lists, paragraphs and tables.\nIt uses layout information to smartly chunk PDFs into optimal short contexts for LLMs.\n\n## Requirements\n\nInstall the llmsherpa library if it is not already present:\n\n```\npip install llmsherpa\n```\n\n## Usage\n\nHere's an example usage of the SmartPDFLoader:\n\n```python\nfrom llama_index.readers.smart_pdf_loader import SmartPDFLoader\n\nllmsherpa_api_url = \"https://readers.llmsherpa.com/api/document/developer/parseDocument?renderFormat=all\"\npdf_url = \"https://arxiv.org/pdf/1910.13461.pdf\"  # also allowed is a file path e.g. /home/downloads/xyz.pdf\npdf_loader = SmartPDFLoader(llmsherpa_api_url=llmsherpa_api_url)\ndocuments = pdf_loader.load_data(pdf_url)\n```\n\nNow you can use the documents with other LlamaIndex components. For example, for retrieval augmented generation, try this:\n\n```python\nfrom llama_index.core import VectorStoreIndex\n\nindex = VectorStoreIndex.from_documents(documents)\nquery_engine = index.as_query_engine()\n\nresponse = query_engine.query(\"list all the tasks that work with bart\")\nprint(response)\n\nresponse = query_engine.query(\"what is the bart performance score on squad\")\nprint(response)\n```\n\n## More Examples\n\nSmartPDFLoader is based on LayoutPDFReader from [llmsherpa](https://github.com/nlmatics/llmsherpa) library. See the [documentation](<(https://github.com/nlmatics/llmsherpa)>) there to explore other ways to use the library for connecting data from your PDFs with LLMs.\n\n- [Summarize a section using prompts](https://github.com/nlmatics/llmsherpa#summarize-a-section-using-prompts)\n- [Analyze a table using prompts](https://github.com/nlmatics/llmsherpa#analyze-a-table-using-prompts)\n- [Vector search and RAG](https://github.com/nlmatics/llmsherpa#vector-search-and-retrieval-augmented-generation-with-smart-chunking)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index readers smart_pdf_loader integration",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "pdf layout",
        " pdf table",
        " pdf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eee91d25bb73b9b03c1d753f16b4b6d4a82cbeeff2fbe72ea7e337c971f1e648",
                "md5": "a9d58ed1c90f7bfe76fef7f0005e62ec",
                "sha256": "ba21a0ba8b46cd5a5f1205b4601147e469dccccac57de2902cab44794047f57a"
            },
            "downloads": -1,
            "filename": "llama_index_readers_smart_pdf_loader-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9d58ed1c90f7bfe76fef7f0005e62ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 3165,
            "upload_time": "2024-04-15T18:31:37",
            "upload_time_iso_8601": "2024-04-15T18:31:37.781919Z",
            "url": "https://files.pythonhosted.org/packages/ee/e9/1d25bb73b9b03c1d753f16b4b6d4a82cbeeff2fbe72ea7e337c971f1e648/llama_index_readers_smart_pdf_loader-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfb005008a9c052b3cec0d12f53659b53489f773b3431647ae5da2ffa5118f33",
                "md5": "58304b509ab85d34199096d8604459c6",
                "sha256": "40b135750612b175eea16297749946a82238776b398683fc6b1a605e7208300d"
            },
            "downloads": -1,
            "filename": "llama_index_readers_smart_pdf_loader-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "58304b509ab85d34199096d8604459c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2787,
            "upload_time": "2024-04-15T18:31:40",
            "upload_time_iso_8601": "2024-04-15T18:31:40.055272Z",
            "url": "https://files.pythonhosted.org/packages/cf/b0/05008a9c052b3cec0d12f53659b53489f773b3431647ae5da2ffa5118f33/llama_index_readers_smart_pdf_loader-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 18:31:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-readers-smart-pdf-loader"
}
        
Elapsed time: 0.22514s