{"slug": "how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant", "title": "How I Built a PDF Chat API in One Day with FastAPI, Gemini, and Qdrant", "summary": "A developer built a PDF Chat API in a single day using FastAPI, Google Gemini, Qdrant, and LangChain, enabling users to upload PDFs and ask natural-language questions answered through a retrieval-augmented generation pipeline. The system extracts and chunks PDF text, generates embeddings with Gemini's gemini-embedding-001 model, stores them in Qdrant for semantic search, and returns answers via gemini-2.5-flash. The developer noted that Gemini embeddings produce 3072-dimensional vectors and shared the project as a side build with plans for multi-user support and Docker deployment.", "body_md": "Have you ever wanted to just *talk* to a PDF instead of reading through 50 pages?\n\nI built a full PDF Chat API in one day — upload any PDF, ask questions in natural language, and get AI-powered answers. Here's how I did it.\n\n## \n  \n  \n  What it does\n\n- Upload any PDF document\n- Ask questions about its content in natural language\n- Get accurate answers powered by RAG (Retrieval Augmented Generation)\n- Clean web UI included — no frontend framework needed\n- REST API with authentication for easy integration\n\n## \n  \n  \n  Tech Stack\n\n- \n**FastAPI** — REST API backend\n- \n**Google Gemini** — embeddings (`gemini-embedding-001` ) + chat (`gemini-2.5-flash` )\n- \n**Qdrant** — vector database for semantic search\n- \n**LangChain** — RAG pipeline orchestration\n- \n**Pure HTML/CSS** — no React, no framework\n\n## \n  \n  \n  How it works\n\nThe architecture is classic RAG in two phases:\n\n**Ingestion (upload):**\n\n1. Extract text from PDF\n2. Split into chunks (1000 chars, 200 overlap)\n3. Generate embeddings with Gemini\n4. Store in Qdrant\n\n**Query (chat):**\n\n1. Embed the user's question\n2. Search Qdrant for the 4 most relevant chunks\n3. Send chunks + question to Gemini\n4. Return the answer\n\n## \n  \n  \n  The code\n\nThe core is surprisingly simple:\n\nThat's the entire RAG chain — retrieve relevant context, inject into prompt, generate answer.\n\n## \n  \n  \n  What I learned\n\n- Gemini embeddings produce 3072-dimensional vectors (not 768 like older models)\n- \n`grpcio` on Windows can be a pain — pin to version 1.62.2\n- Qdrant Cloud free tier is genuinely useful for side projects\n- Building a clean UI in pure HTML/CSS takes less time than setting up React\n\n## \n  \n  \n  Try it yourself\n\n👉 [https://elyassdigital.gumroad.com/l/zcgjmmz](https://elyassdigital.gumroad.com/l/zcgjmmz)\n\n## \n  \n  \n  What's next\n\n- Multi-user support with separate collections per user\n- Docker deployment guide\n- Support for other document types (Word, Excel)\n\nBuilt this as a side project — happy to answer questions in the comments!", "url": "https://wpnews.pro/news/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant", "canonical_source": "https://dev.to/elyass_43b15fee1a28f165db/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant-1j94", "published_at": "2026-09-11 08:07:01+00:00", "updated_at": "2026-09-11 08:33:10.825657+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "generative-ai", "developer-tools", "ai-products"], "entities": ["FastAPI", "Google Gemini", "Qdrant", "LangChain", "gemini-embedding-001", "gemini-2.5-flash"], "alternates": {"html": "https://wpnews.pro/news/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant", "markdown": "https://wpnews.pro/news/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant.md", "text": "https://wpnews.pro/news/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant.txt", "jsonld": "https://wpnews.pro/news/how-i-built-a-pdf-chat-api-in-one-day-with-fastapi-gemini-and-qdrant.jsonld"}}