You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,13 @@ python -m pytest
21
21
22
22
These checks do not download or run GPU models. Real ColQwen2 and Qwen2.5-VL verification should be done separately on a CUDA machine and marked clearly in the pull request.
23
23
24
+
## Behavior Changes
25
+
26
+
- Edit the notebook when changing the authoritative workflow.
27
+
- Edit `src/visorag/` when changing the maintainable package surface.
28
+
- Update tests whenever public request validation, response contracts, supported file types, query types, or lazy-loading behavior changes.
29
+
- If the package intentionally diverges from the notebook, document the migration in `docs/source-of-truth.md` and the pull request.
30
+
24
31
## Pull Request Checklist
25
32
26
33
- Notebook JSON parses and code cells AST-parse without executing GPU models.
VisoRAG is a notebook-originated visual retrieval system for PDFs, DOCX files, and images. It renders documents to page images, embeds them with ColQwen2, stores each request in an in-memory Qdrant MaxSim collection, retrieves relevant pages, and answers with local Qwen2.5-VL inference. It is for developersand researchers who want a small, source-readable baseline for visual document question answering, field extraction, and multimodal RAG experiments.
10
+
VisoRAG is a notebook-originated visual document QA and extraction baseline. It renders documents as page images, embeds the pages with ColQwen2, retrieves relevant pages through an in-memory Qdrant MaxSim collection, and answers with local Qwen2.5-VL through a FastAPI API or CLI. It is meant for developers, students, and researchers who want a source-readable visual RAG reference rather than a hosted multi-user product.
| Dev verification | Ready |`.[dev]` runs import, API, notebook, lint, and mocked tests without GPU model downloads. |
17
+
| Real inference | Requires CUDA |`.[gpu]`, model downloads, and a CUDA GPU are required for ColQwen2 and Qwen2.5-VL. |
18
+
| Production deployment | Not hardened | Use a gateway, TLS, restricted CORS, strong token, private logs, and GPU capacity planning first. |
13
19
14
-
The banner above is generated conceptual artwork, not an application screenshot. It illustrates the repository's real workflow: document pages move through visual retrieval, vector search, and local vision-language answer generation.
20
+
No custom web frontend is included in this clean release. The visible product surface is the FastAPI API, CLI, notebook, docs, and tests.
21
+
22
+
## Preview
15
23
16
24

17
25
18
-
The API screenshot is captured from the local FastAPI `/docs` route. See [docs/SCREENSHOTS.md](docs/SCREENSHOTS.md) for capture details.
26
+
This is a real screenshot from the local FastAPI `/docs` route. It shows the actual public API surface.
27
+
28
+

29
+
30
+
This is generated conceptual artwork for repository sharing. It is not a product screenshot and does not show a real query result.
31
+
32
+
## What It Solves
33
+
34
+
Traditional document RAG often starts by extracting text, which can lose layout, tables, charts, figures, and scanned-page context. VisoRAG keeps the document as images first: pages are rendered visually, embedded as page images, retrieved by visual similarity, and passed to a local vision-language model for answering or field extraction.
35
+
36
+
Good fits:
37
+
38
+
- Exploring visual document RAG architecture.
39
+
- Building a local GPU baseline for PDF/image QA.
40
+
- Testing field extraction response contracts.
41
+
- Learning how to package a notebook workflow as a FastAPI/CLI project.
42
+
43
+
Not good fits yet:
44
+
45
+
- CPU-only inference.
46
+
- Hosted multi-user SaaS.
47
+
- Production document ingestion without additional security controls.
48
+
- Persistent vector search over a long-lived document corpus.
19
49
20
50
## Source of Truth
21
51
@@ -26,46 +56,24 @@ The Python package in `src/visorag/` is the contributor-friendly extraction of t
26
56
## Features
27
57
28
58
- Vision-first document QA without OCR-first text extraction.
29
-
- PDF, DOCX, PNG, JPG, and JPEG input support.
30
-
- ColQwen2 page embedding and Qdrant in-memory multivector MaxSim retrieval.
59
+
- PDF, DOCX, PNG, JPG, and JPEG input support in the real GPU runtime.
60
+
- ColQwen2 page embeddings and Qdrant in-memory multivector MaxSim retrieval.
31
61
- Local Qwen2.5-VL answer generation with deterministic generation settings.
32
62
- Flat JSON responses for extraction mode.
33
63
- FastAPI app factory and CLI for local serving and testing.
34
64
- CI-friendly tests that mock heavy GPU/model work.
35
65
36
-
## Tech Stack
37
-
38
-
| Layer | Technology |
39
-
| --- | --- |
40
-
| Language | Python 3.10+ |
41
-
| API | FastAPI, Uvicorn |
42
-
| CLI |`argparse`, HTTPX |
43
-
| Visual retrieval | ColQwen2 via `colpali-engine`|
44
-
| Vector store | Qdrant in-memory multivector collection |
45
-
| Answer generation | Local `Qwen/Qwen2.5-VL-3B-Instruct`|
|`python -m pip install -e ".[gpu]"`| Real visual retrieval and generation on CUDA | Production auth, hosting, monitoring |
72
+
| DOCX support | Requires LibreOffice `soffice` on `PATH`| Not needed for PDF/image input |
65
73
66
74
## Quickstart
67
75
68
-
Clone the repository and install the lightweight development dependencies. This path verifies the package, API wrapper, notebook contract, and mocked tests without downloading GPU models:
76
+
Clone the repository and run the lightweight verification path:
What this proves: the notebook still matches the expected contract, the package imports without loading GPU models, and API/pipeline behavior passes mocked tests. It does not prove real model inference.
88
+
79
89
For real GPU inference, install the GPU extra in a CUDA environment:
80
90
81
91
```bash
82
92
python -m pip install -e ".[gpu]"
83
93
```
84
94
85
-
The notebook was designed around a CUDA GPU runtime such as Google Colab T4. The local Qwen2.5-VL generation path is not CPU-ready. DOCX input also requires LibreOffice's `soffice` executable on `PATH`; PDF and image inputs do not need LibreOffice.
95
+
The notebook was designed around a CUDA GPU runtime such as Google Colab T4. The local Qwen2.5-VL generation path is not CPU-ready. No public sample document is bundled; use only synthetic or public documents when sharing screenshots or issues.
On Windows or any environment where the console script is not on `PATH`, use `python -m visorag`.
113
+
`change-me` and the built-in test token fallback are local-development placeholders, not deployment values. Always set a strong `VISORAG_API_TOKEN` before serving real documents.
104
114
105
115
Health check:
106
116
107
117
```bash
108
-
visorag health --url http://127.0.0.1:8000
118
+
python -m visorag health --url http://127.0.0.1:8000
109
119
```
110
120
111
121
Submit a document:
112
122
113
123
```bash
114
-
visorag query \
124
+
python -m visorag query \
115
125
--url http://127.0.0.1:8000 \
116
126
--token "$VISORAG_API_TOKEN" \
117
-
--file /path/to/invoice.pdf \
118
-
--query "Extract total due and sales tax and invoice number" \
127
+
--file /path/to/document.pdf \
128
+
--query "Extract total due and invoice number" \
119
129
--query-type extraction \
120
130
--top-k 5
121
131
```
@@ -126,7 +136,7 @@ FastAPI routes:
126
136
-`GET /health` returns model-load flags and device info.
127
137
-`POST /query` accepts multipart `file` plus `query`, `query_type`, `document_type`, and `top_k`.
128
138
129
-
More request and response details are in [docs/API_REFERENCE.md](docs/API_REFERENCE.md).
139
+
See [docs/API_REFERENCE.md](docs/API_REFERENCE.md) for status codes, request fields, and both API-layer and pipeline error shapes.
130
140
131
141
## Response Contract
132
142
@@ -147,38 +157,57 @@ Factual and summary modes return:
147
157
}
148
158
```
149
159
150
-
Errors return:
160
+
Pipeline errors include `request_id`; API validation/auth errors may only include `error` and `detail` because the pipeline has not started yet.
151
161
152
-
```json
153
-
{
154
-
"request_id": "uuid",
155
-
"error": "invalid_top_k",
156
-
"detail": "top_k must be between 1 and 20."
157
-
}
158
-
```
162
+
## Tech Stack
159
163
160
-
## Configuration
164
+
| Layer | Technology |
165
+
| --- | --- |
166
+
| Language | Python 3.10+ |
167
+
| API | FastAPI, Uvicorn |
168
+
| CLI |`argparse`, HTTPX |
169
+
| Visual retrieval | ColQwen2 via `colpali-engine`|
170
+
| Vector store | Qdrant in-memory multivector collection |
171
+
| Answer generation | Local `Qwen/Qwen2.5-VL-3B-Instruct`|
Copy `.env.example` and set local values as needed. Important variables:
175
+
## Architecture
163
176
164
-
-`VISORAG_API_TOKEN`: bearer token for `POST /query`.
165
-
-`VISORAG_DEVICE`: expected to be `cuda` for real Qwen2.5-VL inference.
166
-
-`VISORAG_REQUESTS_DIR`: temporary per-request working directory.
167
-
-`VISORAG_QWEN_MAX_PIXELS`: reduce this if a T4 runtime runs out of VRAM.
177
+
```mermaid
178
+
flowchart LR
179
+
A["Upload PDF, DOCX, or image"] --> B["Validate request"]
180
+
B --> C["Render pages as images"]
181
+
C --> D["Embed pages with ColQwen2"]
182
+
D --> E["Index in per-request in-memory Qdrant"]
183
+
F["User query"] --> G["Embed query with ColQwen2"]
184
+
G --> H["Retrieve top visual pages"]
185
+
E --> H
186
+
H --> I["Generate answer with local Qwen2.5-VL"]
187
+
I --> J["Flat JSON extraction or answer response"]
188
+
```
168
189
169
-
See [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) for a beginner setup path and [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for common runtime failures.
190
+
Runtime constraints:
170
191
171
-
## Development
192
+
- Requests are serialized through a process-level query lock.
193
+
- Uploads default to 25 MB.
194
+
- Rendered documents default to 200 pages maximum.
195
+
- Qdrant state is per request and in memory.
196
+
- Uploaded files and rendered pages are temporary by default.
172
197
173
-
The package is organized by feature:
198
+
Longer architecture notes live in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
174
199
175
-
-`src/visorag/features/document_ingestion.py`
176
-
-`src/visorag/features/visual_retrieval.py`
177
-
-`src/visorag/features/answer_generation.py`
178
-
-`src/visorag/pipeline.py`
179
-
-`src/visorag/api/app.py`
200
+
## Documentation Map
180
201
181
-
See [docs/feature-extension.md](docs/feature-extension.md) before adding new behavior.
202
+
| Need | Start here |
203
+
| --- | --- |
204
+
| First setup |[docs/GETTING_STARTED.md](docs/GETTING_STARTED.md)|
205
+
| API clients |[docs/API_REFERENCE.md](docs/API_REFERENCE.md)|
| Contribution model |[CONTRIBUTING.md](CONTRIBUTING.md) and [docs/feature-extension.md](docs/feature-extension.md)|
210
+
| Naming and SEO rationale |[docs/NAMING_SEO_STRATEGY.md](docs/NAMING_SEO_STRATEGY.md)|
182
211
183
212
## Project Structure
184
213
@@ -203,15 +232,15 @@ python -m ruff check .
203
232
python -m pytest
204
233
```
205
234
206
-
Real model inference is intentionally outside the default CI path because it requires CUDA, model downloads, and enough GPU memory.
235
+
Real model inference is intentionally outside the default CI path because it requires CUDA, model downloads, and enough GPU memory. CI proves package/import/API contracts, not production GPU throughput.
207
236
208
237
## Deployment
209
238
210
-
VisoRAG is easiest to run as a long-running Python service on a GPU machine or notebook runtime. Do not expose the FastAPI server directly to the internet without a gateway, TLS, restricted CORS, and a strong bearer token. See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md).
239
+
VisoRAG is easiest to run as a long-running Python service on a GPU machine or notebook runtime. Do not expose the FastAPI server directly to the internet without a gateway, TLS, restricted CORS, a strong bearer token, request-log controls, and dependency/model-license review. See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md).
211
240
212
241
## Security
213
242
214
-
Do not upload private documents to public issues, logs, or CI artifacts. The local API uses bearer-token auth but enables permissive CORS for notebook compatibility. See [SECURITY.md](SECURITY.md) and [docs/security-model.md](docs/security-model.md).
243
+
Do not upload private documents to public issues, logs, or CI artifacts. The local API uses bearer-token auth but enables permissive CORS for notebook compatibility. The runtime may log filenames and query snippets, so disable or restrict logs before processing sensitive documents. See [SECURITY.md](SECURITY.md) and [docs/security-model.md](docs/security-model.md).
215
244
216
245
## Support
217
246
@@ -229,7 +258,7 @@ See [docs/THIRD_PARTY_NOTICES.md](docs/THIRD_PARTY_NOTICES.md) for dependency no
229
258
230
259
## Current Status
231
260
232
-
`READY WITH GAPS`: the source package, docs, CI checks, notebook contract, import smoke, mocked tests, local FastAPI health endpoint, and API docs rendering have been verified. Real GPU inference with ColQwen2 and Qwen2.5-VL is documented but not verified in CI, and internet-facing deployment requires additional hardening.
261
+
`READY WITH GAPS`: the source package, docs, CI checks, notebook contract, import smoke, mocked tests, local FastAPI health endpoint, and API docs rendering have been verified. Real GPU inference with ColQwen2 and Qwen2.5-VL is documented but not verified in CI, internet-facing deployment requires additional hardening, and an actual repository rename would require owner approval.
Copy file name to clipboardExpand all lines: docs/GETTING_STARTED.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
This guide is for a fresh clone of VisoRAG.
4
4
5
+
Dev-only checks do not need a `.env` file. Real serving should always set `VISORAG_API_TOKEN`; placeholder values such as `change-me` or `test_bearer_123` are not deployment values.
6
+
5
7
## What You Can Verify Without a GPU
6
8
7
9
The default development install is lightweight. It verifies packaging, import safety, API contracts, notebook structure, and mocked tests. It does not download or run ColQwen2 or Qwen2.5-VL.
@@ -13,6 +15,8 @@ python scripts/smoke_import.py
13
15
python -m pytest
14
16
```
15
17
18
+
This proves the package and public contracts, not real model inference.
0 commit comments