<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Rohan Singh on Medium]]></title>
        <description><![CDATA[Stories by Aditya Rohan Singh on Medium]]></description>
        <link>https://medium.com/@adityars_28497?source=rss-6ea0b614880d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Aditya Rohan Singh on Medium</title>
            <link>https://medium.com/@adityars_28497?source=rss-6ea0b614880d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:56:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityars_28497/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build modular document processing flows with Docling Pipelines and IBM Bob]]></title>
            <link>https://medium.com/@adityars_28497/build-modular-document-processing-flows-with-docling-pipelines-and-ibm-bob-8a215ed702f4?source=rss-6ea0b614880d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a215ed702f4</guid>
            <category><![CDATA[docling]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <dc:creator><![CDATA[Aditya Rohan Singh]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 06:25:55 GMT</pubDate>
            <atom:updated>2026-09-07T06:25:55.094Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build and Verify an AI-Ready Search Pipeline with Docling Pipelines and a coding agent</h3><p>Turn local documents into a searchable OpenSearch index using a declarative flow, Ollama embeddings, and a coding agent authoring and debugging the workflow.</p><p>By <a href="https://github.com/IBM/docling-pipelines">Docling-pipelines</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNuCRGU1JdoDPSyNBMwvbQ.png" /></figure><p><strong>Building a RAG demonstration is easy. Building a reliable document-processing path is not.</strong></p><p>Before an LLM can answer a question, PDFs, Word documents, HTML pages, and plain-text files must be ingested, extracted, cleaned, chunked, embedded, and indexed consistently. Real collections also introduce duplicate files, inconsistent formats, sensitive information, extraction failures, and changing model requirements.</p><p>The difficult part of many production RAG systems is not the final LLM call. It is preparing trustworthy, searchable data for that call.</p><p><a href="https://github.com/IBM/docling-pipelines">Docling Pipelines</a> addresses this problem with a declarative, operator-based framework. You describe the processing stages and their dependencies in a JSON flow; the framework handles validation, execution, data transport, progress reporting, and job tracking.</p><p>In this tutorial, you will:</p><ul><li>Install Docling Pipelines from PyPI.</li><li>Start Ollama and OpenSearch locally.</li><li>Use IBM Bob to author and validate a flow.</li><li>Ingest and process local documents.</li><li>Generate embeddings with nomic-embed-text.</li><li>Store document chunks in OpenSearch.</li><li>Verify keyword and semantic retrieval.</li><li>Generate an answer grounded in the indexed content.</li></ul><p>By the end, you will have more than a pipeline that reports COMPLETED: you will have evidence that its chunks, mapped fields, and embeddings can support retrieval.</p><h3>What Docling Pipelines provides</h3><p>Docling Pipelines is a modular framework for turning unstructured documents into structured, searchable data.</p><p>A pipeline is represented as a directed acyclic graph, or DAG. Each node is an operator, and each dependency determines when that operator can execute.</p><p>The operator registry includes 21 built-in operators covering:</p><ul><li>Document ingestion</li><li>Text and entity extraction</li><li>Chunking and embeddings</li><li>Language detection and readability</li><li>Classification and enrichment</li><li>Deduplication and redaction</li><li>Branching and merging</li><li>Access-control processing</li><li>Vector-database storage</li><li>Document-set storage</li></ul><p>Data moves between operators as Apache PyArrow tables. This provides a consistent, column-oriented schema and enables efficient operations where supported.</p><p>The Docling-pipelinesCLI and DocpipeFlowManager Python API execute the same flow through the orchestration layer. Local execution uses the Python orchestrator by default. Prefect-backed workpool orchestration is also available for distributed execution scenarios.</p><h3>The pipeline we will build</h3><p>Our tutorial uses five operators:</p><p>The stages perform the following work:</p><ol><li><strong>Ingest:</strong> Discover PDF and TXT files from a local directory.</li><li><strong>Extract:</strong> Convert each document into text using Docling.</li><li><strong>Chunk:</strong> Split the extracted content into retrieval-sized pieces.</li><li><strong>Embed:</strong> Generate a vector for every chunk using Ollama.</li><li><strong>Store:</strong> Write the text, metadata, and vectors into OpenSearch.</li></ol><p>IBM Bob will help us inspect the available operators, generate the initial flow, validate its structure, and diagnose failures. Docling Pipelines remains the execution engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ycef8hUYXGSjhnTWTEQa4g.png" /></figure><h3>Prerequisites</h3><p>You will need:</p><ul><li>Python &gt;=3.12,&lt;3.13</li><li>macOS or Linux</li><li><strong>pip</strong> or <strong>uv</strong> — standard Python package manager. This tutorial uses pip for simplicity; uv is recommended for faster installs.</li><li><a href="https://ollama.com/">Ollama</a> — local LLM server used for embeddings.</li><li><strong>Docker or Podman</strong> — to run OpenSearch for vector storage.</li><li><a href="https://bob.ibm.com/">IBM Bob</a> (Optional), if you want to follow the assisted authoring workflow. Or any other coding agent/Agent based IDE.</li><li>~5 GB free disk space for models and the Python environment.</li></ul><p>Confirm your python version</p><pre>python3.12 --version   # expected: Python 3.12.x</pre><h3><strong>Step 1 </strong>Install Docling Pipelines from PyPI</h3><p>Create an isolated Python 3.12 virtual environment and install it:</p><pre># Create and activate a virtual environment<br>python3.12 -m venv .venv<br>source .venv/bin/activate        # Windows: .venv\Scripts\activate<br># Install the package<br>pip install docling-pipelines</pre><p><strong><em>Faster installs with uv </em></strong><em>If you have </em><a href="https://docs.astral.sh/uv/"><em>uv</em></a><em> installed, replace the </em><em>pip install above with </em><em>uv pip install docling-pipelines. Dependency resolution is significantly faster.</em></p><p>Verify the CLI is available:</p><pre>docling-pipelines --help</pre><p>List all built-in operators to confirm the installation is complete:</p><pre>docling-pipelines --list-operators</pre><p>The verbose output is useful when authoring a flow because it exposes operator names, descriptions, and configuration details.</p><h3><strong>Step 2: </strong>Set up supporting services (Ollama + OpenSearch)</h3><h4>a. Install and start Ollama</h4><p>Ollama provides the local embedding model and the optional chat model used during verification.</p><p>Start the Ollama server in one terminal:</p><pre>ollama serve &amp;.              # Pull the embedding model used in this tutorial<br>ollama pull nomic-embed-text # Verify (should list nomic-embed-text)<br>ollama pull granite4<br>ollama list</pre><p>The pipeline uses nomic-embed-text to generate 768-dimensional embeddings. The verification script uses granite4 to answer a question from retrieved context.</p><p>Confirm that the Ollama API is available:</p><pre>curl http://localhost:11434/api/tags</pre><p>You should receive JSON containing the locally installed models.</p><h4>b. Start OpenSearch with Docker</h4><p>OpenSearch stores the indexed chunks and their vector embeddings.</p><p>The following command starts an OpenSearch 2.14 single-node container with HTTP TLS disabled for local development:</p><pre>export OPENSEARCH_PASSWORD=&#39;&lt;YOUR OPENSEARCH PASSWORD&gt;&#39;<br><br>docker run -d \<br>  --name docpipe-opensearch \<br>  -p 9200:9200 \<br>  -p 9600:9600 \<br>  -e &quot;discovery.type=single-node&quot; \<br>  -e &quot;plugins.security.disabled=false&quot; \<br>  -e &quot;plugins.security.ssl.http.enabled=false&quot; \<br>  -e &quot;plugins.security.ssl.transport.enabled=true&quot; \<br>  -e &quot;OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD}&quot; \<br>  -e &quot;OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m&quot; \<br>  opensearchproject/opensearch:2.14.0<br></pre><p>This configuration is intended only for local development. Use appropriate secret management, TLS, access controls, and persistence settings in shared or production environments.</p><p>Wait for OpenSearch to start, then inspect its health:</p><pre>curl -u &quot;admin:${OPENSEARCH_PASSWORD}&quot; \<br>  &#39;http://localhost:9200/_cluster/health?pretty&#39;</pre><p>Do not continue unless this request authenticates successfully. If an existing OpenSearch cluster was initialized with another password, update the credentials below to match that cluster or start a separate clean development instance.</p><p>A local single-node cluster may report `yellow` because it cannot assign replica shards. That is sufficient for this tutorial.</p><p><strong>Create a </strong><strong>.env file</strong></p><p>Docling Pipelines reads connection settings from the environment. Create a .env file in your project root:</p><pre>OPENSEARCH_HOST=localhost<br>OPENSEARCH_USE_SSL=false<br>OPENSEARCH_USERNAME=admin<br>OPENSEARCH_PASSWORD=&lt;YOUR OPENSEARCH PASSWORD&gt;</pre><h3>Step 3: Prepare sample documents</h3><p>Create a document directory:</p><pre>mkdir -p my_documents<br>cd my_documents</pre><p>Add two small text documents:</p><pre>cat &gt; my_documents/docling.txt &lt;&lt;&#39;EOF&#39;<br>Docling Pipelines is an operator-based framework for building document<br>processing workflows. A flow is represented as a directed acyclic graph.<br>Operators can ingest files, extract text, create chunks, generate embeddings,<br>and store the results in a vector database.<br>EOF<br><br><br><br>cat &gt; my_documents/retrieval.txt &lt;&lt;’EOF’<br>Retrieval-augmented generation uses retrieved information to ground a language<br>model response. Retrieval quality depends on document extraction, chunking,<br>metadata, embeddings, and the quality of the indexed source material.<br>EOF<br>```</pre><p>Using more than one sample gives the retrieval checks meaningful alternatives. You can replace these files with your own PDFs or text documents after completing the walkthrough.</p><h3><strong>Step 4: Write your first flow with IBM Bob/Agent</strong></h3><p>A Docling Pipelines flow is a JSON file that lists operator nodes and their dependencies. You can write it by hand or let IBM Bob generate it from a description. This step shows both approaches.</p><h4>Option A — Let IBM Bob generate the flow</h4><p>Open IBM Bob in <strong>Agent</strong> mode. Create a folder for your project, open it as a workspace, and prompt Bob:</p><pre>I am building a local document-indexing flow with the installed<br>docling-pipelines package.<br><br>Before creating the flow:<br><br>1. Run:<br>   docling-pipelines --list-operators --verbose<br><br>2. Inspect the current Docling Pipelines flow-authoring guide and the canonical<br>   Ollama/OpenSearch sample flow.<br><br>Create my_flow.json so that it:<br><br>- uses the current &quot;flow&quot; and &quot;depends_on&quot; authoring format<br>- ingests PDF and TXT files from ./my_documents<br>- uses ingest_source with the filesystem provider<br>- extracts text using the docling_library provider<br>- creates simple chunks with chunk_size 512 and chunk_overlap 50<br>- generates embeddings using nomic-embed-text through Ollama<br>- stores the result in a local OpenSearch index named my-docs-index<br>- maps doc_id_hash to pk<br>- maps content to text<br>- maps name to doc_name<br>- maps embeddings to vector_embeddings<br>- keeps validation enabled<br>- disables micro-batching for this small tutorial<br><br>After creating the file, run:<br><br>docling-pipelines --flow-file my_flow.json --validate<br><br>Explain every validation error or warning and correct the file before<br>executing it. Do not guess operator names or parameters; use the installed<br>operator metadata and canonical samples.</pre><p>This prompt gives Bob authoritative sources instead of asking it to recall the configuration from memory.</p><p>Bob can assist with generation and validation, but you should still review the resulting flow before executing it.</p><h4>Option B — Write the flow manually</h4><p>Create my_flow.json with the following content:</p><pre>{<br>  &quot;flow_name&quot;: &quot;my-document-pipeline&quot;,<br>  &quot;description&quot;: &quot;Ingest local documents, extract text, chunk content, create embeddings, and index the results in OpenSearch&quot;,<br>  &quot;global_config&quot;: {<br>    &quot;doc_column&quot;: &quot;content&quot;,<br>    &quot;disable_validation&quot;: false,<br>    &quot;force_ingest&quot;: true,<br>    &quot;storage&quot;: &quot;in-memory&quot;,<br>    &quot;execute_type&quot;: &quot;local&quot;,<br>    &quot;enable_micro_batching&quot;: false<br>  },<br>  &quot;flow&quot;: [<br>    {<br>      &quot;type&quot;: &quot;ingest_source&quot;,<br>      &quot;name&quot;: &quot;ingest&quot;,<br>      &quot;config&quot;: {<br>        &quot;provider&quot;: &quot;filesystem&quot;,<br>        &quot;connection_params&quot;: {<br>          &quot;paths&quot;: [<br>            &quot;./my_documents&quot;<br>          ]<br>        },<br>        &quot;include_filter&quot;: &quot;.pdf,.txt&quot;<br>      }<br>    },<br>    {<br>      &quot;type&quot;: &quot;extract_operator&quot;,<br>      &quot;name&quot;: &quot;extract&quot;,<br>      &quot;config&quot;: {<br>        &quot;text_extraction&quot;: {<br>          &quot;provider&quot;: &quot;docling_library&quot;,<br>          &quot;doc_column&quot;: &quot;content&quot;<br>        },<br>        &quot;entity_extraction&quot;: {<br>          &quot;provider&quot;: &quot;none&quot;<br>        }<br>      },<br>      &quot;depends_on&quot;: [<br>        &quot;ingest&quot;<br>      ]<br>    },<br>    {<br>      &quot;type&quot;: &quot;chunker&quot;,<br>      &quot;name&quot;: &quot;chunk&quot;,<br>      &quot;config&quot;: {<br>        &quot;chunk_type&quot;: &quot;simple&quot;,<br>        &quot;chunk_size&quot;: 512,<br>        &quot;chunk_overlap&quot;: 50,<br>        &quot;retain_original_content&quot;: false<br>      },<br>      &quot;depends_on&quot;: [<br>        &quot;extract&quot;<br>      ]<br>    },<br>    {<br>      &quot;type&quot;: &quot;embeddings&quot;,<br>      &quot;name&quot;: &quot;embed&quot;,<br>      &quot;config&quot;: {<br>        &quot;provider&quot;: &quot;litellm&quot;,<br>        &quot;provider_config&quot;: {<br>          &quot;model_id&quot;: &quot;openai/nomic-embed-text&quot;,<br>          &quot;api_base&quot;: &quot;http://localhost:11434/v1&quot;,<br>          &quot;api_key&quot;: &quot;ollama&quot;<br>        },<br>        &quot;embeddings_column&quot;: &quot;embeddings&quot;,<br>        &quot;overlap_ratio&quot;: 0.1<br>      },<br>      &quot;depends_on&quot;: [<br>        &quot;chunk&quot;<br>      ]<br>    },<br>    {<br>      &quot;type&quot;: &quot;vectordb&quot;,<br>      &quot;name&quot;: &quot;store&quot;,<br>      &quot;config&quot;: {<br>        &quot;provider&quot;: &quot;opensearch&quot;,<br>        &quot;doc_id_column&quot;: &quot;doc_id_hash&quot;,<br>        &quot;embeddings_column&quot;: &quot;embeddings&quot;,<br>        &quot;vector_dimension&quot;: 768,<br>        &quot;create_index&quot;: true,<br>        &quot;provider_config&quot;: {<br>          &quot;index_name&quot;: &quot;my-docs-index&quot;,<br>          &quot;host&quot;: &quot;localhost&quot;,<br>          &quot;port&quot;: 9200,<br>          &quot;username&quot;: &quot;${OPENSEARCH_USERNAME}&quot;,<br>          &quot;password&quot;: &quot;${OPENSEARCH_PASSWORD}&quot;,<br>          &quot;use_ssl&quot;: false,<br>          &quot;verify_certs&quot;: false,<br>          &quot;batch_size&quot;: 100,<br>          &quot;engine&quot;: &quot;faiss&quot;,<br>          &quot;algorithm&quot;: &quot;hnsw&quot;,<br>          &quot;space_type&quot;: &quot;l2&quot;<br>        },<br>        &quot;feature_mappings&quot;: [<br>          {<br>            &quot;feature_name&quot;: &quot;doc_id_hash&quot;,<br>            &quot;mapped_column_name&quot;: &quot;pk&quot;<br>          },<br>          {<br>            &quot;feature_name&quot;: &quot;content&quot;,<br>            &quot;mapped_column_name&quot;: &quot;text&quot;<br>          },<br>          {<br>            &quot;feature_name&quot;: &quot;name&quot;,<br>            &quot;mapped_column_name&quot;: &quot;doc_name&quot;<br>          },<br>          {<br>            &quot;feature_name&quot;: &quot;embeddings&quot;,<br>            &quot;mapped_column_name&quot;: &quot;vector_embeddings&quot;<br>          }<br>        ]<br>      },<br>      &quot;depends_on&quot;: [<br>        &quot;embed&quot;<br>      ]<br>    }<br>  ]<br>}</pre><p>How the graph works</p><p>Every node has a unique `name`. A node’s `depends_on` list identifies the upstream nodes that must complete first.</p><p>In this flow:</p><pre>- `extract` depends on `ingest`.<br>- `chunk` depends on `extract`.<br>- `embed` depends on `chunk`.<br>- `store` depends on `embed`.</pre><p>The engine topologically sorts the DAG and executes nodes when their dependencies have completed.</p><p>A branch is created when multiple downstream nodes depend on the same upstream node. A node with multiple entries in `depends_on` is a join: it waits for all listed upstream nodes.</p><p>During validation and execution, Docling Pipelines propagates feature metadata through the DAG. That metadata tells the VectorDB operator which fields are available and which field represents the generated vector.</p><p>The explicit mappings produce these OpenSearch fields:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LfaVrpZrhdFCP93IK_9Rw.png" /></figure><p>Additional document details, including the source URI, are stored inside `metadata`.</p><h3>Step 5: Validate the flow</h3><p>Confirm OpenSearch authentication once more before doing document processing:</p><pre>curl -u &quot;admin:${OPENSEARCH_PASSWORD}&quot; \<br> &#39;http://localhost:9200/_cluster/health?pretty&#39;</pre><p>Validate the DAG:</p><pre>docling-pipelines - flow-file my_flow.json - validate</pre><p>Validation checks the flow structure, operator names, parameters, dependencies, and propagated features.</p><p>It does not prove that Ollama is running, a requested model is installed, OpenSearch is reachable, the credentials are correct, or real documents can be extracted. Those conditions are tested only at runtime.</p><p>If validation fails, give Bob the complete error:</p><pre>The flow failed structural validation.<br>Inspect @my_flow.json and the complete validation output below.<br>Compare the flow with:<br>- the installed operator metadata<br>- the current flow-authoring guide<br>- the canonical Ollama/OpenSearch sample<br>Identify the smallest correction. Do not change unrelated parameters.<br>Validation output:<br>[paste the complete output]</pre><h3><strong>Step 6: </strong>Run the pipeline</h3><pre># Activate your virtual environment if not already active<br>source .venv/bin/activate<br># Run the flow<br>docling-pipelines --flow-file my_flow.json</pre><p>Inspect the flow execution summary and every operator status. Do not use the shell exit code alone as proof that all documents reached OpenSearch. In testing, a destination authentication failure produced a failed flow summary even though the CLI process returned exit code zero.</p><p>The exact configuration above was tested end to end with two sample documents. The successful run produced:</p><pre>================================================================================<br> FLOW: my-document-pipeline<br> Operators: 5<br>================================================================================<br><br>[ingest] Starting ingest_source...<br><br>================================================================================<br> ingest (COMPLETED)<br>================================================================================<br> Duration: &lt;1.00s | Documents: 2 processed, 0 failed, 0 skipped<br> Data Columns: 7 total<br>   Added (7): id, name, document_format, metadata, source_id, path,<br>              modified_time<br>================================================================================<br><br>[extract] Starting extract_operator...<br><br>================================================================================<br> extract (COMPLETED)<br>================================================================================<br> Duration: &lt;1.00s | Documents: 2 processed, 0 failed, 0 skipped<br> Data Columns: 10 total<br>   Added (3): content, pages_processed, doc_id_hash<br>================================================================================<br><br>[chunk] Starting chunker...<br><br>================================================================================<br> chunk (COMPLETED)<br>================================================================================<br> Duration: &lt;1.00s | Documents: 2 processed, 0 failed, 0 skipped<br> Total Chunks: 2<br> Data Columns: 10 total<br>   Added (1): chunked_content<br>   Removed (1): content<br>================================================================================<br><br>[embed] Starting embeddings...<br><br>================================================================================<br> embed (COMPLETED)<br>================================================================================<br> Duration: &lt;1.00s | Documents: 2 processed, 0 failed, 0 skipped<br> Embedding Dimension: 768<br> Data Columns: 11 total<br>   Added (1): embeddings<br>================================================================================<br><br>[store] Starting vectordb...<br><br>================================================================================<br> store (COMPLETED)<br>================================================================================<br> Duration: 1.00s | Documents: 2 processed, 0 failed, 0 skipped<br> Batches: 1<br> Chunks: 2 indexed successfully, 0 failed<br> Index: my-docs-index<br>================================================================================<br><br>================================================================================<br> FLOW EXECUTION SUMMARY<br>================================================================================<br> Status: COMPLETED<br> Total Duration: 3.00s<br> Documents: 2 completed, 0 failed, 0 skipped (of 2 total)<br><br> Operator         Status      Duration   Docs<br> -------------------------------------------------<br> ingest           COMPLETED   &lt;1.00s     2/2<br> extract          COMPLETED   &lt;1.00s     2/2<br> chunk            COMPLETED   &lt;1.00s     2/2<br> embed            COMPLETED   &lt;1.00s     2/2<br> store            COMPLETED    1.00s     2/2<br>================================================================================</pre><p>For additional diagnostic output, run:</p><pre>DS_LOG_LEVEL=DEBUG \<br> docling-pipelines - flow-file my_flow.json</pre><p>Use the Python API instead of the CLI. You can also run flows programmatically from Python:</p><pre>from docpipe.lib.docpipe_flow_manager import DocpipeFlowManager<br>manager = DocpipeFlowManager(flow_file=&quot;my_flow.json&quot;)<br>result = manager.execute()<br>print(result)</pre><h3>Step 7: Inspect the data</h3><h4>Check the indexed chunk count</h4><p>The OpenSearch `_count` endpoint reports indexed records. In this pipeline, each record represents a chunk, not necessarily one source document.</p><pre>curl -u &quot;admin:${OPENSEARCH_PASSWORD}&quot; \<br>  &#39;http://localhost:9200/my-docs-index/_count&#39;</pre><p>The verified run returned:</p><pre>{<br>  &quot;count&quot;: 2<br>}</pre><p>The exact count depends on the input documents and chunking configuration. The important initial condition is that the count is greater than zero.</p><h4>Inspect a stored chunk</h4><pre>curl -u &quot;admin:${OPENSEARCH_PASSWORD}&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  &#39;http://localhost:9200/my-docs-index/_search?pretty&#39; \<br>  -d &#39;{<br>    &quot;query&quot;: {<br>      &quot;match&quot;: {<br>        &quot;text&quot;: &quot;retrieval&quot;<br>      }<br>    },<br>    &quot;size&quot;: 2,<br>    &quot;_source&quot;: [<br>      &quot;text&quot;,<br>      &quot;doc_name&quot;,<br>      &quot;metadata&quot;<br>    ]<br>  }&#39;</pre><p>A matching hit should resemble:</p><pre>{<br>  &quot;metadata&quot;: {<br>    &quot;extension&quot;: &quot;txt&quot;,<br>    &quot;name&quot;: &quot;retrieval.txt&quot;,<br>    &quot;mimetype&quot;: &quot;text/plain&quot;,<br>    &quot;source&quot;: &quot;file:///.../my_documents/retrieval.txt&quot;,<br>    &quot;page_count&quot;: 1<br>  },<br>  &quot;doc_name&quot;: &quot;retrieval.txt&quot;,<br>  &quot;text&quot;: &quot;Retrieval-augmented generation uses retrieved information...&quot;<br>}</pre><p>The exact source URI depends on the working directory.</p><h4>Confirm that vectors were stored</h4><pre>curl -u &quot;admin:${OPENSEARCH_PASSWORD}&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  &#39;http://localhost:9200/my-docs-index/_search?pretty&#39; \<br>  -d &#39;{<br>    &quot;query&quot;: {<br>      &quot;match_all&quot;: {}<br>    },<br>    &quot;size&quot;: 1,<br>    &quot;_source&quot;: [<br>      &quot;doc_name&quot;,<br>      &quot;text&quot;,<br>      &quot;vector_embeddings&quot;<br>    ]<br>  }&#39;</pre><p>The returned document should contain a `vector_embeddings` array. For `nomic-embed-text`, the verified dimension is 768.</p><h3>Step 8: Verify semantic retrieval end to end</h3><p>The curl checks prove that OpenSearch contains text and vectors. The following script also embeds a natural-language question, performs KNN retrieval, and generates an answer from the retrieved text.</p><p>Create `verify_pipeline.py`:</p><pre>&quot;&quot;&quot;Verify a Docling Pipelines OpenSearch index end to end.&quot;&quot;&quot;<br><br>import os<br>from typing import Any<br><br>import ollama<br>from dotenv import load_dotenv<br>from opensearchpy import OpenSearch<br><br>load_dotenv()<br><br>INDEX = &quot;my-docs-index&quot;<br>OS_HOST = &quot;localhost&quot;<br>OS_PORT = 9200<br>OS_USER = os.getenv(&quot;OPENSEARCH_USERNAME&quot;, &quot;admin&quot;)<br>OS_PASSWORD = os.environ[&quot;OPENSEARCH_PASSWORD&quot;]<br><br>EMBEDDING_MODEL = &quot;nomic-embed-text&quot;<br>CHAT_MODEL = os.getenv(&quot;OLLAMA_CHAT_MODEL&quot;, &quot;granite4&quot;)<br><br>TEXT_FIELD = &quot;text&quot;<br>EMBEDDING_FIELD = &quot;vector_embeddings&quot;<br>EXPECTED_VECTOR_DIMENSION = 768<br><br>QUESTION = &quot;What makes document preparation important for RAG?&quot;<br><br><br>def create_client() -&gt; OpenSearch:<br>    return OpenSearch(<br>        hosts=[{&quot;host&quot;: OS_HOST, &quot;port&quot;: OS_PORT}],<br>        http_auth=(OS_USER, OS_PASSWORD),<br>        use_ssl=False,<br>        verify_certs=False,<br>    )<br><br><br>def extract_query_vector(response: Any) -&gt; list[float]:<br>    embeddings = response[&quot;embeddings&quot;]<br><br>    if not embeddings:<br>        raise RuntimeError(&quot;Ollama returned no embeddings&quot;)<br><br>    vector = embeddings[0]<br><br>    if not vector:<br>        raise RuntimeError(&quot;Ollama returned an empty query vector&quot;)<br><br>    return vector<br><br><br>client = create_client()<br><br># Check 1: indexed chunk count<br>chunk_count = client.count(index=INDEX)[&quot;count&quot;]<br>print(f&quot;[CHECK 1] Indexed chunk count: {chunk_count}&quot;)<br><br>if chunk_count &lt;= 0:<br>    raise RuntimeError(<br>        &quot;The index is empty. Check the VectorDB operator result and index name.&quot;<br>    )<br><br># Check 2: keyword retrieval<br>keyword_response = client.search(<br>    index=INDEX,<br>    body={<br>        &quot;size&quot;: 3,<br>        &quot;query&quot;: {&quot;match&quot;: {TEXT_FIELD: &quot;retrieval&quot;}},<br>        &quot;_source&quot;: [TEXT_FIELD, &quot;doc_name&quot;, &quot;metadata&quot;],<br>    },<br>)<br><br>keyword_hits = keyword_response[&quot;hits&quot;][&quot;hits&quot;]<br>print(f&quot;[CHECK 2] Keyword hits: {len(keyword_hits)}&quot;)<br><br>if not keyword_hits:<br>    raise RuntimeError(<br>        &quot;Keyword retrieval returned no hits. &quot;<br>        &quot;Check extraction output and feature_mappings.&quot;<br>    )<br><br>for hit in keyword_hits:<br>    source = hit[&quot;_source&quot;]<br>    metadata = source.get(&quot;metadata&quot;, {})<br>    source_path = metadata.get(&quot;source&quot;, &quot;n/a&quot;)<br>    snippet = source.get(TEXT_FIELD, &quot;&quot;)[:120].replace(&quot;\n&quot;, &quot; &quot;)<br>    print(<br>        f&quot;  score={hit[&#39;_score&#39;]:.4f} &quot;<br>        f&quot;doc={source.get(&#39;doc_name&#39;, &#39;n/a&#39;)} &quot;<br>        f&quot;path={source_path} &quot;<br>        f&quot;text={snippet!r}&quot;<br>    )<br><br># Check 3: stored embedding dimension<br>sample_response = client.search(<br>    index=INDEX,<br>    body={<br>        &quot;size&quot;: 1,<br>        &quot;query&quot;: {&quot;match_all&quot;: {}},<br>        &quot;_source&quot;: [EMBEDDING_FIELD],<br>    },<br>)<br><br>sample_hits = sample_response[&quot;hits&quot;][&quot;hits&quot;]<br><br>if not sample_hits:<br>    raise RuntimeError(&quot;Could not read a sample chunk from the index&quot;)<br><br>stored_vector = sample_hits[0][&quot;_source&quot;].get(EMBEDDING_FIELD, [])<br>print(f&quot;[CHECK 3] Stored embedding dimension: {len(stored_vector)}&quot;)<br><br>if len(stored_vector) != EXPECTED_VECTOR_DIMENSION:<br>    raise RuntimeError(<br>        &quot;Unexpected stored embedding dimension: &quot;<br>        f&quot;expected {EXPECTED_VECTOR_DIMENSION}, got {len(stored_vector)}&quot;<br>    )<br><br># Check 4: semantic KNN retrieval using an embedded question<br>embedding_response = ollama.embed(<br>    model=EMBEDDING_MODEL,<br>    input=QUESTION,<br>)<br><br>query_vector = extract_query_vector(embedding_response)<br><br>if len(query_vector) != EXPECTED_VECTOR_DIMENSION:<br>    raise RuntimeError(<br>        &quot;Unexpected query-vector dimension: &quot;<br>        f&quot;expected {EXPECTED_VECTOR_DIMENSION}, got {len(query_vector)}&quot;<br>    )<br><br>result_count = min(3, chunk_count)<br><br>semantic_response = client.search(<br>    index=INDEX,<br>    body={<br>        &quot;size&quot;: result_count,<br>        &quot;query&quot;: {<br>            &quot;knn&quot;: {<br>                EMBEDDING_FIELD: {<br>                    &quot;vector&quot;: query_vector,<br>                    &quot;k&quot;: result_count,<br>                }<br>            }<br>        },<br>        &quot;_source&quot;: [TEXT_FIELD, &quot;doc_name&quot;, &quot;metadata&quot;],<br>    },<br>)<br><br>semantic_hits = semantic_response[&quot;hits&quot;][&quot;hits&quot;]<br>print(f&quot;[CHECK 4] Semantic KNN hits: {len(semantic_hits)}&quot;)<br><br>if not semantic_hits:<br>    raise RuntimeError(<br>        &quot;Semantic retrieval returned no hits. &quot;<br>        &quot;Check the vector mapping and KNN index configuration.&quot;<br>    )<br><br>for hit in semantic_hits:<br>    source = hit[&quot;_source&quot;]<br>    metadata = source.get(&quot;metadata&quot;, {})<br>    source_path = metadata.get(&quot;source&quot;, &quot;n/a&quot;)<br>    snippet = source.get(TEXT_FIELD, &quot;&quot;)[:120].replace(&quot;\n&quot;, &quot; &quot;)<br>    print(<br>        f&quot;  score={hit[&#39;_score&#39;]:.4f} &quot;<br>        f&quot;doc={source.get(&#39;doc_name&#39;, &#39;n/a&#39;)} &quot;<br>        f&quot;path={source_path} &quot;<br>        f&quot;text={snippet!r}&quot;<br>    )<br><br># Check 5: grounded answer generation<br>context_parts = [<br>    hit[&quot;_source&quot;].get(TEXT_FIELD, &quot;&quot;)<br>    for hit in semantic_hits<br>    if hit[&quot;_source&quot;].get(TEXT_FIELD)<br>]<br><br>context = &quot;\n\n---\n\n&quot;.join(context_parts)<br><br>if not context:<br>    raise RuntimeError(&quot;Semantic retrieval returned no usable text&quot;)<br><br>prompt = f&quot;&quot;&quot;Answer the question using only the supplied context.<br><br>If the context does not contain enough information, say so explicitly.<br><br>Context:<br>{context}<br><br>Question:<br>{QUESTION}<br><br>Answer:<br>&quot;&quot;&quot;<br><br>generation_response = ollama.generate(<br>    model=CHAT_MODEL,<br>    prompt=prompt,<br>)<br><br>answer = generation_response[&quot;response&quot;].strip()<br><br>print(f&quot;[CHECK 5] Grounded answer using {CHAT_MODEL}:&quot;)<br>print(answer)<br><br>if len(answer) &lt; 20:<br>    raise RuntimeError(&quot;The chat model returned an empty or unusably short answer&quot;)<br><br>print(&quot;\n[DONE] All required verification checks passed.&quot;)</pre><p>Run it:</p><pre>source .venv/bin/activate<br>python verify_pipeline.py</pre><p>The verified run produced:</p><pre>[CHECK 1] Indexed chunk count: 2<br>[CHECK 2] Keyword hits: 1<br>[CHECK 3] Stored embedding dimension: 768<br>[CHECK 4] Semantic KNN hits: 2<br>[CHECK 5] Grounded answer:<br>Document preparation is crucial for retrieval-augmented generation because<br>it directly affects the quality of the information retrieved and supplied<br>to the language model.<br><br>[DONE] All required verification checks passed.</pre><p>Representative KNN results from that run were:</p><pre>score=0.523994 doc=docling.txt<br>text=&#39;Docling Pipelines is an operator-based framework...&#39;<br><br>score=0.518834 doc=retrieval.txt<br>text=&#39;Retrieval-augmented generation uses retrieved information...&#39;</pre><p>Scores and exact answer wording will vary, so the script tests structural outcomes rather than fixed similarity scores.</p><h4>What each check proves</h4><ul><li><strong>Indexed chunk count</strong>: Confirms that the VectorDB stage wrote records.</li><li><strong>Keyword retrieval</strong>: Confirms that extracted text was stored under the expected field mapping.</li><li><strong>Embedding dimension</strong>: Confirms that vectors were created and written to OpenSearch.</li><li><strong>Semantic KNN retrieval</strong>: Confirms that a newly embedded question can retrieve indexed chunks.</li><li><strong>Grounded answer</strong>: Confirms that retrieved content can be passed to a local chat model.</li></ul><p>These checks do not measure retrieval quality comprehensively. A production evaluation should use representative documents, questions, expected sources, relevance judgments, and answer-quality metrics.</p><h3>Capabilities beyond this tutorial</h3><p>The five-stage flow is a starting point.</p><p>A compliance-oriented flow could add language detection, PII annotation or redaction, and ACL processing before embeddings are generated. This helps ensure that sensitive or restricted content is handled before reaching the retrieval index.</p><p>A more complex workflow could classify documents, branch them into different processing paths, and merge the results before storage. For example, contracts and policy documents might use different extraction or quality rules while still ending in the same searchable index.</p><p>Docling Pipelines also separates operator logic from provider integrations through ports and adapters. Model-backed stages can use local or hosted providers where supported by the individual operator.</p><p>Consult the current operator reference before selecting a provider or configuring an advanced operator. Provider support is operator-specific and can evolve between releases.</p><h4>From local prototype to larger workloads</h4><p>This tutorial explicitly disables micro-batching to make a two-document run easier to understand.</p><p>For normal <strong>CLI</strong>, <strong>REST job-run</strong>, and <strong>DocpipeFlowManager</strong> execution, Docling Pipelines defaults `<strong>enable_micro_batching</strong>` to `true` when the flow does not set it. You can configure batch size and concurrency through `global_config`:</p><pre>{<br> &quot;global_config&quot;: {<br> &quot;enable_micro_batching&quot;: true,<br> &quot;micro_batch_size&quot;: 100,<br> &quot;max_concurrent_batches&quot;: 10<br> }<br>}</pre><p>Begin with local services while developing and validating the flow. As workload and operational requirements grow, evaluate micro-batching, dedicated Prefect deployment, hosted model providers, and managed storage integrations.</p><p>The logical DAG can often remain recognisable, although deployment and provider configuration will change.</p><h4>Summary</h4><p>You have built and verified a local document-indexing pipeline that:</p><ul><li>Discovers PDF and TXT files.</li><li>Extracts content with Docling.</li><li>Produces retrieval-sized chunks.</li><li>Generates embeddings through Ollama.</li><li>Stores text, metadata, and vectors in OpenSearch.</li><li>Supports keyword and semantic retrieval.</li><li>Produces an answer grounded in retrieved content.</li><li>Can be inspected and debugged with IBM Bob or any IDE agent</li></ul><p>The important result is not simply that the flow completed. The verification path confirms that the stored schema, text fields, vectors, retrieval query, and answer-generation step work together.</p><h3>Join us</h3><p>The enterprise AI community is spending enormous energy on models and prompts while quietly struggling with data pipelines that were never designed for LLMs. We open-sourced docling-pipelines to change that — to give teams a production-grade foundation they don’t have to build from scratch. What we need from the community right now is breadth: new cloud connectors, domain-specific quality operators, and integrations with orchestration tools like Airflow and LangChain. If any of that matches work you’re already doing, contributing here amplifies it.</p><ul><li>⭐ Star the repo: <a href="https://github.com/IBM/docling-pipelines">github.com/IBM/docling-pipelines</a></li><li>🐛 File issues or request features in <a href="https://github.com/IBM/docling-pipelines/issues">GitHub Issues</a></li><li>🔧 Contribute: read <a href="https://github.com/IBM/docling-pipelines/blob/main/CONTRIBUTING.md">CONTRIBUTING</a> and pick up a <em>good first issue</em></li><li>📧 Team email: <a href="/service/mailto:docling_pipeline_team-dg@ibm.com">docling_pipeline_team-dg@ibm.com</a></li></ul><h4>Get started today with the repository today</h4><pre># Clone for sample flows and notebooks<br>git clone https://github.com/IBM/docling-pipelines</pre><p>The repository ships with 7 interactive Jupyter notebooks covering quickstart, operator showcase, document extraction, embeddings and vector search, quality operators, a full end-to-end RAG pipeline, and flow authoring. You can run through the entire curriculum in a few hours.</p><p>The hardest part of RAG isn’t the model. Let’s make the data engineering part easy, together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a215ed702f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>