I. Introduction
Digital documents such as reports, manuals, policies and research papers hold much of the information used in education, administration and business, yet finding a precise answer often means reading many pages or searching several files. Keyword search works when the exact term is known, but it can miss relevant passages when the user phrases the same idea differently. Large language models (LLMs) make it possible to interact with text through natural-language questions. A model used alone, however, answers from its internal parameters and may state things that the user’s document does not support. Retrieval-Augmented Generation addresses this by retrieving relevant passages at query time and supplying them to the model as context1.
Building a useful RAG application involves more than the model call. Source text must be extracted from several formats, chunked, embedded and indexed; retrieval must be tuned; users must be authenticated; and conversations must be stored and kept separate between users. The design question of this work is how to assemble these parts into one browser-accessible workflow, and how honestly its current state can be described. This paper presents Chatify.AI, an implemented full-stack RAG platform. A user registers, uploads a PDF, TXT or CSV file or submits a public URL, and asks questions about the ingested content. The system retrieves relevant chunks with MMR and generates an answer with a Groq-hosted Qwen model, and the frontend renders the answer as formatted Markdown. Chat sessions are saved per user. The contributions are deliberately scoped:
1) An integrated, authenticated RAG workflow that combines file and public-URL ingestion, semantic retrieval with MMR, LLM answer generation and per-user chat history in one application (Sections V, VI and VIII).
2) A mathematical model of the pipeline covering chunk counts, embeddings, cosine similarity, MMR and generation (Section VII).
3) An implementation audit that compares the README with the executable source and lists nine discrepancies and risks with corrective actions (Section IX).
4) A test and evaluation plan with defined test cases, retrieval metrics and performance measures, together with an explicit statement of what has not yet been measured (Section X).
Chatify.AI is an applied engineering implementation. It does not propose a new embedding algorithm or language model, and it does not claim a quantified accuracy level or a zero-hallucination guarantee. The rest of the paper reviews related work, states the problem and gap, describes the architecture, methodology and implementation, reports the audit and evaluation status, and discusses limitations and future work.
II. Background and Related Work
A. Semantic Retrieval and Sentence Embeddings
Lexical retrieval is effective when a query shares words with the relevant passage. Dense retrieval instead represents queries and passages as vectors, so passages with related meaning can be found even without shared terms; Karpukhin et al. showed this for open-domain question answering2. Sentence-BERT adapts transformer encoders to produce sentence embeddings that can be compared with cosine similarity3. Chatify.AI uses the compact all-MiniLM-L6-v2 model, which belongs to the MiniLM family of distilled transformers4, through the Sentence Transformers library.
B. Retrieval-Augmented Generation
Lewis et al. combined a retriever with a sequence-to-sequence generator for knowledge-intensive tasks5, and Gao et al. survey later RAG methods for LLMs, organised around retrieval, generation and augmentation6. A typical pipeline loads sources, chunks them, embeds and indexes the chunks, retrieves passages for a query, and supplies them to a generator. RAG improves grounding because the model sees source text at answer time, but it does not remove hallucination: poor extraction, weak retrieval, ambiguous questions and model limits can still produce unsupported output7.
C. Chunking and Diversity-Aware Retrieval
Long documents are divided into smaller units before embedding, and overlap between adjacent chunks helps preserve context that crosses a boundary. Chunk size and overlap are configuration choices rather than universal optima. Maximal Marginal Relevance selects results by trading query relevance against redundancy with passages already chosen8, which reduces the chance of returning several near-identical chunks while omitting other useful context.
D. Frameworks and Infrastructure
LangChain supplies document loaders, text splitters and retrieval components. ChromaDB provides a persistent vector store with similarity search. The application layer uses FastAPI, React and Vite, with MongoDB accessed asynchronously through Motor. Authentication uses JSON Web Tokens and bcrypt password hashing. LLM inference is provided by the Groq API.
E. Evaluation of RAG Systems
Evaluating RAG separates retrieval quality from answer quality. Es et al. propose reference-free measures of faithfulness, answer relevance and context relevance9. Classical retrieval metrics such as precision and recall at k require a ground-truth set of relevant passages. Chatify.AI’s test plan follows this split (Section X), although none of these measurements has yet been recorded.
F. Positioning
Table I summarises the related approaches. Each addresses one layer of a document question-answering system. Chatify.AI does not introduce a new retrieval or generation technique; its contribution is the integration of these layers into one authenticated, multi-source application, together with a candid audit of that integration.
Table I: Comparison of Related Approaches
|
Approach |
Main capability |
Limitation for this task |
|
Keyword search |
Exact-term matching |
Misses paraphrased passages |
|
Dense retrieval10 |
Meaning-based passage search |
No answer generation |
|
RAG11 |
Grounds generation in retrieved text |
Hallucination not eliminated12 |
|
MMR13 |
Relevance with diversity |
Needs tuned λ |
|
RAG evaluation14 |
Faithfulness and relevance measures |
Needs data and a scoring setup |
|
Chatify.AI |
Authenticated multi-source RAG application |
Unmeasured; audit findings open |
III. Research Problem and Objectives
A. Problem Statement
Users often need specific information from large documents and web pages. Manual reading is slow, keyword search may miss semantic similarity or the surrounding context, and a generic chat model has no access to the user’s source material and may answer without grounding. The problem addressed here is to design and implement an authenticated, browser-accessible platform that (i) accepts common document formats and public URLs, (ii) extracts and prepares text for semantic retrieval, (iii) retrieves relevant passages for a natural-language query, (iv) generates a response based on the retrieved context, (v) keeps user-specific chat history, and (vi) provides a simple interface for ingestion and querying.
B. Objectives
1) Build a web application for asking natural-language questions about user-provided documents and public web pages.
2) Implement a RAG pipeline combining semantic retrieval with LLM generation.
3) Support PDF, TXT and CSV ingestion and public-URL ingestion, as registered in the current loader mapping.
4) Persist embeddings in ChromaDB and retrieve them with MMR.
5) Implement authentication and user-specific chat-history persistence.
6) Report what the system does, compare the documentation with the source, and state what remains unmeasured.
IV. Research Gap and Motivation
The reviewed literature offers strong components: dense retrievers, sentence encoders, RAG formulations and evaluation measures. What is less visible is an application-level account of how these parts are assembled into a multi-user system and how closely a project’s documentation matches its running code. Table II lists the practical gaps Chatify.AI targets. These gaps are drawn from the limitations of the surveyed approaches and of basic file viewers, not from a measured comparison.
Table II: Identified Gaps and the Chatify.AI Approach
|
Gap |
Chatify.AI approach |
|
Keyword search misses paraphrase |
Dense embeddings with MMR retrieval |
|
Separate tools per source type |
One workflow for files and public URLs |
|
Ungrounded generic chat |
Retrieved context and a context-only prompt |
|
Single-user demonstrations |
JWT authentication and per-user chat history |
|
Claims beyond the evidence |
Explicit audit of README versus source; unmeasured items stated |
V. Proposed System Architecture
A. Overview
Figure 1 shows the architecture. A React 18 frontend built with Vite and styled with Tailwind CSS communicates over REST with a FastAPI backend. The backend runs the ingestion pipeline (loader, text splitter, embeddings, ChromaDB), the query pipeline (retrieval, prompt construction, Groq-hosted Qwen generation), and the authentication and history routes. User and chat-session data are stored in MongoDB.
Figure 1: Overall architecture of Chatify.AI.
B. Components and Responsibilities
The system comprises seven modules: (1) the user interface (login, chat, upload and URL modal, history); (2) the FastAPI service layer; (3) the ingestion module (loaders and text splitting); (4) the embedding and vector-storage module; (5) the retrieval and generation module; (6) the authentication module; and (7) the chat-history module backed by MongoDB. Frontend, API, ingestion, retrieval, authentication and persistence responsibilities are kept modular so that each can be changed independently.
C. Deployment
An optional Docker Compose file defines three services: MongoDB (port 27017, named data volume), a backend container (FastAPI and Uvicorn, port 8000, with mounted vector-store directories) and a frontend container (React and Vite, port 5173). The README names MongoDB Atlas as the remote database option, whereas the inspected database module reads MONGODB_URL and defaults to a local URI when it is unset. The Compose file is a deployment option, not evidence that every deployment uses it, and the configuration used for a given demonstration should be stated explicitly.
VI. Methodology and RAG Workflow
A. Ingestion Workflow
An authenticated user selects a file or enters a public URL. A LangChain loader extracts text: the loader mapping covers PDF, TXT and CSV, and WebBaseLoader handles URLs. The extracted text is split with RecursiveCharacterTextSplitter (chunk size 1000, overlap 200). Each chunk is embedded with all-MiniLM-L6-v2 and stored with metadata in a persistent ChromaDB collection named chat_with_data under ./chroma_db. The route then returns an ingestion status. Figure 2 shows the stages.
Figure 2: Document and web-page ingestion workflow.
B. Question-Answering Workflow
The user submits a question from the chat interface. The backend embeds the query, retrieves a candidate pool from ChromaDB, and selects the final passages with MMR. It builds a prompt from the question and the selected context, sends it to the Groq-hosted Qwen model, and returns the answer to the frontend, where it is rendered as Markdown. The conversation is stored as part of the chat history. Figure 3 shows the sequence.
Figure 3: RAG question-answering workflow.
C. Retrieval and Generation Configuration
Table III lists the configuration values taken from the inspected source. The prompt tells the model to answer only from the supplied context, to say when the answer is absent, and to keep responses concise (three to four bullets or under 200 words). Such instructions encourage grounded behaviour, but they cannot guarantee correct answers or rule out hallucination.
Table III: Pipeline Configuration Taken from the Source
|
Parameter |
Value |
|
Text splitter |
Recursive character; size 1000, overlap 200 |
|
Embedding model |
sentence-transformers/all-MiniLM-L6-v2 |
|
Vector store |
ChromaDB, collection chat_with_data |
|
Retrieval |
MMR; k = 4, fetch_k = 10, λ = 0.5 |
|
LLM (source) |
qwen/qwen3.8-27b via ChatGroq |
|
Sampling |
temperature 0.7, top_p 0.9, max_tokens 1000 |
|
Token lifetime |
300 minutes, HS256 |
VII. Mathematical Model
Let D be the set of ingested documents, C the set of chunks, E the embedding function, V the vector index, Q a query, R the retrieved passages and G the generated answer.
A. Chunking
For a text of N characters, chunk size L = 1000 and overlap O = 200, the stride is L − O = 800. Under a simplified fixed-window model the number of chunks is
(1)
For example, a 10,000-character text gives n = 1 + ⌈9000/800⌉ = 13. The recursive splitter chooses boundaries from a list of separators, so actual counts can differ from this estimate.
B. Embedding and Similarity
Each chunk ci is mapped to vi = E(ci) ∈ Rd, and the query to q = E(Q) in the same space. A common similarity measure is
(2)
The distance metric actually configured in the ChromaDB collection should be confirmed from the collection settings and is not assumed here.
C. Maximal Marginal Relevance
Given the set S of already selected passages and 0 ≤ λ ≤ 1, MMR scores a candidate di as15
(3)
The system first fetches fetch_k = 10 candidates and then selects k = 4 with λ = 0.5, giving equal weight to relevance and non-redundancy.
D. Generation
Generation is modelled as
G = LLM(P (Q, R)), (4)
where P builds the prompt from the question and retrieved context. The quality of G depends on extraction, chunking, retrieval relevance, prompt design and model behaviour, so it cannot be derived from the model alone.
VIII. System Implementation and Technologies
A. Technology Stack
Table IV summarises the stack.
Table IV: Technology Stack of Chatify.AI
|
Layer |
Technology |
Role |
|
Frontend |
React 18, Vite, Tailwind CSS |
UI, Markdown rendering, dark/light mode |
|
Backend |
Python, FastAPI, Uvicorn |
REST endpoints, ASGI server |
|
RAG |
LangChain, Sentence Transformers |
Loading, splitting, embeddings |
|
Vector store |
ChromaDB |
Persistent similarity search |
|
LLM |
Groq ChatGroq, Qwen |
Answer generation |
|
Database |
MongoDB, Motor |
Users, chat sessions |
|
Auth |
JWT, OAuth2, Passlib, bcrypt |
Tokens, password hashing |
|
Deployment |
Docker Compose (optional) |
Multi-service execution |
B. API Surface
Table V lists the documented endpoints. In the inspected main.py, /signup and /token are public, while upload, URL ingestion, chat and history routes depend on the current-user dependency.
Table V: API Endpoint Reference
|
Method |
Endpoint |
Purpose |
|
POST |
/signup |
Create an account |
|
POST |
/token |
Authenticate, receive JWT |
|
POST |
/upload |
Ingest PDF, TXT or CSV |
|
POST |
/upload-url |
Ingest a public web page |
|
POST |
/chat |
Query the RAG system |
|
GET |
/history |
List chat sessions |
|
GET |
/history/{id} |
Messages of one session |
|
DELETE |
/history/{id} |
Delete a session |
C. Authentication and Chat History
The authentication module uses OAuth2PasswordBearer, HS256-signed JWTs with a 300-minute lifetime, and Passlib with bcrypt for password hashing. Configuration is read from environment variables (GROQ_API_KEY, MONGODB_URL, SECRET_KEY). Users and chat sessions are stored in MongoDB through Motor, and the API lists, retrieves and deletes sessions.
D. Interface
The frontend is a React single-page application with protected routes, an Axios API client, a tabbed modal for file upload and URL ingestion, Markdown rendering of responses with React Markdown, Lucide icons, and dark and light modes. Figure ?? in Section X shows the running interface.
IX. Implementation Audit: Documentation versus Source
The README and the executable source were treated as separate evidence and compared. Table VI lists the nine inconsistencies and risks found, with the corrective action for each. The report describes the source configuration as the current implementation wherever the two differ.
Findings 4 to 8 bear on multi-user safety. They should be corrected before the system handles sensitive documents for several users, and they are reported here as engineering limitations and not as defects already fixed.
Table VI: Findings from Comparing the README with the Source
|
# |
Finding |
Observed in source |
Recommended action |
|
1 |
LLM provider mismatch |
README names Mistral AI; rag_service.py uses ChatGroq with qwen/qwen3.8-27b |
Treat source as authoritative; update README |
|
2 |
File-format mismatch |
README lists DOC and DOCX; loader maps only PDF, TXT, CSV; the upload dialog also names DOCX |
Add loaders or correct the README and UI text |
|
3 |
URL double ingestion |
URL route calls add_document once without a doc_id, then again with one |
Ingest once, scoped by document ID |
|
4 |
Cross-document fallback and ownership |
Filtered search with no results falls back to the global retriever; /chat does not check chat ownership before retrieval |
Verify ownership first; remove fallback; return a no-context reply |
|
5 |
Development fallback secret |
Auth module contains a fallback signing secret |
Require a strong secret; fail startup if absent |
|
6 |
Permissive CORS |
Defaults to wildcard origins when CORS_ORIGINS is unset |
Use an explicit origin allowlist |
|
7 |
Upload hardening |
Temporary path built from the submitted filename; no evident size limit |
Generate names; set size limits; validate type; guarantee cleanup |
|
8 |
URL ingestion safety |
Scheme validation alone does not prevent server-side request forgery |
Block private, loopback and link-local addresses; validate redirects; limit size and time |
|
9 |
Citation claim |
Service method returns answer text only, with no source references |
Propagate chunk metadata and render citations in the UI |
X. Evaluation Status, Test Plan and Discussion
A. What Has Been Evaluated
The repository documents features and routes but publishes no test report, benchmark dataset, retrieval-accuracy score or latency table, and the test outcomes in the project report are still blank. No functional, retrieval-quality or performance result is therefore claimed in this paper. The sections below define what will be measured; they are a plan, not results.
B. Functional Test Plan
Fourteen test cases are defined (Table VII). All 14 are pending execution on the final build. Cases TC-13 and TC-14 test the security properties highlighted by the audit, and TC-05 is expected to confirm that DOCX is rejected in a controlled manner given the current loader mapping.
Table VII: Defined Functional Test Cases
|
Group |
Focus |
Status |
|
TC-01–03 |
Registration, login, invalid login |
Pending |
|
TC-04–08 |
PDF, DOCX (rejection), TXT/CSV, URL, unsupported file |
Pending |
|
TC-09–10 |
Answerable and unanswerable questions |
Pending |
|
TC-11–12 |
Chat history, session deletion |
Pending |
|
TC-13–14 |
Invalid token, user isolation |
Pending |
|
Total |
14 cases |
0 executed |
C. Retrieval and Performance Measurement Plan
Retrieval quality is to be assessed on a small ground-truth set in which the source passages containing each answer are identified manually. For k retrieved passages,
(5)
Answer faithfulness, relevance and completeness are to be scored by a human evaluator with a fixed rubric, following the faithfulness and relevance split in16. Performance measures are ingestion time (file and URL), query response time, retrieval time, peak memory and failure rate over repeated runs. The dataset size, question categories and scoring method must be reported with any figure, and no accuracy percentage should be stated without this evidence.
D. Interface Evidence
Figure ?? shows screenshots from the running build: the login page, the file-upload and web-URL ingestion dialogs, and two chat sessions, one over an ingested PDF and one over an ingested web page. The upload dialog lists DOCX, which the loader mapping does not support (audit finding 2); TC-05 will confirm that such a file is rejected. The two chats are single illustrative interactions and not evaluation results. In the PDF chat, the reference to Devlin et al. comes from the content of the uploaded document and not from a citation feature, because the system returns no source references (audit finding 9).
Figure 4: Chatify.AI document and web-page ingestion dialogs.
|
(a) File-upload dialog |
(b) Web-URL ingestion dialog |
Figure 5: Chatify.AI chat interface from the running build.
|
(a) Chat over an ingested PDF |
(b) Chat over an ingested web page |
Figure 6: Chatify.AI login page.
E. Discussion
The design places retrieval between the user and the model, restricts the prompt to the supplied context, and keeps authentication, ingestion and storage as separate modules. This supports the claim that the architecture follows a standard RAG pattern. It does not support claims about answer correctness, retrieval quality, latency, user productivity or security in deployment. The audit shows that the current source diverges from its documentation in provider, formats and citations, and that several controls recommended in Section IX are not yet implemented.
XI. Limitations and Future Scope
A. Limitations
No test case has been executed, and no retrieval or latency measurements exist. Scanned PDFs and complex layouts may need OCR or layout-aware extraction, and plain extraction can lose tables and diagrams. Fixed-size chunks can split related statements. Semantically similar passages may not contain the exact answer. Prompt instructions reduce but do not remove hallucination17. Generation depends on an external API whose availability, rate limits and credentials are outside the application’s control. The audit findings on tenant isolation, secrets, CORS, uploads and URL ingestion remain open, and the system returns no source citations. Documents and queries may be sensitive and need access control and retention policies, and a small manually prepared test set cannot establish performance across all document types.
B. Future Scope
The first step is to close audit findings 3 to 9 and then complete the 14 test cases and the retrieval and performance measurements. Further directions include hybrid dense and BM25 search, cross-encoder reranking, adaptive and structure-aware chunking, query rewriting and context compression; source file names, page numbers and highlighted passages shown with each answer; OCR, table extraction and layout-aware parsing for multimodal documents; an evaluation framework tracking precision, recall, faithfulness, latency, token usage and cost; role-based access, per-tenant vector collections, rate limiting and audit logs; permissioned, auditable agentic actions such as document comparison; and background ingestion workers, caching and managed vector infrastructure once workload measurements justify them.
XII. Conclusion
Chatify.AI shows how document processing, semantic retrieval and generative AI can be combined in a full-stack application that answers questions about uploaded files and public web pages. Its pipeline uses LangChain loaders and splitting, Sentence Transformers embeddings, persistent ChromaDB storage, MMR retrieval and Groq-hosted Qwen generation behind a FastAPI and React interface, with JWT authentication and MongoDB-backed chat history. The prototype has clear limits: no executed tests or measured quality figures, no source citations, and open security findings from the documentation-versus-source audit. Within that scope, it provides a concrete, inspectable implementation of multi-source RAG and a defined path toward a benchmarked, hardened system.
Endnotes
1. P. Lewis et al., “Retrieval-augmented generation for knowledge-intensive NLP tasks,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 33, 2020.
2. V. Karpukhin et al., “Dense passage retrieval for open-domain question answering,” in Proc. Conf. Empirical Methods Natural Language Process. (EMNLP), 2020, pp. 6769–6781.
3. N. Reimers and I. Gurevych, “Sentence-BERT: Sentence embeddings using Siamese BERT-networks,” in Proc. EMNLP-IJCNLP, 2019, pp. 3982–3992.
4. W. Wang et al., “MiniLM: Deep self-attention distillation for task-agnostic compression of pre-trained transformers,” in Advances in Neural Information Processing Systems (NeurIPS), 2020.
5. P. Lewis et al., “Retrieval-augmented generation for knowledge-intensive NLP tasks,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 33, 2020.
6. Y. Gao et al., “Retrieval-augmented generation for large language models: A survey,” arXiv:2312.10997, 2023.
7. Z. Ji et al., “Survey of hallucination in natural language generation,” ACM Comput. Surv., vol. 55, no. 12, Art. no. 248, 2023.
8. J. Carbonell and J. Goldstein, “The use of MMR, diversity-based reranking for reordering documents and producing summaries,” in Proc. 21st Annu. Int. ACM SIGIR Conf. Res. Develop. Inf. Retrieval, 1998, pp. 335–336.
9. S. Es, J. James, L. Espinosa-Anke, and S. Schockaert, “RAGAS: Automated evaluation of retrieval augmented generation,” arXiv:2309.15217, 2023.
10. V. Karpukhin et al., “Dense passage retrieval for open-domain question answering,” in Proc. Conf. Empirical Methods Natural Language Process. (EMNLP), 2020, pp. 6769–6781; N. Reimers and I. Gurevych, “Sentence-BERT: Sentence embeddings using Siamese BERT-networks,” in Proc. EMNLP-IJCNLP, 2019, pp. 3982–3992.
11. P. Lewis et al., “Retrieval-augmented generation for knowledge-intensive NLP tasks,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 33, 2020; Y. Gao et al., “Retrieval-augmented generation for large language models: A survey,” arXiv:2312.10997, 2023.
12. Z. Ji et al., “Survey of hallucination in natural language generation,” ACM Comput. Surv., vol. 55, no. 12, Art. no. 248, 2023.
13. J. Carbonell and J. Goldstein, “The use of MMR, diversity-based reranking for reordering documents and producing summaries,” in Proc. 21st Annu. Int. ACM SIGIR Conf. Res. Develop. Inf. Retrieval, 1998, pp. 335–336.
14. S. Es, J. James, L. Espinosa-Anke, and S. Schockaert, “RAGAS: Automated evaluation of retrieval augmented generation,” arXiv:2309.15217, 2023.
15. J. Carbonell and J. Goldstein, “The use of MMR, diversity-based reranking for reordering documents and producing summaries,” in Proc. 21st Annu. Int. ACM SIGIR Conf. Res. Develop. Inf. Retrieval, 1998, pp. 335–336.
16. S. Es, J. James, L. Espinosa-Anke, and S. Schockaert, “RAGAS: Automated evaluation of retrieval augmented generation,” arXiv:2309.15217, 2023.
17. Z. Ji et al., “Survey of hallucination in natural language generation,” ACM Comput. Surv., vol. 55, no. 12, Art. no. 248, 2023.