AI & data
LLMs, OCR, NLP and data pipelines. 42 posts, newest first. All topics
Improving search results with a cross-encoder rerankerAdd a cross-encoder reranking step to embedding or BM25 retrieval with sentence-transformers, measure what it gains on real queries, and what it costs in latency.
My esports betting tools: odds scrapers, LLM pickers and a live LoL win modelHow my esports betting repos work: a PlayNow odds scraper, LLM match pickers, and esports-odds-live, which prices live LoL games from op.gg data.
What Changed in Claude Code in 2026Claude Code's 2026 releases, from Opus 4.6 to Fable 5.2: agent teams, background sessions, workflows, plugins and skills, auto mode and new usage limits.
AI in Fall 2026: Gated Frontier Models, Computer Use and a Stateless MCPAnthropic, OpenAI and Google all shipped new model generations from September to November 2026. What changed, what got cheaper, and what it means for builders.
Building Afterlight, a 2D-HD JRPG, with Claude CodeOne long-running Claude Code session, eleven helper agents and a usage limit or two. How a three.js JRPG went from a one-paragraph prompt to a public repo overnight.
Processing thousands of prompts with the Claude Message Batches APIWhen the Message Batches API fits, and a script that submits a batch with custom IDs, polls it, reads the results and resubmits errored or expired requests.
Handling LLM API rate limits: retries, backoff and concurrency capsTell 429s from 529s and 5xx errors, use the Anthropic SDK's built-in retries, add backoff with jitter, and cap concurrency and input tokens with asyncio.
Semantic search in Postgres with pgvectorStore embeddings in Postgres with pgvector: vector columns, distance operators, HNSW and IVFFlat indexes, and filtered queries that still return enough rows.
Streaming LLM responses to the browser with server-sent eventsRelay a streamed Claude response through a FastAPI endpoint as server-sent events, read it in the browser with fetch, and handle proxy buffering and cancellation.
Running local LLMs with Ollama and calling them from PythonInstall Ollama, pull and run open models, call them over the REST API, the ollama Python package and the OpenAI-compatible endpoint, and size context and memory.
Chunking documents for retrieval: fixed size, recursive splits and headingsFour ways to chunk documents for RAG, from fixed windows to heading-aware splits, plus a small recall test that shows which one works for your embedding model.
Validating DataFrames with Pandera schemasDeclare pandas DataFrame schemas as Pandera DataFrameModel classes: Field checks, custom checks, dtype coercion, lazy error reports and validation at pipeline boundaries.
Cutting LLM costs with prompt caching in the Claude APIHow prefix caching works, where to put cache_control breakpoints, minimum lengths and TTLs, and how to read the cache usage fields to confirm you are getting hits.
Building an MCP server in Python with FastMCPWrite a Model Context Protocol server with the official Python SDK: tools, resources and prompts over stdio, tested with the Inspector and added to Claude Code.
A small eval runner for LLM features in PythonBuild a 160-line eval runner for an LLM feature: JSONL test cases, exact, regex and LLM-as-judge graders, concurrent runs and scores tracked per prompt version.
Polars for pandas users: expressions, lazy frames and group_byThe same DataFrame transformations in pandas and Polars side by side: pl.col expressions, with_columns, group_by().agg, window functions, lazy scan_csv and no index.
Writing a tool-use loop for the Claude API by handBuild the tool-calling loop for Claude yourself in Python: JSON Schema tools, the stop_reason loop, tool_result blocks, errors with is_error and a turn limit.Revolutionizing Web Performance: Using Gemini 3.1-Pro-Preview for AI-Generated SVGsDiscover how to replace heavy JavaScript web animations with AI-generated SVGs using Gemini 3.1-Pro-Preview. A deep dive into the devcraft repository, Vite tooling, and best prompting techniques for scalable vector graphics.
Retrieval-augmented generation from scratch with SQLiteBuild RAG in about 130 lines of Python: chunk Markdown, embed it locally, store vectors in SQLite, search by cosine similarity and get cited answers from Claude.
Querying CSV and Parquet files with DuckDBUse DuckDB's CLI and Python API to query CSV and Parquet files in place, read many files with globs, write partitioned Parquet, and run SQL on pandas DataFrames.
Getting reliable JSON from an LLM: schemas, structured outputs and validationThree ways to get JSON out of Claude in Python: prompting, a forced tool call and the structured outputs beta, with Pydantic validation, retries and stop reasons.
Outlier vs. Appen vs. Alignerr: why the newcomer wins for AI training work in 2025Pros and cons of three AI training gig platforms, how Meta's stake in Scale AI hit Outlier's workload, and why I rate Alignerr the best option in 2025.
How I generate logos with AI: GPT-4 for descriptions, Bing Image Creator for imagesMy two-step process for logo ideas. I ask GPT-4 (on Poe) for written logo descriptions, then paste them into Bing Image Creator or DALL-E.
Seaborn basics: statistical plots from pandas DataFramesHow to make scatter, distribution, categorical and correlation plots with Seaborn 0.13, plus the figure-level vs axes-level split that trips people up.
Pandas basics: create, select, filter, sort and group DataFramesPandas basics in Python: build DataFrames and Series, load a CSV, then select, filter, sort and group rows, with a note on Copy-on-Write and .loc.
Six ChatGPT prompts I use for code review, commit messages and blog draftsCopy-paste ChatGPT prompts for rewriting code to a style guide, writing tests, explaining code, writing commit messages and test notes, and drafting blog posts.On-device chat in the browser with Chrome's Prompt API and nluxWhy running an LLM on the user's device helps privacy, and how to build a React chat UI with nlux that streams replies from Gemini Nano in Chrome.
Building an Excel add-in that calls OpenAI and Alpha VantageScaffold an Excel task pane add-in with yo office, then make it ask OpenAI for a stock ticker and show the company overview from Alpha Vantage.
Running OCRmyPDF in a containerized Azure FunctionPackage OCRmyPDF, Tesseract and Ghostscript into a custom Azure Functions container and expose an HTTP endpoint that OCRs an uploaded PDF and returns its text.
Running machine learning models in the browser with WebAssemblyHow WebAssembly is used to run ML inference in the browser, with an ONNX Runtime Web example, the TensorFlow.js Wasm backend, and when WebGPU is the better fit.
Building a custom GPT for everyday coding choresHow I used OpenAI's custom GPTs to build one ChatGPT bot for small coding chores like type conversions, string tricks, Base64 and Mermaid diagrams.
Lessons from scraping construction permits and bid sitesWhat I learned scraping permit reports, open data and bid-opportunity sites for YellowSheet, plus a small C# scraper at CSPS.
Generating email templates with Claude CodeHow the YellowSheet free-demo email campaign was rebuilt as email-safe HTML with an AI coding agent, and what it took to ship it on a legacy PHP stack.
How AI could change software development, and where it falls shortA May 2023 view of where AI could help across the software lifecycle (coding, requirements, testing, deployment) and why human engineers remain essential.
Updating list of entries in reactRecently I had to update entries based on user input, will go over what I did
Updating videos using the youtube apiHow to upload videos using the youtube api
How to generate remotion videos using the whispers transcriptGenerating mp4 videos for youtube using transcription from whispers
How to transcribe youtube videos using whispersHow to insert transcripts into videos using whispers
Evaluating whispers vs current alternativesEvaluating the new whispers asr text extraction vs current options like wit.ai
How I applied nlp to various youtube videosApplying nlp
Thoughts after trying to sell dall-e images on the internetAfterthoughts after to sell dall-e images on the internet.
Thoughts after using dall-eMy thoughts after early testing dall-e
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)