Stay organized with collections
Save and categorize content based on your preferences.
This page describes AlloyDB AI natural language, which lets you
create user-facing generative AI applications using natural language to query
databases.
AlloyDB AI natural language generate context-aware SQL queries
for application end users' natural language questions, and it provides a
security API to execute these queries. Natural
language streamlines the development of generative AI applications by
transferring the complexity of converting natural language to SQL from the
application layer to the database layer. Natural language-to-SQL (NL2SQL)
orchestration is embedded in the database. You can query structured and
unstructured data.
AlloyDB AI natural language also provides an intuitive interface
to SQL developers that translates natural language to SQL, as shown in the
following example:
SELECTalloydb_ai_nl.get_sql(...,'What is the sum that client number 4''s account has following transaction 851?');
AlloyDB AI natural language support is provided through
alloydb_ai_nl, which is an AlloyDB for PostgreSQL extension. The extension has a
dependency on PostgreSQL extensions like google_ml_integration, vector, and
pg_trgm.
Use cases
AlloyDB AI natural language is well-suited for developers who
want to do the following:
Rapidly build a customer chat interface by using query generation from
natural language.
Refine automatically generated queries and perform thorough testing to
provide accurate responses.
Tune generated results by adding templates and context information.
Deploy an intuitive, accurate chat experience that lets customers ask
natural language questions about their relational data.
Key capabilities
Key capability
Description
Semantic layer
Maintains rich schema and application context for enhanced
accuracy.
Stores the meaning of your database—schemas, tables, columns, and
relationships.
Enables AlloyDB to understand the context of user questions.
Concept search
Intelligently parses user questions to identify key value phrases.
Maps these values to your data with disambiguation based on
concept types, improving accuracy.
Query store
Supports accurate query generation for a wide variety of common
natural language questions.
Uses templates and query fragments (manual and auto generated)
for faster, more accurate SQL construction.
Limitations
You must enable the AlloyDB AI natural language flag
on every instance of AlloyDB for PostgreSQL.
AlloyDB AI natural
language objects created on the primary instance are propagated to read-only
replicas and cross-region replicas. However, the
alloydb_ai_nl.enabled flag setting isn't replicated automatically, so you must replicate
it manually on each instance. For more information, see Generate SQL queries that answer natural language questions.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[],[],null,["# AlloyDB AI natural language overview\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n|\n|\n| For information about access to this\n| release, see the\n| [access request page](https://docs.google.com/forms/d/16wliam2vok6sdBjYwJIgWV4hw7MW9x5iQ29UwPAKqB0/viewform).\n\nThis page describes AlloyDB AI natural language, which lets you\ncreate user-facing generative AI applications using natural language to query\ndatabases.\n\nAlloyDB AI natural language generate context-aware SQL queries\nfor application end users' natural language questions, and it provides a\nsecurity API to execute these queries. Natural\nlanguage streamlines the development of generative AI applications by\ntransferring the complexity of converting natural language to SQL from the\napplication layer to the database layer. Natural language-to-SQL (NL2SQL)\norchestration is embedded in the database. You can query structured and\nunstructured data.\n\nAlloyDB AI natural language also provides an intuitive interface\nto SQL developers that translates natural language to SQL, as shown in the\nfollowing example: \n\n SELECT\n alloydb_ai_nl.get_sql(\n ...,\n 'What is the sum that client number 4''s account has following transaction 851?'\n );\n\nAlloyDB AI natural language support is provided through\n`alloydb_ai_nl,` which is an AlloyDB for PostgreSQL extension. The extension has a\ndependency on PostgreSQL extensions like `google_ml_integration`, `vector,` and\n`pg_trgm`.\n| **Note:** The `alloydb_ai_nl` extension issues prediction requests to Vertex AI models. For more information, see [Integrate with Vertex AI](/alloydb/docs/ai/configure-vertex-ai).\n\n### Use cases\n\nAlloyDB AI natural language is well-suited for developers who\nwant to do the following:\n\n- Rapidly build a customer chat interface by using query generation from natural language.\n- Refine automatically generated queries and perform thorough testing to provide accurate responses.\n- Tune generated results by adding templates and context information.\n- Deploy an intuitive, accurate chat experience that lets customers ask natural language questions about their relational data.\n\nKey capabilities\n----------------\n\nLimitations\n-----------\n\nYou must enable the AlloyDB AI natural language flag\non every instance of AlloyDB for PostgreSQL.\nAlloyDB AI natural\nlanguage objects created on the primary instance are propagated to read-only\nreplicas and cross-region replicas. However, the\n`alloydb_ai_nl.enabled` flag setting isn't replicated automatically, so you must replicate\nit manually on each instance. For more information, see [Generate SQL queries that answer natural language questions](/alloydb/docs/ai/generate-sql-queries-natural-language#before-you-begin).\n\nWhat's next\n-----------\n\n- [Generate SQL queries that answer natural language questions](/alloydb/docs/ai/generate-sql-queries-natural-language).\n- [Use AlloyDB AI natural language to generate SQL](/alloydb/docs/ai/use-natural-language-generate-sql-queries).\n- Learn how to [search your relational data stored in AlloyDB in Google Agentspace using AlloyDB AI natural language](/agentspace/agentspace-enterprise/docs/create-data-store#alloydb-ai-nl-setup) ([Preview](https://cloud.google.com/products#product-launch-stages))."]]