Skip to content

fix: replace inaccessible PDF in RAG example - #1732

Open
jeeth-kataria wants to merge 1 commit into
generative-computing:mainfrom
jeeth-kataria:fix/373-pdf-example
Open

jeeth-kataria wants to merge 1 commit into
generative-computing:mainfrom
jeeth-kataria:fix/373-pdf-example

Conversation

@jeeth-kataria

@jeeth-kataria jeeth-kataria commented Oct 13, 2026 •

Copy link
Copy Markdown

Pull Request

Issue

Fixes #373

Description

Replace the USDA PDF (HTTP 403 from our Indian network) with W3C's dated WCAG 1.0 checklist. Ask about its three priority definitions, update the grounding label and prerequisites, and disable OCR for this text PDF. The document remains externally hosted; no binary or dependency is added.

Add structural assertions and e2e, ollama, slow markers. Also correct the default-model pull instruction in test/README.md, as suggested by the maintainer. No library, adapter or workflow code changes.

The maintainer waived US verification and requested this PR in the issue discussion. No US run was performed; worldwide accessibility is not claimed.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Actual local validation:

  • Fresh network downloads: USDA HTTP 403; W3C HTTP 200, 97,739 bytes. Earlier two W3C downloads had identical hashes.
  • Native loading and real Docling conversion: seven pages, 25,127 Markdown characters. Page 2's Priorities section explicitly defines must/should/may.
  • Real inference with mellea.start_session()'s default granite4.2:3b, without model overrides. Recorded prompt includes the complete document under wcag_checklist; response metadata confirms Granite. Root and absolute-path execution from another directory succeeded. Earlier directory checks substituted inference, and earlier Llama runs used an override; neither is the default-model evidence.
  • CICD=1 HF_HUB_DISABLE_XET=1 uv run --no-sync pytest docs/examples/rag/mellea_pdf.py -m 'e2e and ollama' --no-cov -v -s: 1 passed in 46.51s on the final branch. Latest answer correctly states all three definitions, one sentence each. Semantic review is manual; another run added less precise qualifiers, so structural success does not guarantee answer quality.
  • uv run --no-sync pytest test/test_example_collection.py --no-cov -q: 20 passed in 12.58s.
  • uv run --no-sync pre-commit run --all-files: passed all hooks, including full mypy. Initial attempts lacked optional SDKs/pip; automatic stub installation then caused version drift. Installed locked dev extras and compatible local-only stubs, restoring locked NumPy/Requests. No dependency files changed.
  • git diff --cached --check: passed before commit.

Broader suite attempt (CICD=1 HF_HUB_DISABLE_XET=1 uv run --no-sync pytest test --no-cov --maxfail=1 -q) stopped on the 900s uncertainty-adapter test timeout: 646 passed, 62 skipped, 136 deselected, 1 xpassed, 1 error. No complete-suite pass or remote CI result is claimed.

HF_HUB_DISABLE_XET=1 was used for verification after an hf-xet conversion-weight download stalled; it is not in the example.

Marker rationale

The example checks only string type and non-empty output, not generated facts. Cold conversion-weight/model downloads justify slow; explicit -m 'e2e and ollama' overrides the default slow exclusion. CICD=1 skips qualitative items, not this structural check.

Current PR CI installs Docling and pulls Granite but does not collect Python examples. Notebook CI collects notebooks only; nightly defaults exclude this slow example. This enables explicit execution, not new automated PR-CI coverage.

Attribution

  • AI coding assistants used

Codex assisted with investigation, code and validation. Commit uses the human author's existing Git identity, DCO sign-off and Assisted-by: Codex.


Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

Use the dated W3C WCAG 1.0 checklist for document-grounded QA.
Document prerequisites and add an explicit structural e2e example check.

Fixes generative-computing#373

Assisted-by: Codex
Signed-off-by: Jeeth <jeethkataria9798@icloud.com>
@jeeth-kataria
jeeth-kataria requested a review from a team as a code owner October 13, 2026 17:17
@github-actions github-actions Bot added the bug Something isn't working label Oct 13, 2026
@ajbozarth
ajbozarth requested a review from planetf1 October 13, 2026 20:28

@rafvasq rafvasq left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jeeth-kataria! The script and test change look good to me. For the example's README, I think that the documentation can be kept short and consistent with how other examples are described you can minimize the scope of this PR to simply updating the document used and example using it because the README will need to be re-organized but that's outside of this PR.

Comment on lines +18 to +65
Document-grounded question answering using W3C's
[WCAG 1.0 checklist PDF](https://www.w3.org/TR/1999/WAI-WEBCONTENT-19990505/full-checklist.pdf).
The question asks what the three checkpoint priority levels mean; the answer is
in the document's **Priorities** section on page 2. In brief, developers must
satisfy Priority 1 checkpoints, should satisfy Priority 2 checkpoints, and may
address Priority 3 checkpoints. Generated wording can vary.

This dated, seven-page publication is historical sample material, not current
accessibility guidance. It replaces a USDA PDF that returned HTTP 403 for users
outside the US. The PDF remains hosted by W3C under its
[document license](https://www.w3.org/Consortium/Legal/copyright-documents-19990405);
no copy is bundled with this example.

**Prerequisites:** Install the Docling extra, have internet access to download
the PDF and Docling's conversion models, and run Ollama with `granite4.2:3b`
(the current `start_session()` default). FAISS and sentence-transformers are
not needed for this example. OCR is disabled because the PDF contains text;
Docling may still download layout and table models on the first conversion.

From the repository root:

```bash
uv sync --frozen --extra docling
ollama serve # run in a separate terminal if Ollama is not already running
ollama pull granite4.2:3b
uv run python docs/examples/rag/mellea_pdf.py
```

From another working directory, use absolute paths to the checkout and script:

```bash
uv run --project /path/to/mellea python /path/to/mellea/docs/examples/rag/mellea_pdf.py
```

The document URL is independent of the working directory. PDF conversion happens
before the session is created, so document-loading failures can be distinguished
from model-inference failures. The `e2e, ollama, slow` markers opt the example
into explicit slow-test runs. Its assertions check only that the result is a
non-empty string, not the factual content of the answer. The `slow` marker
accounts for cold conversion-model downloads and inference; ordinary test runs
exclude it. `CICD=1` does not skip this structural test, but current PR CI does
not collect Python examples.

To run it through pytest, including the slow marker:

```bash
uv run pytest docs/examples/rag/mellea_pdf.py -m "e2e and ollama" --no-cov -v -s
```

@rafvasq rafvasq Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra context not needed at the moment. I think this can be kept to one-line for now as it was before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mellea_pdf example requires access to geoblocked content - needs global accessible content

2 participants