> ls notes/

Notes

Short-form technical writing. Lessons from building things that actually work.

2025-01
RAGPostgreSQLpgvector

Hybrid Search with pgvector & BM25

How I combined dense vector search with BM25 keyword scoring to get retrieval quality that neither approach achieves alone. Reciprocal Rank Fusion merges both result lists.

2025-01
LLMArchitecture

LLM Provider Fallback — Gemini to Claude

Building a provider-agnostic adapter that falls back from Gemini to Claude transparently, with streaming SSE preserved across the switch.

2025-01
SecurityLLMGuardrails

Two-Layer Prompt Injection Defense

Regex patterns catch obvious attacks fast. A lightweight LLM classifier handles the subtle ones. Three strikes → shadow-limit. How I keep the AI twin honest.

2025-01
SecurityGDPRCryptography

Encrypting Chat Messages at Rest

Using Fernet symmetric encryption with PBKDF2 key derivation to encrypt visitor chat messages in PostgreSQL. GDPR Article 32 compliance without sacrificing query performance.

2024-12
CeleryArchitectureRAG

Async Knowledge Ingestion with Celery

Chunking, embedding, and indexing documents without blocking the API. Celery workers process uploads in the background while the user gets immediate feedback.

2024-12
ObservabilityFastAPIPrometheus

OpenTelemetry in FastAPI — Practical Setup

Instrumenting a FastAPI app with OpenTelemetry, exporting traces to Grafana Tempo and metrics to Prometheus. What actually matters vs. what's noise.

Want to discuss any of these topics?

Ask the AI twin →