visual-parser 2.2.2__py3-none-any.whl → 2.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- visual_parser/__init__.py +12 -10
- visual_parser/cli.py +5 -5
- visual_parser/cli_main.py +6 -6
- visual_parser/image_describer.py +5 -5
- visual_parser/kb_redo.py +8 -3
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/METADATA +9 -7
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/RECORD +11 -11
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/WHEEL +0 -0
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/entry_points.txt +0 -0
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/licenses/LICENSE +0 -0
- {visual_parser-2.2.2.dist-info → visual_parser-2.2.3.dist-info}/top_level.txt +0 -0
visual_parser/__init__.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"""
|
|
2
|
-
visual_parser — Standalone Visual-RAG PDF Parser
|
|
3
|
-
|
|
4
|
-
Detects new PDFs in a user-supplied
|
|
5
|
-
lightweight PyMuPDF/PyPDFLoader),
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
visual_parser — Standalone Visual-RAG PDF & Image Parser
|
|
3
|
+
=========================================================
|
|
4
|
+
Detects new PDFs (and standalone images alongside them) in a user-supplied
|
|
5
|
+
directory, extracts text (via Nougat or lightweight PyMuPDF/PyPDFLoader),
|
|
6
|
+
describes every figure/chart/schematic and every standalone image using a
|
|
7
|
+
Vision LLM (OpenAI GPT, Google Gemini, or a local model via Ollama), and
|
|
8
|
+
writes JSONL knowledge bases ready for any downstream RAG system:
|
|
8
9
|
|
|
9
|
-
01_chunks_kb.jsonl
|
|
10
|
-
02_visuals_kb.jsonl
|
|
11
|
-
03_metadata_kb.jsonl
|
|
10
|
+
01_chunks_kb.jsonl – text chunks with stable IDs
|
|
11
|
+
02_visuals_kb.jsonl – per-figure visual descriptions
|
|
12
|
+
03_metadata_kb.jsonl – document-level metadata (title, authors, DOI …)
|
|
13
|
+
image_descriptions_kb.jsonl – one holistic description per standalone image
|
|
12
14
|
|
|
13
15
|
No chatbot, no vector store, no retrieval – just a robust parser.
|
|
14
16
|
"""
|
|
@@ -17,4 +19,4 @@ from visual_parser.config import ParserConfig
|
|
|
17
19
|
from visual_parser.pipeline import run_pipeline
|
|
18
20
|
|
|
19
21
|
__all__ = ["ParserConfig", "run_pipeline"]
|
|
20
|
-
__version__ = "2.2.
|
|
22
|
+
__version__ = "2.2.3"
|
visual_parser/cli.py
CHANGED
|
@@ -44,13 +44,13 @@ def _build_arg_parser() -> argparse.ArgumentParser:
|
|
|
44
44
|
p = argparse.ArgumentParser(
|
|
45
45
|
prog="visual-parser",
|
|
46
46
|
description=(
|
|
47
|
-
"Visual-RAG PDF Parser — detects new PDFs and standalone images, "
|
|
47
|
+
"Visual-RAG PDF & Image Parser — detects new PDFs and standalone images, "
|
|
48
48
|
"extracts text and figure/image descriptions, and writes JSONL "
|
|
49
49
|
"knowledge bases:\n"
|
|
50
|
-
" 01_chunks_kb.jsonl
|
|
51
|
-
" 02_visuals_kb.jsonl
|
|
52
|
-
" 03_metadata_kb.jsonl
|
|
53
|
-
"
|
|
50
|
+
" 01_chunks_kb.jsonl text chunks\n"
|
|
51
|
+
" 02_visuals_kb.jsonl PDF figure descriptions\n"
|
|
52
|
+
" 03_metadata_kb.jsonl document metadata\n"
|
|
53
|
+
" image_descriptions_kb.jsonl standalone image descriptions"
|
|
54
54
|
),
|
|
55
55
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
56
56
|
epilog=USAGE_EXAMPLES,
|
visual_parser/cli_main.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
cli_main.py - ASCII-safe CLI entry point for the Visual-RAG PDF Parser.
|
|
2
|
+
cli_main.py - ASCII-safe CLI entry point for the Visual-RAG PDF & Image Parser.
|
|
3
3
|
|
|
4
4
|
This module exists to keep Windows console help output stable for the
|
|
5
5
|
installed ``visual-parser`` command and ``python -m visual_parser``.
|
|
@@ -42,13 +42,13 @@ def _build_arg_parser() -> argparse.ArgumentParser:
|
|
|
42
42
|
parser = argparse.ArgumentParser(
|
|
43
43
|
prog="visual-parser",
|
|
44
44
|
description=(
|
|
45
|
-
"Visual-RAG PDF Parser - detects new PDFs and standalone images, "
|
|
45
|
+
"Visual-RAG PDF & Image Parser - detects new PDFs and standalone images, "
|
|
46
46
|
"extracts text and figure/image descriptions, and writes JSONL "
|
|
47
47
|
"knowledge bases:\n"
|
|
48
|
-
" 01_chunks_kb.jsonl
|
|
49
|
-
" 02_visuals_kb.jsonl
|
|
50
|
-
" 03_metadata_kb.jsonl
|
|
51
|
-
"
|
|
48
|
+
" 01_chunks_kb.jsonl text chunks\n"
|
|
49
|
+
" 02_visuals_kb.jsonl PDF figure descriptions\n"
|
|
50
|
+
" 03_metadata_kb.jsonl document metadata\n"
|
|
51
|
+
" image_descriptions_kb.jsonl standalone image descriptions"
|
|
52
52
|
),
|
|
53
53
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
54
54
|
epilog=USAGE_EXAMPLES,
|
visual_parser/image_describer.py
CHANGED
|
@@ -10,7 +10,7 @@ supplied image files instead of PyMuPDF-rasterized PDF pages.
|
|
|
10
10
|
|
|
11
11
|
Output
|
|
12
12
|
------
|
|
13
|
-
One record per image is appended to ``
|
|
13
|
+
One record per image is appended to ``image_descriptions_kb.jsonl`` in
|
|
14
14
|
*output_dir*:
|
|
15
15
|
|
|
16
16
|
{
|
|
@@ -40,7 +40,7 @@ from visual_parser.vision_llm import call_vision_llm
|
|
|
40
40
|
|
|
41
41
|
logger = logging.getLogger(__name__)
|
|
42
42
|
|
|
43
|
-
IMAGE_DESCRIPTIONS_FILE = "
|
|
43
|
+
IMAGE_DESCRIPTIONS_FILE = "image_descriptions_kb.jsonl"
|
|
44
44
|
|
|
45
45
|
# Decoupled from figure_describer.py's context-window-scaled formula (10 min
|
|
46
46
|
# for 1 image there): IMAGE_DESCRIPTION_PROMPT's "Verbatim Text Content"
|
|
@@ -171,7 +171,7 @@ def describe_images(
|
|
|
171
171
|
"""
|
|
172
172
|
For each image in *new_image_paths*, call the Vision LLM once (no
|
|
173
173
|
context window -- a single standalone image per call), parse the
|
|
174
|
-
description, and append the result to ``
|
|
174
|
+
description, and append the result to ``image_descriptions_kb.jsonl`` in
|
|
175
175
|
*output_dir*.
|
|
176
176
|
|
|
177
177
|
Returns the basenames actually written a row for -- NOT the full input
|
|
@@ -183,7 +183,7 @@ def describe_images(
|
|
|
183
183
|
|
|
184
184
|
Args:
|
|
185
185
|
new_image_paths: Full paths of images to describe.
|
|
186
|
-
output_dir: Directory where ``
|
|
186
|
+
output_dir: Directory where ``image_descriptions_kb.jsonl`` is written.
|
|
187
187
|
vision_provider: ``'gpt'``, ``'gemini'``, or ``'ollama'``.
|
|
188
188
|
vision_api_key: API key for the chosen provider (unused for ollama).
|
|
189
189
|
vision_model: Vision model name string.
|
|
@@ -191,7 +191,7 @@ def describe_images(
|
|
|
191
191
|
image_prompt: The instruction prompt sent with each image.
|
|
192
192
|
max_workers: Thread-pool size for concurrent vision-LLM calls.
|
|
193
193
|
|
|
194
|
-
Always resumes from
|
|
194
|
+
Always resumes from image_descriptions_kb.jsonl's existing content (via the
|
|
195
195
|
done_images set below) -- callers that want an image redescribed must
|
|
196
196
|
first remove its existing row and its basename from the processed-
|
|
197
197
|
images registry (see kb_redo.redo_entries()), then pass it in here as if
|
visual_parser/kb_redo.py
CHANGED
|
@@ -14,7 +14,7 @@ dependency-free package and cannot depend on the sibling RADIANT-LLM repo)
|
|
|
14
14
|
the proven basename-match + backup-once + atomic-rewrite pattern from
|
|
15
15
|
RADIANT-LLM's knowledge_base_sanitizer() (radiant_lmm/RADIANT_LLM_ChatBot_
|
|
16
16
|
Local/utils/pdf_helpers.py:1464-1607), extended to the 4th JSONL file
|
|
17
|
-
(
|
|
17
|
+
(image_descriptions_kb.jsonl) and both registries (04_processed_pdfs.txt,
|
|
18
18
|
parsed_images.txt), which that function never touches at all.
|
|
19
19
|
"""
|
|
20
20
|
|
|
@@ -25,6 +25,7 @@ import os
|
|
|
25
25
|
import shutil
|
|
26
26
|
from typing import Any, Dict, Iterable, List
|
|
27
27
|
|
|
28
|
+
from visual_parser.image_describer import IMAGE_DESCRIPTIONS_FILE
|
|
28
29
|
from visual_parser.image_tracker import PROCESSED_IMAGES_REGISTRY
|
|
29
30
|
from visual_parser.jsonl_writer import atomic_rewrite_jsonl
|
|
30
31
|
from visual_parser.pdf_tracker import PROCESSED_REGISTRY, load_processed_pdfs, unmark_as_processed
|
|
@@ -33,12 +34,16 @@ logger = logging.getLogger(__name__)
|
|
|
33
34
|
|
|
34
35
|
# Hardcoded, not glob("*.jsonl") like the RADIANT precedent -- output_dir
|
|
35
36
|
# often equals input_dir (the documented default), so globbing risks
|
|
36
|
-
# touching unrelated JSONL files a user happens to keep there.
|
|
37
|
+
# touching unrelated JSONL files a user happens to keep there. The image
|
|
38
|
+
# filename is imported (not hardcoded like the other three) because it was
|
|
39
|
+
# renamed once already (image_descriptions.jsonl -> image_descriptions_kb.jsonl,
|
|
40
|
+
# 2.2.3) with this exact file as a hardcoded duplicate that needed a manual
|
|
41
|
+
# fix -- importing the constant means it can't drift out of sync again.
|
|
37
42
|
KB_JSONL_FILENAMES = (
|
|
38
43
|
"01_chunks_kb.jsonl",
|
|
39
44
|
"02_visuals_kb.jsonl",
|
|
40
45
|
"03_metadata_kb.jsonl",
|
|
41
|
-
|
|
46
|
+
IMAGE_DESCRIPTIONS_FILE,
|
|
42
47
|
)
|
|
43
48
|
REGISTRY_FILENAMES = (PROCESSED_REGISTRY, PROCESSED_IMAGES_REGISTRY)
|
|
44
49
|
BACKUP_SUFFIX = "_backup_before_redo"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: visual-parser
|
|
3
|
-
Version: 2.2.
|
|
4
|
-
Summary: Standalone Visual-RAG PDF Parser - text extraction and Vision-LLM figure descriptions to JSONL
|
|
3
|
+
Version: 2.2.3
|
|
4
|
+
Summary: Standalone Visual-RAG PDF & Image Parser - text extraction and Vision-LLM figure/image descriptions to JSONL
|
|
5
5
|
Author: Zavier N. Ndum
|
|
6
6
|
Author-email: zavier.ndum@tamu.edu
|
|
7
7
|
License-Expression: Apache-2.0
|
|
8
8
|
Project-URL: Homepage, https://github.com/SmartLabNuclear/RADIANT_LLM
|
|
9
9
|
Project-URL: Repository, https://github.com/SmartLabNuclear/RADIANT_LLM
|
|
10
10
|
Project-URL: Docker Hub, https://hub.docker.com/r/zev94/radiant-llm
|
|
11
|
-
Keywords: pdf,rag,nougat,vision-llm,ocr,document-parsing,jsonl,knowledge-base
|
|
11
|
+
Keywords: pdf,image,rag,nougat,vision-llm,ocr,document-parsing,jsonl,knowledge-base
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -43,16 +43,16 @@ Requires-Dist: ruff; extra == "dev"
|
|
|
43
43
|
Requires-Dist: mypy; extra == "dev"
|
|
44
44
|
Dynamic: license-file
|
|
45
45
|
|
|
46
|
-
# visual-parser (Standalone Visual-RAG PDF Ingestion)
|
|
46
|
+
# visual-parser (Standalone Visual-RAG PDF & Image Ingestion)
|
|
47
47
|
|
|
48
48
|

|
|
49
49
|

|
|
50
50
|

|
|
51
51
|

|
|
52
52
|
|
|
53
|
-
`visual-parser` converts PDFs (and standalone images alongside them) into a multi-modal JSONL knowledge base (text chunks, figure descriptions, standalone image descriptions, metadata). It was extracted from [RADIANT-LLM](https://github.com/SmartLabNuclear/RADIANT_LLM) as a standalone PDF-ingestion tool, independent of any chatbot.
|
|
53
|
+
`visual-parser` converts PDFs (and standalone images alongside them) into a multi-modal JSONL knowledge base (text chunks, figure descriptions, standalone image descriptions, metadata). It was extracted from [RADIANT-LLM](https://github.com/SmartLabNuclear/RADIANT_LLM) as a standalone PDF-and-image ingestion tool, independent of any chatbot.
|
|
54
54
|
|
|
55
|
-
1) Run `visual-parser` on curated PDFs to generate JSONL KB files.
|
|
55
|
+
1) Run `visual-parser` on a directory of curated PDFs and/or standalone images to generate JSONL KB files.
|
|
56
56
|
2) Point any downstream RAG system at the generated KB — RADIANT-LLM, AutoSAM, and AutoFLUKA all consume the identical JSONL/registry format, so the same KB works with any of them without re-parsing.
|
|
57
57
|
|
|
58
58
|
## Table of Contents
|
|
@@ -74,10 +74,12 @@ By default, the pipeline writes:
|
|
|
74
74
|
- `01_chunks_kb.jsonl`: chunked text extracted from PDFs (Nougat by default).
|
|
75
75
|
- `02_visuals_kb.jsonl`: figure/page visual descriptions (Vision LLM), one row per figure found in a PDF.
|
|
76
76
|
- `03_metadata_kb.jsonl`: document metadata rows (title/author/etc.).
|
|
77
|
-
- `
|
|
77
|
+
- `image_descriptions_kb.jsonl`: one holistic description per **standalone image** file found alongside your PDFs in `--input-dir` (not a PDF's own figures) — auto-detected by extension, no separate flag needed; disable with `--skip-images`.
|
|
78
78
|
|
|
79
79
|
Alongside the KB, the pipeline also writes bookkeeping files: `04_processed_pdfs.txt` / `parsed_images.txt` (track which PDFs/images have already been processed, so re-runs skip them unless `--rebuild` or `--redo NAME`) and `05_pipeline.log` (run log at the verbosity set by `--log-level`, default `ERROR`).
|
|
80
80
|
|
|
81
|
+
> **Breaking change in 2.2.3:** the standalone-image KB file was renamed from `image_descriptions.jsonl` to `image_descriptions_kb.jsonl` (matching the `NN_name_kb.jsonl` convention used by the other three KB files). Upgrading from an older version does **not** migrate existing data automatically — the resume check only looks at the new filename, so already-described images in an old `image_descriptions.jsonl` would otherwise appear "new" again and get re-described. If you have existing data, rename the file yourself before re-running: `image_descriptions.jsonl` → `image_descriptions_kb.jsonl`.
|
|
82
|
+
|
|
81
83
|
## API Keys (.env)
|
|
82
84
|
|
|
83
85
|
Provide at least one provider:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
visual_parser/__init__.py,sha256=
|
|
1
|
+
visual_parser/__init__.py,sha256=aM-Cb26eQC-P7KVTslxeUlts3SD8zvgFCh-oBHdAi_A,1039
|
|
2
2
|
visual_parser/__main__.py,sha256=-p6rqjrnsjrtu71eFtmZdqFI1NgHXX9ASOnjuGqghNo,168
|
|
3
|
-
visual_parser/cli.py,sha256=
|
|
4
|
-
visual_parser/cli_main.py,sha256=
|
|
3
|
+
visual_parser/cli.py,sha256=28u8JxiFwc6cHf-CGk3TiVFn7llQ0k_3smSH_KFR9tQ,16077
|
|
4
|
+
visual_parser/cli_main.py,sha256=fZPCY6M_gMpp8rJ8U1F0-hJjiTRn3Ih03A-A_ZaPp1Q,11841
|
|
5
5
|
visual_parser/config.py,sha256=mu52rGN1keQtho70IUP7kPuS6Wykpcc-gv3z0irg70c,12140
|
|
6
6
|
visual_parser/figure_describer.py,sha256=q7Jsccsn5iGK4sCbsVOD4EzLuycbvBeBSYtHX0e9jPw,13470
|
|
7
|
-
visual_parser/image_describer.py,sha256=
|
|
7
|
+
visual_parser/image_describer.py,sha256=JTmLuczGV8vx6o_G1_8JLgPpHCw5EsxPbpvbpzm7-yM,13874
|
|
8
8
|
visual_parser/image_tracker.py,sha256=MyQiUyqnW6b7e7R7yIefJ0k15OO0WEkK5wMiRD2nmfU,2496
|
|
9
9
|
visual_parser/jsonl_writer.py,sha256=klkDl_KKdCRtiWWjTNqecN2B6zXPc0e9f704Dvj8Fh0,6215
|
|
10
|
-
visual_parser/kb_redo.py,sha256=
|
|
10
|
+
visual_parser/kb_redo.py,sha256=5_FpHHaEYQCAXSAN-j-snaj6OlaL36Vqi97DMqPPROA,5897
|
|
11
11
|
visual_parser/metadata_extractor.py,sha256=Z0jnA8Goo9R3SBThx5PQMetZkyrbevNvYCq36WsoQuQ,6579
|
|
12
12
|
visual_parser/model_catalog.py,sha256=Voli3Wv0YYLWyocNCpiBCchzfCxX4IYFNR4eOIlFyIM,7739
|
|
13
13
|
visual_parser/nougat_engine.py,sha256=o9u9XTxOL1EAo63mVARVt4z1IxfDMpvjhMD4URfTx1k,8369
|
|
@@ -18,9 +18,9 @@ visual_parser/pipeline.py,sha256=Bh03FO3ylIsC1bfRITvffGzL-e5r07dKVzgHEiNRK6Y,309
|
|
|
18
18
|
visual_parser/prompts.py,sha256=hdjDUZjF0A9eugm6qt4K5E1qnqMO1JE9_mTDAGS7sgg,11186
|
|
19
19
|
visual_parser/text_extractor.py,sha256=kMmjTvTnPJBsFTIv5qN49v88k1SJhQMtTob8_LT1tfE,17491
|
|
20
20
|
visual_parser/vision_llm.py,sha256=TXiitsDAMIdo9fbzYVKqd-0sGt-hqiJryMU481eo1SM,17429
|
|
21
|
-
visual_parser-2.2.
|
|
22
|
-
visual_parser-2.2.
|
|
23
|
-
visual_parser-2.2.
|
|
24
|
-
visual_parser-2.2.
|
|
25
|
-
visual_parser-2.2.
|
|
26
|
-
visual_parser-2.2.
|
|
21
|
+
visual_parser-2.2.3.dist-info/licenses/LICENSE,sha256=OEJRtZkWILIqPizQxk1m2CjYi1czEKW15RKX6WgLVBE,11344
|
|
22
|
+
visual_parser-2.2.3.dist-info/METADATA,sha256=EM6UWzoRQlVeb93ier-LK3cQ2347HYsItXfm1skP5ZQ,17112
|
|
23
|
+
visual_parser-2.2.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
24
|
+
visual_parser-2.2.3.dist-info/entry_points.txt,sha256=yypghqnxA-nSiyoDyhlg99SK9vfOzloFwUiiwRw4EWI,62
|
|
25
|
+
visual_parser-2.2.3.dist-info/top_level.txt,sha256=_aaZ41uFRN_WX-616YvmcXIroNq4k4m6Ph6FGetxLYY,14
|
|
26
|
+
visual_parser-2.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|