TLDR: PostgreSQL extension that adds ai.embed() and ai.classify() as IMMUTABLE functions. Local ONNX inference, no API calls. Works in generated columns out of the box. ~117 MiB per backend ( connection pooler recommended). The design and constraints are human-driven; the implementation was AI-assisted under supervision. ~$127 in tokens spent.
GitHub: https://github.com/dmonroy/ai-native-pg
Post: https://insert.dev/immutable-ai-functions-in-postgres/
Try it:
docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=postgres ghcr.io/dmonroy/ai-native-pg:dev
Happy to discuss the IMMUTABLE decision, the ONNX stack, or the AI workflow.