Skip to content

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

Closed

Description

@planetf1

Issue: rag/mellea_pdf.py Example Fails Outside US Due to Geo-blocking

Summary

The docs/examples/rag/mellea_pdf.py example fails when run outside the United States due to geo-blocking on the USDA website.

Details

File: docs/examples/rag/mellea_pdf.py

URL: https://www.fs.usda.gov/foresthealth/docs/fidls/FIDL-78-ArmillariaRootDisease.pdf

Error:

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://www.fs.usda.gov/foresthealth/docs/fidls/FIDL-78-ArmillariaRootDisease.pdf

Root Cause

The USDA Forest Service website appears to geo-block access from outside the United States. Testing confirms:

  • ✅ Works: From US (via VPN)
  • ❌ Fails: From UK and likely other non-US locations

Current Status

  • Marked as qualitative to exclude from default test runs (commit c5e36ef)
  • This prevents CI failures but doesn't solve the underlying issue

Proposed Solutions

Option 1: Use a Different PDF Source (Recommended)

Replace the USDA PDF with a more accessible alternative:

  • Use a PDF from a globally accessible source
  • Consider using a PDF hosted in the mellea repository
  • Use a well-known public domain document (e.g., from Project Gutenberg)

Option 2: Add Geo-location Handling

  • Detect geo-blocking and skip gracefully with informative message
  • Add pytest marker for geo-restricted tests
  • Document the limitation in the example

Option 3: Host PDF Locally

  • Download and include the PDF in the repository (check license)
  • Update example to use local file path
  • Ensures consistent behavior across all locations

Impact

  • Users: Non-US users cannot run this example
  • CI/CD: Tests fail in non-US regions
  • Documentation: Example appears broken to international users

Recommendation

Option 1 is preferred: Replace with a globally accessible PDF source to ensure the example works for all users regardless of location.

Related

  • Commit: c5e36ef - Marked as qualitative
  • Test run showing 403 error from UK location

Activity

  1. psschwei commented on Jan 28, 2026

    @psschwei
    Contributor

    I tested against a few other non-US locations, and all experienced the same problem of not being able to access the PDF.
    Agree with Option 1 as ideal solution.

  2. added
    enhancement
    on May 20, 2026
  3. added
    p2
    on Jun 18, 2026
  4. added
    bug
    on Aug 10, 2026
  5. removed
    enhancement
    on Oct 6, 2026
  6. jeeth-kataria commented on Oct 8, 2026

    @jeeth-kataria
    Contributor

    Hi, I’d like to work on this issue. Would replacing the USDA PDF with W3C’s historical WCAG 1.0 checklist be acceptable?

    https://www.w3.org/TR/1999/WAI-WEBCONTENT-19990505/full-checklist.pdf

    I’ve prepared a small local patch that asks about the document’s three priority levels, updates the grounding label and README, and disables OCR for this text-based PDF. It retains skip_always and adds no dependency or bundled PDF.
    I verified downloading and Docling conversion, plus inference with llama3.2:latest. I haven’t tested the checkout’s default Granite model.

  7. planetf1 commented on Oct 9, 2026

    @planetf1
    ContributorAuthor

    Thanks for testing this — good find on the W3C PDF. A few things before the PR:

    1. Before swapping sources: can you confirm, from the US (where it currently "works"), what the example's output looks like today? Then after switching to the W3C PDF, re-verify from both inside and outside the US that it still runs and gives a sensible answer. That gives us a real before/after.
    2. Confirm the new grounding question is actually answerable from that document's content, not just that Docling parses it.
    3. Test against mellea.start_session()'s actual default model — granite4.2:3b (Ollama), not llama3.2.
    4. On skip_always: this example doesn't use adapters, so recent model/RAG-pipeline changes don't affect your approach. But worth deciding whether it should run in CI at all now it's not geoblocked. Have a look at the marker guide in test/README.md and see what fits — e.g. e2e, ollama is an option, but that would mean changing the example to a structural assertion (type/shape of the result) rather than just printing output, since content checks belong under qualitative, and CI sets CICD=1, which skips qualitative tests, so that marker alone won't get it running there. Your call which way to go — just explain the choice in the PR.

    Side note, unrelated to your change: test/README.md:14-16 tells people to ollama pull granite4:micro/micro-h, but the actual default (mellea/stdlib/session.py, IBM_GRANITE_4_2_3B in mellea/backends/model_ids.py) is granite4.2:3b. Docs drifted from the code. If you're already touching docs for this PR, feel free to fix that line too — otherwise no worries, it's unrelated to this issue.

    Happy to review once you open the PR.

  8. jeeth-kataria commented on Oct 10, 2026

    @jeeth-kataria
    Contributor

    Thanks for the guidance. I’ve completed the local checks with granite4.2:3b, using mellea.start_session() without overrides. Three runs succeeded, including one from another working directory, and correctly explained all three priority levels.

    I also inspected the actual prompt: it contains the converted document, including the definitions from page 2’s “Priorities” section.

    I changed the markers to e2e, ollama, slow and added structural assertions only. Explicit pytest execution with CICD=1 passed. Current PR CI doesn’t collect Python examples, so I’m not claiming added PR-CI coverage. I also corrected the outdated model-pull instructions.

    The US before/after is still pending because I don’t have a verified US environment. I’ve preserved the original example and prepared commands for both versions. Could you or another contributor help run those from the US? I can share the procedure, or open the PR with this limitation documented if that’s easier for review.

  9. planetf1 commented on Oct 12, 2026

    @planetf1
    ContributorAuthor

    Thanks for the thorough verification. We can skip the US check, as it isn't needed to prove correctness: geo-blocking is directional, so a successful run from outside the US already confirms the new source works everywhere, and the old example's output is being replaced anyway.

    Please go ahead and open the PR.

  10. self-assigned this
    on Oct 28, 2026
  11. added a commit that references this issue on Nov 2, 2026
    2341e96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugp2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions