It should be fairly easy to adapt it to use the LLM cli by simonw[0] to do the same, with be added bonus of being able to pick which llm to use, including local llms.
[0] https://llm.datasette.io/en/stable/