AlloyDB AI Previews New SQL Functions for Text Classification and Data Extraction

Provider post Google Cloud AI & Machine Learning · Based on the provider's own account.

Google Cloud has previewed two AlloyDB AI SQL functions, ai.classify and ai.extract. They are designed to classify text and extract structured data directly in PostgreSQL queries, rather than requiring custom application logic to call external models and handle their responses.

ai.classify assigns text to user-defined categories. It can return either the best single match or multiple matching categories, with descriptions and examples available to provide context. It supports individual text values, arrays, and cursors. In the article’s example, product reviews are classified as positive, neutral, or negative.

ai.extract turns unstructured text into JSON matching a supplied schema or list of fields. Examples include extracting details from clinical notes, invoices, and contracts. Google also describes smart batching: when these functions are used in WHERE expressions, the database groups inputs before sending them to Gemini models. The company says this can speed up queries compared with processing rows individually and reduce token use, but the post provides no specific measurements.

The preview is available for PostgreSQL 18 with version 1.6.1 or later of the google_ml_integration extension. The original post provides syntax, examples, and planned enhancements: Google Cloud: ai.classify and ai.extract.

🇬🇧 https://cloud.google.com/blog/products/databases/ai-classify-and-ai-extract-functions-in-alloydb-ai

Leave a Comment

The weekly brief: selected developments, projects and videos