Skip to main content

AI / RAG Document Intelligence

AskDocs v2

Full-stack RAG platform for querying PDF collections with source-grounded AI answers and page-level citations.

AskDocs is a full-stack Retrieval-Augmented Generation system that turns PDF collections into searchable knowledge bases and produces contextual AI answers backed by verifiable document citations.

ROLE
Full-Stack AI Engineer
YEAR
2026

TECH_STACK

Technologies

RAG
OpenAI
pgvector
NestJS
Next.js
PostgreSQL
LangChain
React
TypeScript
Node.js
Vector Embeddings
Semantic Search
RecursiveCharacterTextSplitter
pdf-parse
React-PDF
Tailwind CSS
shadcn/ui
REST API
Docker
Jest
Vitest

VIDEO DOCUMENTATION

Video documentation

EXTERNAL_MEDIA_BLOCKED

This project video is hosted on YouTube. Enable external media in cookie settings to load the embed here.

(En) AskDocs — Full-Stack RAG Document Intelligence Demo

CONTEXT

Technical context

AskDocs was built as a production-oriented document intelligence system rather than a simple chatbot. It combines persistent conversations, document management, semantic retrieval, streaming AI responses and direct access to cited PDF pages in one workflow.

MEDIA

Project media

Workspace (DarkMode)

PROBLEM

Problem

Large PDF collections are difficult to search efficiently, while generic LLM responses can be difficult to verify. The goal was to build a system that retrieves only relevant document context, keeps answers grounded in source material and makes every important claim traceable back to the original document.

FILES

Project files

OVERVIEW

Project overview

AskDocs lets users upload PDF documents, organize them around persistent conversations and ask natural-language questions across either the current chat's documents or the entire document library. Documents are parsed, chunked, embedded and indexed in PostgreSQL with pgvector before relevant context is retrieved for each question.

Answers are streamed in real time and remain tied to their supporting sources through persistent citations that open the original PDF at the relevant page. The system also includes AI-generated chat titles, bilingual SK/EN support, document lifecycle management, conversation recovery, prompt-injection boundaries and a dedicated RAG evaluation pipeline.

APPROACH

Technical approach

  • Built a complete PDF ingestion pipeline with parsing, chunking, embeddings and pgvector indexing
  • Implemented retrieval scopes for chat-specific documents and the complete document library
  • Combined semantic retrieval with context budgeting, deduplication and citation-aware prompting
  • Added persistent conversations with streamed responses and robust complete, stopped, error and interrupted states
  • Stored original PDFs in PostgreSQL and connected citations directly to the relevant PDF pages
  • Separated AI chat-title generation from the main RAG response pipeline
  • Added SK/EN localization, security boundaries and deterministic RAG evaluation

FOCUS

Technical focus

  • Retrieval-Augmented Generation
  • Vector Search and Semantic Retrieval
  • LLM Integration and Streaming
  • Document Ingestion and PDF Processing
  • Persistent Conversational State
  • Citation and Source Grounding
  • Context Budgeting and Retrieval Quality
  • AI Security and Prompt Trust Boundaries
  • Full-Stack TypeScript Architecture
  • Automated RAG Evaluation

ARCHITECTURE

Architecture notes

  • Next.js frontend communicates with a NestJS API responsible for conversations, documents, RAG orchestration and streaming
  • PostgreSQL is the primary persistence layer for conversations, messages, document metadata and original PDF content
  • pgvector stores document embeddings and enables semantic similarity retrieval
  • PDF ingestion follows a parse → chunk → embed → index pipeline
  • Queries follow a scope filter → retrieval → deduplication → context budget → LLM generation → citation pipeline
  • Streaming assistant turns use guarded terminal state transitions to preserve complete, stopped, error and interrupted states
  • Citations are persisted with message history and connected to the original PDF viewer
  • AI-generated chat titles run independently from the main answer model so metadata generation does not block response streaming

HIGHLIGHTS

Engineering highlights

  • Source-grounded RAG answers with persistent citations
  • Per-chat and global document retrieval scopes
  • Integrated PDF viewer with page-level citation navigation
  • Persistent multi-chat conversations with streamed responses
  • PostgreSQL and pgvector-based document and vector storage
  • AI-generated conversation titles with manual rename protection
  • SK/EN localization across the application
  • Prompt-injection and document trust-boundary protections
  • Unit, integration, end-to-end and deterministic RAG evaluation coverage

OUTCOME

Outcome

The result is a complete, tested RAG application with persistent multi-chat workflows, per-chat document collections, global retrieval, streamed answers, source citations, an integrated PDF viewer and a PostgreSQL/pgvector backend. The final codebase is covered by unit, integration, end-to-end and deterministic RAG evaluation tests.