Metadata-Version: 2.5
Name: pdfluent-haystack
Version: 0.1.0
Summary: Haystack converter for PDFluent: PDFs to structure-aware Document chunks with page, box and kind, with the local engine or the hosted API.
Project-URL: Homepage, https://pdfluent.com
Project-URL: Documentation, https://pdfluent.com/docs
Project-URL: Pricing, https://pdfluent.com/sdk/pricing
Project-URL: Repository, https://github.com/pdfluent/pdfluent-sdk
Project-URL: Bug Tracker, https://github.com/pdfluent/pdfluent-sdk/issues
Author-email: "Innovation Trigger B.V." <team@pdfluent.com>
License-Expression: MIT
License-File: LICENSE
Keywords: converter,haystack,pdf,pdfluent,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Requires-Python: >=3.9
Requires-Dist: haystack-ai>=2.0
Provides-Extra: local
Requires-Dist: pdfluent>=1.2.0; extra == 'local'
Description-Content-Type: text/markdown

# pdfluent-haystack

A [Haystack](https://haystack.deepset.ai) converter for [PDFluent](https://pdfluent.com). It reads a
PDF into structure-aware `Document` chunks in reading order, each with the page, box and kind it came
from in its `meta`, so an answer can cite its source.

## Install

```bash
pip install pdfluent-haystack            # hosted API mode
pip install "pdfluent-haystack[local]"   # also the local engine
```

## Two modes

Local mode works today. API mode needs the hosted PDFluent API, which is not generally available yet.

```python
from pdfluent_haystack import PDFluentConverter

# Local: the engine runs on this machine and the PDF does not leave it.
docs = PDFluentConverter().run(sources=["report.pdf"])["documents"]

# API: with a key (or PDFLUENT_API_KEY) the PDF is sent to the hosted PDFluent API for that call.
# The service keeps no document. Chunking options are API-only: by_title, basic, by_page.
docs = PDFluentConverter(api_key="...", chunking_strategy="by_title").run(sources=["report.pdf"])["documents"]
```

`sources` takes paths or `ByteStream` objects. `meta` is merged into every document of a source.
Pages count from 0, as in the other PDFluent loaders. The key is read from the argument or the
environment, sent in the `x-api-key` header, and never appears in a repr or an error.

## Licence

This integration is MIT licensed; see `LICENSE`. The PDFluent SDK it calls in local mode (`pdfluent` on PyPI) is licensed separately, under AGPL-3.0 or a commercial licence.
