https://sqlite.org/appfunc.html
https://learn.microsoft.com/en-us/dotnet/standard/data/sqlit...
Maybe stick with the aggregate variety of function at first if you don't want any billing explosions. I'd probably begin with something like LLM_Summary() and LLM_Classify(). The summary could be an aggregate, and the classify could be a scalar. Being able to write a query like:
SELECT LLM_Summary(Comment)
FROM Users
WHERE datetime(Updated_At) >= datetime('now', '-1 day');
Is more expedient than wiring up the equivalent code pile each time. The aggregation method's internals could handle hierarchical summarization, chunking, etc. Or, throw an error back to the user so they are forced to devise a more rational query.