googleapis / langchain-google-alloydb-pg-python

Apache License 2.0
9 stars 9 forks source link

Error trying to create a Vectorstore table #127

Closed gitsathish closed 1 month ago

gitsathish commented 2 months ago

Not able to create a vectorstore, from langchain_google_alloydb_pg import AlloyDBEngine

engine = await AlloyDBEngine.afrom_instance( project_id=PROJECT_ID, region=REGION, cluster=CLUSTER, instance=INSTANCE, database=DATABASE, )

await engine.ainit_vectorstore_table( table_name=TABLE_NAME, vector_size=768, # Vector size for VertexAI model(textembedding-gecko@latest) )

My params are correct for project,region,cluster,instance and database.

I am getting a 404 back, appreciate any insights.

ClientResponseError: 404, message='Not Found', url=URL('https://alloydb.googleapis.com/v1beta/projects/XXXX/locations/us-east4/clusters/XXXXX/instances/XXXX/connectionInfo')

averikitsch commented 1 month ago

Hi @gitsathish, Is your AlloyDB Cluster have a public or private IP address? To be able to connect from outside a VPC network you need to enable Public IP, see instructions https://cloud.google.com/alloydb/docs/connect-public-ip. The integration defaults to using public IP. If you are using private IP from that is deploy into your VPC network, then you will need to pass in ip_type="PRIVATE" into the AlloyDBEngine.

gitsathish commented 1 month ago

Trying to connect from a user managed notebook in the using the same VPC as alloydb. Still getting the same error,

engine = await AlloyDBEngine.afrom_instance( project_id=PROJECT_ID, region=REGION, cluster=CLUSTER, instance=INSTANCE, database=DATABASE, ip_type="PRIVATE" )

averikitsch commented 1 month ago

I can reproduce the 404 error if the database or cluster fields are incorrect. Can you use the code snippet https://gist.github.com/jackwotherspoon/8a9af3ac1e60e493d32364b3931c6feb to test if you can connect to the Private IP address from your notebook?

averikitsch commented 1 month ago

Please reopen this issue if you continue to experience this issue. Thanks!