DoclingServeConverter
Convert documents using a remote DoclingServe API endpoint, with no local ML dependencies required.
Key Features
- Converts PDFs, Office documents, HTML, and other supported formats via a remote DoclingServe server.
- Supports Markdown, plain text, and JSON export formats.
- Accepts local file paths,
ByteStreamobjects, and URL strings. - Supports synchronous and asynchronous (job polling) execution modes.
- Authenticates with secured DoclingServe instances via API key.
- Supports both
run()andrun_async()for non-blocking pipeline execution.
Configuration
- Deploy a DoclingServe instance.
- If your instance requires authentication, set the
DOCLING_SERVE_API_KEYenvironment variable. For instructions, see Create Secrets. - Configure
DoclingServeConverterin your pipeline YAML with thebase_urlof your DoclingServe instance.
Connections
DoclingServeConverter accepts file paths, URL strings, or ByteStream inputs as sources, and optional metadata as meta. It outputs a list of Document objects (documents) containing the converted content.
Connect the pipeline's file input to the sources input. Connect the documents output to DocumentSplitter, DocumentJoiner, or DocumentWriter for further processing.
Source Code
To check this component's source code, open converter.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
docling_serve_converter:
type: haystack_integrations.components.converters.docling_serve.converter.DoclingServeConverter
init_parameters:
base_url: http://localhost:5001
export_type: markdown
api_key:
type: env_var
env_vars:
- DOCLING_SERVE_API_KEY
strict: false
Using the Component in a Pipeline
# haystack-pipeline
components:
docling_serve_converter:
type: haystack_integrations.components.converters.docling_serve.converter.DoclingServeConverter
init_parameters:
base_url: http://localhost:5001
export_type: markdown
api_key:
type: env_var
env_vars:
- DOCLING_SERVE_API_KEY
strict: false
splitter:
type: haystack.components.preprocessors.document_splitter.DocumentSplitter
init_parameters:
split_by: word
split_length: 250
split_overlap: 30
writer:
type: haystack.components.writers.document_writer.DocumentWriter
init_parameters:
document_store:
type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
init_parameters:
hosts:
- ${OPENSEARCH_HOST}
index: docling-serve-demo
embedding_dim: 768
create_index: true
connections:
- sender: docling_serve_converter.documents
receiver: splitter.documents
- sender: splitter.documents
receiver: writer.documents
inputs:
files:
- docling_serve_converter.sources
max_runs_per_component: 100
metadata: {}
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
base_url | str | http://localhost:5001 | Base URL of the DoclingServe instance. |
export_type | str | markdown | Output format. One of markdown, text, or json. |
convert_options | dict | None | None | Additional conversion options passed to the DoclingServe API, such as {"do_ocr": true}. The to_formats key is set automatically and must not be included here. |
timeout | float | 120.0 | HTTP request timeout in seconds. |
api_key | Secret | None | Secret.from_env_var("DOCLING_SERVE_API_KEY", strict=False) | API key for a secured DoclingServe instance. Set to None to disable authentication. |
mode | str | sync | Conversion mode. sync uses synchronous endpoints. async submits jobs and polls for completion. |
poll_interval | float | 2.0 | Maximum sleep time in seconds between async job polls. Used in async mode only. |
job_timeout | float | 600.0 | Maximum time in seconds to wait for each async conversion job. Used in async mode only. |
Related Information
Was this page helpful?