News Developer Tools

Google Cloud adds AlloyDB AI functions to sort and extract text

Google Cloud's AlloyDB AI now previews two SQL functions that let Gemini label text and pull structured JSON fields without leaving the database.

Google Cloud has released a preview of two AlloyDB AI functions, ai.classify and ai.extract, that let Gemini models label and structure text inside the database using standard SQL. Google Cloud says they work in the google_ml_integration extension on PostgreSQL 18.

Google Cloud says databases hold large volumes of unstructured text, such as clinical notes, customer reviews, support tickets and invoices. Working with that text has meant exporting data, calling outside model services, writing prompts, parsing replies and updating records. Google Cloud says that loop adds latency, token costs and compliance risk when sensitive data crosses network boundaries.

The ai.classify function sorts text into categories the user defines, given as plain labels or as labels with descriptions. It supports single-label or multi-label results and can take inline examples. In Google Cloud's sample, three product reviews return positive, negative and negative.

The ai.extract function turns free-form text into JSON that matches a target schema, given as a JSON schema or a simple list of fields. It handles system instructions internally, so users do not write prompt templates or response parsers. Both functions run on single rows, arrays or cursors, and smart batching supports scale. Preview use requires enabling a dedicated setting.

Source: Google Cloud announcement.