Skip to content

Commit df7f5a7

Browse files
committed
Improve GitHub identity and SEO docs
1 parent eaf2738 commit df7f5a7

15 files changed

Lines changed: 401 additions & 86 deletions

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ python -m pytest
2121

2222
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.
2323

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+
2431
## Pull Request Checklist
2532

2633
- Notebook JSON parses and code cells AST-parse without executing GPU models.

README.md

Lines changed: 102 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
11
# VisoRAG
22

3-
Vision-first document RAG with ColQwen2, Qwen2.5-VL, Qdrant, and FastAPI for PDF/image question answering and field extraction.
3+
**VisualDocQA Kit for local GPU document RAG.**
4+
5+
Vision-first document RAG with ColQwen2, Qwen2.5-VL, Qdrant, and FastAPI for PDF, DOCX, and image question answering and field extraction.
46

57
[![CI](https://github.com/RossDmello2/visorag/actions/workflows/ci.yml/badge.svg)](https://github.com/RossDmello2/visorag/actions/workflows/ci.yml)
68
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
79

8-
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 developers and 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.
911

10-
## Preview
12+
## Read This First
1113

12-
![Conceptual VisoRAG document retrieval flow](docs/assets/brand/hero.png)
14+
| Area | Status | What it means |
15+
| --- | --- | --- |
16+
| 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. |
1319

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
1523

1624
![Real FastAPI Swagger documentation for VisoRAG](docs/assets/screenshots/api-docs.png)
1725

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+
![Conceptual VisoRAG social preview showing document pages flowing through retrieval into a JSON answer](docs/assets/brand/social-preview.png)
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.
1949

2050
## Source of Truth
2151

@@ -26,46 +56,24 @@ The Python package in `src/visorag/` is the contributor-friendly extraction of t
2656
## Features
2757

2858
- 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.
3161
- Local Qwen2.5-VL answer generation with deterministic generation settings.
3262
- Flat JSON responses for extraction mode.
3363
- FastAPI app factory and CLI for local serving and testing.
3464
- CI-friendly tests that mock heavy GPU/model work.
3565

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` |
46-
| Document rendering | PyMuPDF, Pillow, LibreOffice for DOCX conversion |
47-
| Tests and checks | Pytest, Ruff, notebook JSON/AST contract checks |
48-
49-
## Architecture
50-
51-
```mermaid
52-
flowchart LR
53-
A["Upload PDF, DOCX, or image"] --> B["Validate request"]
54-
B --> C["Render pages as images"]
55-
C --> D["Embed pages with ColQwen2"]
56-
D --> E["Index in per-request in-memory Qdrant"]
57-
F["User query"] --> G["Embed query with ColQwen2"]
58-
G --> H["Retrieve top visual pages"]
59-
E --> H
60-
H --> I["Generate answer with local Qwen2.5-VL"]
61-
I --> J["Flat JSON extraction or answer response"]
62-
```
66+
## Install Modes
6367

64-
Longer architecture notes live in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
68+
| Install | Use it for | Does not include |
69+
| --- | --- | --- |
70+
| `python -m pip install -e ".[dev]"` | Static checks, notebook contract, API tests, mocked pipeline tests | ColQwen2/Qwen2.5-VL runtime validation |
71+
| `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 |
6573

6674
## Quickstart
6775

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:
6977

7078
```bash
7179
git clone https://github.com/RossDmello2/visorag.git
@@ -76,21 +84,23 @@ python scripts/smoke_import.py
7684
python -m pytest
7785
```
7886

87+
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+
7989
For real GPU inference, install the GPU extra in a CUDA environment:
8090

8191
```bash
8292
python -m pip install -e ".[gpu]"
8393
```
8494

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.
8696

87-
## API
97+
## API Usage
8898

8999
Start the local API:
90100

91101
```bash
92102
export VISORAG_API_TOKEN="change-me"
93-
visorag serve --host 127.0.0.1 --port 8000
103+
python -m visorag serve --host 127.0.0.1 --port 8000
94104
```
95105

96106
PowerShell:
@@ -100,22 +110,22 @@ $env:VISORAG_API_TOKEN = "change-me"
100110
python -m visorag serve --host 127.0.0.1 --port 8000
101111
```
102112

103-
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.
104114

105115
Health check:
106116

107117
```bash
108-
visorag health --url http://127.0.0.1:8000
118+
python -m visorag health --url http://127.0.0.1:8000
109119
```
110120

111121
Submit a document:
112122

113123
```bash
114-
visorag query \
124+
python -m visorag query \
115125
--url http://127.0.0.1:8000 \
116126
--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" \
119129
--query-type extraction \
120130
--top-k 5
121131
```
@@ -126,7 +136,7 @@ FastAPI routes:
126136
- `GET /health` returns model-load flags and device info.
127137
- `POST /query` accepts multipart `file` plus `query`, `query_type`, `document_type`, and `top_k`.
128138

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.
130140

131141
## Response Contract
132142

@@ -147,38 +157,57 @@ Factual and summary modes return:
147157
}
148158
```
149159

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.
151161

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
159163

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` |
172+
| Document rendering | PyMuPDF, Pillow, LibreOffice for DOCX conversion |
173+
| Tests and checks | Pytest, Ruff, notebook JSON/AST contract checks |
161174

162-
Copy `.env.example` and set local values as needed. Important variables:
175+
## Architecture
163176

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+
```
168189

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:
170191

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.
172197

173-
The package is organized by feature:
198+
Longer architecture notes live in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
174199

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
180201

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) |
206+
| Architecture | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) |
207+
| Deployment | [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) |
208+
| Troubleshooting | [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) |
209+
| 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) |
182211

183212
## Project Structure
184213

@@ -203,15 +232,15 @@ python -m ruff check .
203232
python -m pytest
204233
```
205234

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.
207236

208237
## Deployment
209238

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).
211240

212241
## Security
213242

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).
215244

216245
## Support
217246

@@ -229,7 +258,7 @@ See [docs/THIRD_PARTY_NOTICES.md](docs/THIRD_PARTY_NOTICES.md) for dependency no
229258

230259
## Current Status
231260

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.
233262

234263
## License
235264

SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Do not open public issues containing private documents, API tokens, stack traces
1212

1313
- The API is intended for local use unless it is deployed behind a hardened gateway.
1414
- `POST /query` requires a bearer token from `VISORAG_API_TOKEN`.
15+
- Built-in demo token defaults and `.env.example` placeholders are for local development only.
1516
- CORS is permissive to preserve the notebook API behavior; restrict it before internet deployment.
16-
- Uploaded documents may contain sensitive data and should not be logged or committed.
17+
- Uploaded documents, filenames, and query snippets may contain sensitive data and should not be logged or committed.
1718
- File parsing for PDFs, DOCX files, and images has supply-chain and malformed-file risk.
1819
- Prompt injection is possible when untrusted document content controls visible text.
1920
- GPU runtime dependencies and model weights inherit their own licenses and security posture.

docs/API_REFERENCE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ Multipart form fields:
4242
| `document_type` | No | Defaults to the uploaded file extension in the API |
4343
| `top_k` | No | Integer from `1` to `20`; defaults to `5` |
4444

45+
Runtime limits:
46+
47+
- Uploads default to 25 MB.
48+
- Documents default to 200 rendered pages maximum.
49+
- Queries are serialized by a process-level lock.
50+
- Qdrant state is in memory and scoped to the request.
51+
4552
Example:
4653

4754
```bash
@@ -70,10 +77,30 @@ Extraction responses are flat JSON:
7077

7178
Errors:
7279

80+
API validation and authentication errors can return only `error` and `detail` because the pipeline has not started:
81+
82+
```json
83+
{"error": "unauthorized", "detail": "Missing Bearer token."}
84+
```
85+
86+
Pipeline errors include a `request_id`:
87+
7388
```json
7489
{
7590
"request_id": "uuid",
7691
"error": "invalid_top_k",
7792
"detail": "top_k must be between 1 and 20."
7893
}
7994
```
95+
96+
## Status Codes
97+
98+
| Code | Meaning |
99+
| --- | --- |
100+
| `200` | Successful health check, service metadata, factual/summary answer, or extraction JSON. |
101+
| `400` | Missing query/file, unsupported file type, invalid `top_k`, invalid document/query type, or document type mismatch. |
102+
| `401` | Missing or invalid bearer token. |
103+
| `413` | Upload exceeds `VISORAG_MAX_UPLOAD_BYTES`. |
104+
| `422` | Document rendering produced no pages or retrieval returned no pages. |
105+
| `500` | Embedding, Qdrant, or unexpected pipeline failure. |
106+
| `503` | Local Qwen2.5-VL inference failed or is unavailable. |

docs/DEPLOYMENT.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ VisoRAG is a GPU-backed Python API. Treat it as a long-running service, not a st
1616
- Public internet exposure of the raw Uvicorn server.
1717
- Serverless hosting that cannot provide persistent GPU runtime or large model downloads.
1818
- Multi-user production workloads without a real auth layer, quotas, audit logs, and request isolation.
19+
- Using the fallback demo token or placeholder `.env.example` values.
20+
- Processing sensitive documents while request logs include filenames or query snippets.
1921

2022
## Local Service Command
2123

@@ -30,7 +32,7 @@ Use `127.0.0.1` for local-only testing.
3032

3133
- Replace the example token with a high-entropy secret.
3234
- Restrict CORS in `api/app.py` or at the gateway.
33-
- Disable sensitive request/response logging.
35+
- Disable or restrict sensitive request/response logging. The current runtime may log filenames and query snippets.
3436
- Keep uploaded files and rendered page images out of source control and CI artifacts.
3537
- Patch dependencies and model runtime packages regularly.
3638
- Review upstream model and package licenses before redistribution.

docs/GETTING_STARTED.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This guide is for a fresh clone of VisoRAG.
44

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+
57
## What You Can Verify Without a GPU
68

79
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
1315
python -m pytest
1416
```
1517

18+
This proves the package and public contracts, not real model inference.
19+
1620
## Real Inference Requirements
1721

1822
Real document question answering requires:

0 commit comments

Comments
 (0)