Skip to main content

Module assets

Module assets 

Source
Expand description

Runtime-asset path resolution shared by every crate.

All optional runtime assets (ONNX models, OCR dictionaries, the chunker tokenizer) live under one directory, .models/ — dot-prefixed like .pdfium/, so the plain models name stays free for source code. Resolution is CWD-relative with an executable-directory fallback.

Functions§

resolve
Resolve a default (CWD-relative) asset path. If it doesn’t exist relative to the current directory, a .models/… path is tried under $DOCLING_RS_MODELS_DIR (#285 — a whole-directory override, so the engine’s own selection logic — the OCR language pair, the int8 preference chains — keeps working against a relocated model set; the Python bindings point it at their per-user cache). After that, try next to the executable and one level above it (following symlinks — the layout scripts/install/install.sh produces: /usr/local/bin/docling-rs/usr/local/docling.rs/bin/docling-rs with .models/ and .pdfium/ in /usr/local/docling.rs). Returns rel unchanged when nothing exists anywhere, so callers’ error messages keep the familiar path. Explicit per-file env overrides never reach this.