Skip to content

Commit 56185e7

Browse files
Matthieu68857Matt Cornillon
andauthored
feat: Adding google_ml_integration instructions (#63)
Co-authored-by: Matt Cornillon <cornillon@google.com>
1 parent 469e7db commit 56185e7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CLOUD-SQL-POSTGRESQL.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,14 @@ Make sure to not use the environment variable name like `CLOUD_SQL_POSTGRES_PROJ
8585
**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.
8686
* Default to using "public" for the schema name.
8787
* Use command `echo $CLOUD_SQL_POSTGRES_DATABASE` to get the current database value.
88+
89+
## Use google_ml_integration for AI use cases
90+
91+
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.
92+
93+
Embeddings can be generated using the `embedding()` function. For example: `embedding(<model_name>, <text_column_or_variable>)`.
94+
95+
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").
96+
97+
When performing similarity searches, remember to cast the result of the `embedding` function to the `vector` type. For example:
98+
`ORDER BY description_vector <-> embedding(<model_name>, $1)::vector`

0 commit comments

Comments
 (0)