Environment Variables in FastAPI — Managing Secrets the Right Way

Posted on Tue 28 September 2027 in Tutorial • Tagged with FastAPI, Python, environment-variables, security, pydantic-settings, deployment

Why This Matters

Almost every FastAPI app eventually needs something it shouldn't have hardcoded in the source code: a database URL, an LLM API key, a JWT secret, a third-party service token. When you're building GenAI apps, this shows up on day one, because you can't call an LLM API …


Continue reading

Why FastAPI Auto-Generates API Docs (And How to Customize Them)

Posted on Mon 27 September 2027 in Tutorial • Tagged with FastAPI, Python, API-docs, Swagger, OpenAPI

Why This Matters

If you've built even a basic FastAPI app, you've probably stumbled onto /docs and been pleasantly surprised — a fully interactive API documentation page, complete with every endpoint, request schema, and a "Try it out" button, without writing a single line of documentation yourself. This isn't a small …


Continue reading

vLLM vs Ollama: Which One Should You Use to Serve Open Models?

Posted on Thu 26 November 2026 in Tutorial • Tagged with GenAI, LLM, vLLM, Ollama, local-LLM, model-serving, FastAPI, deployment

The Moment Ollama Stopped Being Enough

In the earlier post on running a local LLM, I set up Ollama in about fifteen minutes and plugged it into a FastAPI chatbot. It felt great. One model, one laptop, one user: me.

Then I imagined what happens when ten people use that …


Continue reading

Why PDFs Are the Hardest Part of RAG (And How to Parse Them Better)

Posted on Mon 23 November 2026 in Tutorial • Tagged with GenAI, RAG, PDF, document-parsing, OCR, chunking, Python

The Moment My RAG App Fell Apart

The RAG API we built earlier worked beautifully, as long as I fed it clean text. Then I did what every user eventually does: I uploaded a real PDF. A quarterly report, 40 pages, with columns, tables, charts, and a header on every …


Continue reading

Logging and Observability for LLM Apps

Posted on Sat 14 November 2026 in Tutorial • Tagged with GenAI, LLM, logging, observability, production, Python, FastAPI

Why LLM Apps Need Different Observability

Traditional apps fail in predictable ways. A function throws an exception. A query times out. The error is binary: it worked or it didn't, and the stack trace points you to the line.

LLM apps fail softly. The API call succeeds. The response arrives …


Continue reading

Building a RAG API with FastAPI and a Vector Database: Step by Step

Posted on Fri 13 November 2026 in Tutorial • Tagged with GenAI, RAG, FastAPI, vector-database, Python, API, ChromaDB, production

What We're Building

Retrieval-Augmented Generation (RAG) is the pattern where an LLM answers questions using documents you provide, rather than relying only on what it learned during training. It's the foundation of most real-world AI apps: document Q&A, support bots, knowledge assistants.

This post builds a working RAG API …


Continue reading

Prompt Versioning: Treating Prompts Like Code

Posted on Sat 31 October 2026 in Tutorial • Tagged with GenAI, LLM, prompt-engineering, versioning, Git, production, Python

The Day Nobody Knew Why It Got Worse

Here's a scenario that happens on almost every LLM project eventually. The app was giving good answers on Monday. By Thursday, users are complaining that responses feel off. Someone says, "I think I tweaked the prompt a bit last week." Someone else …


Continue reading

Structured Outputs: How to Make an LLM Return Clean JSON Every Time

Posted on Tue 27 October 2026 in Tutorial • Tagged with GenAI, LLM, structured-outputs, JSON, Pydantic, FastAPI, Python

The Bug That Taught Me This

The first time I built something that fed LLM output into other code, it worked beautifully for about a day. Then one response came back as:

Sure! Here's the JSON you asked for:

{"category": "billing", "priority": 2}

Let me know if you need …

Continue reading

How to Evaluate Your LLM App: Building a Simple Eval Set

Posted on Sun 25 October 2026 in Tutorial • Tagged with GenAI, LLM, evaluation, evals, testing, Python, prompt-engineering

The Question I Couldn't Answer

For a long time, my process for improving a prompt was embarrassingly simple: change the wording, try two or three inputs, decide it "feels better," and move on. Then one day someone asked me a basic question: "Is the new version actually better than the …


Continue reading

I Ran an LLM on My Own Laptop: Here's How (Ollama Setup for Beginners)

Posted on Sat 24 October 2026 in Tutorial • Tagged with Ollama, local-LLM, GenAI, FastAPI, Python, beginner

The Moment It Clicked

For a long time, "using an LLM" meant one thing for me: sign up, paste an API key, send a request to someone else's server, and watch the token counter tick up. Then I tried running a model on my own laptop, with the Wi-Fi turned …


Continue reading