Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to use embedding function with google_ml_integration extension

UPDATE table set embedding = embedding('textembedding-gecko@003',content);
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

my_db=> CALL google_ml.create_model(
model_id => 'textembedding-gecko@003',
model_provider => 'google',
model_qualified_name => 'textembedding-gecko@003',
model_type => 'text_embedding',
model_auth_type => 'alloydb_service_agent_iam');
ERROR: Model access functionality in google_ml_integration extension is currently disabled. Please set google_ml_integration.enable_model_support to use the model functionality.
CONTEXT: PL/pgSQL function google_ml.check_model_support() line 7 at RAISE
SQL statement "CALL google_ml.check_model_support()"
PL/pgSQL function google_ml.create_model(character varying,character varying,google_ml.model_provider,google_ml.model_type,character varying,google_ml.auth_type,character varying,character varying,character varying,character varying) line 8 at CALL
my_db=> ALTER EXTENSION google_ml_integration UPDATE TO '1.3'

I have tried all setup steps to simply embedd or vectorize my data and use built-in features and it throws error that embedding function does not exists, even after having extension for google_ml_integration and pg_vector

I was following this https://www.cloudskillsboost.google/focuses/97381?parent=catalog but steps are outdated and made we look around towards below links and now i am stuck to find where is this embedding function or how do i use it?

https://cloud.google.com/alloydb/docs/ai/work-with-embeddings
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api
https://cloud.google.com/alloydb/docs/reference/extensions
https://cloud.google.com/alloydb/docs/ai/model-endpoint-register-model

Solved Solved
0 1 490
1 ACCEPTED SOLUTION

My mistake, I realized i was calling embedding on a json column instead of a text
my_db=> UPDATE table1 set embedding = embedding('textembedding-gecko@003',column1);
ERROR: function embedding(unknown, json) does not exist
LINE 1: UPDATE table1 set embedding = embedding('textembeddin...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
my_db=> UPDATE table1 set embedding = embedding('textembedding-gecko@003',column2);

and it worked!

View solution in original post

1 REPLY 1

My mistake, I realized i was calling embedding on a json column instead of a text
my_db=> UPDATE table1 set embedding = embedding('textembedding-gecko@003',column1);
ERROR: function embedding(unknown, json) does not exist
LINE 1: UPDATE table1 set embedding = embedding('textembeddin...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
my_db=> UPDATE table1 set embedding = embedding('textembedding-gecko@003',column2);

and it worked!