Posts tagged “Gen AI”
7 articles
A vague prompt is `any`
The output shape is the contract, and the prompt is where you write it down.
Your prompt is a function signature
I ran the same prompt three times on the same input and got three different shapes back. Nothing crashed. The output just quietly stopped being something my code could trust.
The model proposes
Tool use is a while loop, and your code is the hands
The model never runs your function
I spent months thinking function calling meant the LLM executes my code. It never does. It asks, I run it. Once that clicked, agents stopped being magic and turned into a while loop I could have written.
The type hints are the middleware
FastAPI, from an Express developer's point of view
FastAPI is the Express + Zod + Swagger stack collapsed into the type system
The last post in the series. I rebuilt my Express reflexes in FastAPI, found the type hints doing the validation, the docs, and the serializing, then made it stream.
You start it
async/await, but the event loop is not ambient anymore
Python handed me the keys to the event loop and said you start it
async/await transfers almost 1:1 from JS, but Python's event loop is not ambient. Two gotchas from wiring up token-by-token streaming.
Stop writing JavaScript in Python
Comprehensions, a reversed join(), and KeyError
Python politely told me to stop writing JavaScript in it
List comprehensions, a reversed join(), and KeyError instead of undefined. Small syntax, but the idioms took real unlearning.
Zod taught me Pydantic
Define the schema, parse at the boundary. Same mental model, new language.
Pydantic: Zod for Python
If you have used Zod, you already understand 70 to 80% of Pydantic. The mental model transfers almost one-to-one.
Python has an npm now
uv, from a Node dev's point of view
Python tooling for frontend devs
Coming from npm and node_modules, Python tooling felt alien until I found uv. Here is the 1:1 mapping that made it click.