1

I need to create a wrapper for a Vertex AI endpoint using cloud functions written in python. The client will call the cloud function endpoint, which in turn will call the Vertex AI end point with the JSON request received from the client. The JSON response received from the Vertex AI endpoint call will be modified and sent back to the client. I am new to python and GCP, i got an idea how to make the call using this link Error call Google Vertex AI endpoint from a python backend

I tried the following code but I am getting "Error: could not handle the request"

from google.cloud import aiplatform

aip_endpoint_name = (
f"/projects/\<PROJECT_ID\>/locations/us-central1/endpoints/\<ENDPOINT_ID\>"
)

endpoint = aiplatform.Endpoint(aip_endpoint_name)

instances_list = \[{"parent_code":"IN0028","entity_code":"665038","provider_job_code_descr":"Clk Data Entry"}\]

instances = \[json_format.ParseDict(s, Value()) for s in instances_list\]

results = endpoint.predict(instances=instances)
print(results.predictions)
cvu
  • 482
  • 2
  • 6
  • 20
  • It is hard to tell where the error is coming from. Just to rule things out, what happens when you run this function locally? Do you still get the same error? Usually with error messages like this, you would get a HTTP Response Code. Do you see that anywhere? – cvu Feb 11 '23 at 23:15

0 Answers0