Talk to Your Data: A UDF That Speaks Your Language
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A user-defined function (UDF) for Couchbase that converts natural language queries into SQL++ using LLMs. The UDF accepts plain English questions, uses schema inference to understand data structure, calls an LLM API (OpenAI, Gemini, etc.) to generate SQL++ queries, and executes SELECT statements automatically while returning non-SELECT statements for manual verification. Implementation involves creating a JavaScript library with inferencer and nl2sql functions, uploading it via curl, and creating the NL2SQL() function that requires keyspaces, prompt, API key, model endpoint, and model name as parameters.
Table of contents
How It WorksHow the UDF ThinksExperimenting with models from other providersConclusionSort: