From 643ec88e6d659d20ddfad196eb8f100130213060 Mon Sep 17 00:00:00 2001 From: Matt Cornillon Date: Mon, 27 Oct 2025 17:39:08 +0100 Subject: [PATCH] docs: Adding google_ml_integration instructions --- CLOUD-SQL-POSTGRESQL.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CLOUD-SQL-POSTGRESQL.md b/CLOUD-SQL-POSTGRESQL.md index 7ed5601..c09d3ed 100644 --- a/CLOUD-SQL-POSTGRESQL.md +++ b/CLOUD-SQL-POSTGRESQL.md @@ -85,3 +85,14 @@ Make sure to not use the environment variable name like `CLOUD_SQL_POSTGRES_PROJ **ALWAYS** use the full table name format, `DATABASE_NAME.SCHEMA_NAME.TABLE_NAME` in the generated SQL when using the `execute_sql` or `cloud_sql_postgresql__execute_sql` tool. * Default to using "public" for the schema name. * Use command `echo $CLOUD_SQL_POSTGRES_DATABASE` to get the current database value. + +## Use google_ml_integration for AI use cases + +When working with AI features like vector embeddings in Cloud SQL, leverage the `google_ml_integration` extension. This allows for generating embeddings directly within the database, which is the recommended approach over using third-party embedding models. + +Embeddings can be generated using the `embedding()` function. For example: `embedding(, )`. + +As an agent, if you do not know which model to use, you should use your tools to search for available and appropriate text embedding models compatible with the `google_ml_integration` extension (e.g., by searching for "Cloud SQL google_ml_integration supported models"). + +When performing similarity searches, remember to cast the result of the `embedding` function to the `vector` type. For example: +`ORDER BY description_vector <-> embedding(, $1)::vector`