cd /news/ai-tools/how-i-built-a-pdf-chat-api-in-one-da… · home topics ai-tools article
[ARTICLE · art-126687] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

How I Built a PDF Chat API in One Day with FastAPI, Gemini, and Qdrant

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.

by read2 min views6 publishedSep 11, 2026

Have you ever wanted to just talk to a PDF instead of reading through 50 pages?

I 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.

#

What it does

  • Upload any PDF document
  • Ask questions about its content in natural language
  • Get accurate answers powered by RAG (Retrieval Augmented Generation)
  • Clean web UI included — no frontend framework needed
  • REST API with authentication for easy integration

#

Tech Stack

FastAPI — REST API backend #

Google Gemini — embeddings (gemini-embedding-001 ) + chat (gemini-2.5-flash ) #

LangChain — RAG pipeline orchestration #

Pure HTML/CSS — no React, no framework

#

How it works

The architecture is classic RAG in two phases:

Ingestion (upload):

  1. Extract text from PDF
  2. Split into chunks (1000 chars, 200 overlap)
  3. Generate embeddings with Gemini
  4. Store in Qdrant

Query (chat):

  1. Embed the user's question
  2. Search Qdrant for the 4 most relevant chunks
  3. Send chunks + question to Gemini
  4. Return the answer

#

The code

The core is surprisingly simple:

That's the entire RAG chain — retrieve relevant context, inject into prompt, generate answer.

#

What I learned

  • Gemini embeddings produce 3072-dimensional vectors (not 768 like older models)

grpcio on Windows can be a pain — pin to version 1.62.2

  • Qdrant Cloud free tier is genuinely useful for side projects
  • Building a clean UI in pure HTML/CSS takes less time than setting up React

#

  Try it yourself

👉 [https://elyassdigital.gumroad.com/l/zcgjmmz](https://elyassdigital.gumroad.com/l/zcgjmmz)

#

What's next

  • Multi-user support with separate collections per user

  • Docker deployment guide

  • Support for other document types (Word, Excel) Built this as a side project — happy to answer questions in the comments!

── more in #ai-tools 4 stories · sorted by recency
── more on @fastapi 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-i-built-a-pdf-ch…] indexed:0 read:2min 2026-09-11 ·