Implemented project · Personal reference
AI Data Platform
Index synthetic document revisions into chunks, rank tenant-scoped results, and return extractive passages with source citations. The cloud serving layer is a reference design.
Context and requirements
Keep answers traceable to source content while supporting document revisions and deletion.
Reject malformed documents, preserve access metadata, and define expected citations and refusal behavior on labeled queries.
Architecture
- Document ingestion
- Parsing
- Validation
- Chunking
- Embeddings
- Vector indexing
- Authorized retrieval
- Reranking
- Generation
- Citations
- Evaluation
- Monitoring
Alternatives and implementation
Local design uses document parsing, FastAPI, Qdrant or pgvector and a local embedding model. Azure uses Blob Storage or ADLS, Azure AI Search and Azure OpenAI.
Download executable Python reference · Download test suite · License
Save the Python lab sources from the project directory inside a folder named labs. From its parent, run python3 -m labs.ai_document_pipeline. To run the shared suite, place test_labs.py next to the folder and run python3 -m unittest test_labs.
Security, cost and operations
Validate permissions before retrieval, propagate deletes to caches and treat document text as data. Compare recall, citation accuracy, p95 latency and token cost.
Results and lessons
The local tests verify chunk offsets, exact citations, revision changes, deletion and tenant scoping. The prototype uses deterministic hashed features and extractive passages. Managed embeddings, reranking and generated answers are architecture options.
Use the executable evaluation baseline to gate future vector retrieval and generation. Capture the index, model and prompt versions with each run.