← Back to projects

Enterprise AI Lakehouse

A full-stack Medallion Architecture (Bronze → Silver → Gold) data lakehouse and Retrieval-Augmented Generation (RAG) workspace that turns unstructured logs, telemetry, JSON, and PDFs into 384-dimensional vector indices and grounded, cited answers.

ReactVitePalantir BlueprintFastAPIPythonApache ParquetDelta LakeNumPyGoogle Gemini
Enterprise AI Lakehouse cover

Introduction

Enterprise AI Lakehouse is a full-stack data engineering and RAG workspace built around a simple idea: refine unstructured data systematically, then retrieve with verifiable provenance. Instead of feeding raw, uncurated documents directly into a language model, the platform processes incoming logs and PDFs through an Azure Databricks + Delta Lake Medallion Architecture (Bronze → Silver → Gold) before serving semantic search and grounded Q&A.

The system ingests raw documents with provenance metadata, cleans and splits text using a sliding-window chunker, generates 384-dimensional unit-normalized vector embeddings, upserts records with MERGE INTO semantics, and answers questions with clickable document and chunk citations.

Why I built it

Most RAG demos treat ingestion as a black box—upload a file and immediately query a vector store. In real data engineering workflows, teams need visibility into how raw data becomes retrieval-ready context: schema enforcement, chunk boundaries, transaction audit logs, and stage-by-stage latencies.

Building Enterprise AI Lakehouse brought the Medallion data pipeline and the conversational RAG interface together in one workspace. A reliable answer requires more than an LLM response—it needs clean chunking, deterministic vector indexing, transparent _delta_log auditability, and a provenance panel where every claim can be checked against its source chunk.

Core features

  • Multi-format ingestion: Upload .pdf, .txt, .log, .json, .csv, and .md files, paste raw text, or run with pre-seeded EV charging station telemetry (DOC_101, DOC_102, DOC_103).
  • Bronze layer (default.bronze_unstructured_docs): Append-only raw landing Parquet table enriched with _ingested_at (UTC timestamp) and _file_source provenance metadata.
  • Silver layer (default.silver_chunked_docs): Drops empty/null entries, deduplicates records, and applies a 40-word sliding-window chunker with a 10-word overlap (<document_id>_CHK_<index>).
  • Gold layer (default.gold_vector_index): Generates 384-dimensional L2-normalized dense embeddings with strict schema enforcement and ACID MERGE INTO upsert semantics.
  • Delta Lake _delta_log simulation: Records JSON commit history (WRITE_APPEND, DELTA_MERGE_UPSERT) per layer, inspectable directly from the dashboard.
  • OpenMetadata-inspired Data Catalog: Unified Overview showing live document, chunk, and embedding counts, stage latencies, registered table schemas, and pipeline execution history.
  • Semantic Vector Search: Low-latency cosine similarity retrieval over Gold embeddings with Top-K selection, similarity percentages, and broad/summary query detection.
  • Dify-inspired RAG Assistant: Multi-turn conversational interface backed by /api/chat and Google Gemini (gemini-2.5-flash), paired with a Source Provenance panel displaying document_id, chunk_id, similarity bars, and retrieved chunk text.
  • PySpark & Delta SQL parity: Built-in Pipeline Architecture view comparing the local Pandas/Parquet simulation side-by-side with production Databricks PySpark and Delta SQL syntax.

How it works

  1. Ingest raw data: A user uploads a PDF, log, JSON, or text document (or triggers a pipeline run on the pre-seeded EV station logs).
  2. Land in Bronze: FastAPI enriches the raw payload with _ingested_at and _file_source, writes bronze_records.parquet, and appends a JSON commit to bronze/_delta_log/.
  3. Refine in Silver: The pipeline cleans and deduplicates records, then splits text into 40-word overlapping chunks written to silver_chunks.parquet.
  4. Vectorize & Merge in Gold: Each chunk is embedded into a 384-dimensional unit-normalized vector and upserted into gold_vectors.parquet using chunk_id MERGE INTO logic.
  5. Retrieve evidence: Incoming queries are embedded with the same engine and matched via cosine similarity against the Gold index (with sequential chunk retrieval for broad summary questions).
  6. Generate cited answers: /api/chat grounds Google Gemini with the top retrieved chunks and conversation history, returning the response alongside chunk-level provenance to the React dashboard.

The React frontend communicates with FastAPI via an /api proxy (Vite dev proxy locally, vercel.json rewrites in production).

Use cases

  • Enterprise log & telemetry analysis: Ingest operational logs, alerts, and utilization reports, inspect how they are chunked and indexed across Medallion layers, and query incidents with natural language.
  • PDF document Q&A with provenance: Upload technical PDFs or reports, extract text automatically, and ask multi-turn questions while verifying every answer against the retrieved chunks and similarity scores.
  • Data engineering & Medallion architecture demonstration: Explore how Bronze, Silver, and Gold tables, _delta_log commits, and MERGE INTO upserts work together in a lightweight, runnable workspace with PySpark code parity.

Tech stack

  • React 19, Vite, and Palantir Blueprint (@blueprintjs/core, @blueprintjs/icons): Light-themed enterprise SaaS dashboard, data catalog tables, sidebar navigation, dialogs, and RAG workspace.
  • Python, FastAPI, Uvicorn, and Pydantic: REST API routing (/api/upload, /api/pipeline/run, /api/bronze, /api/silver, /api/gold, /api/search, /api/chat, /api/delta-log/{layer}), request validation, and OpenAPI docs.
  • Pandas, PyArrow / FastParquet, and NumPy: Columnar Apache Parquet storage, sliding-window chunking, and vectorized cosine similarity search.
  • 384-d Vector Engine: Deterministic semantic hash-projection engine (with optional local all-MiniLM-L6-v2 SentenceTransformer support) producing L2-normalized 384-dimensional embeddings.
  • PyMuPDF (fitz) / pypdf: PDF text extraction during ingestion.
  • Google Gemini (gemini-2.5-flash): Grounded conversational answer synthesis via google-generativeai locally or direct Gemini REST fallback in serverless environments.
  • Vercel (vercel.json + api/index.py): Single-repo deployment serving the static Vite build (frontend/dist) and FastAPI serverless backend.

Engineering challenges

  • Preserving context across chunk boundaries: Fixed splits can cut off error codes or metrics mid-sentence. Using a 40-word sliding window with a 10-word overlap in the Silver layer keeps boundary context intact for downstream vector search.
  • Handling both targeted and broad summary queries: Pure cosine similarity struggles when users ask "summarize this document" or "what is in the PDF?". The search engine detects broad/summary intent and retrieves sequential chunks sorted by chunk_id while filtering out boilerplate disclaimers.
  • Fitting a Python data stack into Vercel's 500 MB serverless limit: Heavy local ML and Arrow dependencies (torch, sentence-transformers, pyarrow, pymupdf, google-generativeai) exceed serverless size caps. Using fastparquet, pypdf, NumPy-based deterministic semantic vectors, and a lightweight Gemini REST fallback reduced the Vercel Python bundle to ~242 MB while keeping local full-stack parity.
  • Read-only serverless filesystem: Vercel's deployment directory is read-only at runtime, so the backend automatically routes Parquet and _delta_log writes to /tmp/lakehouse_data when VERCEL is detected.

Performance and evaluation

The dashboard tracks and displays live record counts (total_documents, total_chunks, total_embeddings), average chunk word length, and per-stage execution timings (bronze_ms, silver_ms, gold_ms, total_ms) from /api/stats, as well as per-query search and RAG response latencies. Because local embeddings default to a deterministic semantic hash-projection engine for zero-download speed, retrieval quality trades off deep transformer semantics for instant startup and predictable serverless execution.

Improvements I want to make

  • Hosted vector & lakehouse persistence: Connect the Gold layer to a managed vector database or object storage (e.g., S3 / Azure Blob / Databricks) so uploaded documents persist across serverless cold starts.
  • Cross-encoder reranking: Add a secondary reranking stage over top-K Gold candidates to improve precision on complex multi-document queries.
  • Incremental Change Data Feed (CDF): Process only newly appended Bronze/Silver records during pipeline runs instead of recomputing full tables.
  • Automated retrieval benchmarks: Add a reproducible test suite measuring chunk recall, citation faithfulness, and end-to-end RAG latency.

What I learned

Building an AI lakehouse showed that RAG quality is determined upstream of the LLM: ingestion provenance, deduplication, overlapping chunk windows, strict vector schema enforcement, and clear source citations matter just as much as the generation model itself. Packaging both a columnar Parquet pipeline and a Palantir Blueprint + Dify-inspired frontend into a single Vercel-ready repository tied the data engineering and product layers together end to end.

Visit site · GitHub