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

Error 503 & 404 fetching metadata from custom AI endpoint

Hi all,

So I trained a custom AI and deployed it to an endpoint. Everything looks perfect (deployment reads active, trained successfully and I can prompt it successfully in the Vertex AI GUI) but when I try to send a prompt to it from Google Colab. I get the error found below. It wasn't working 24 hours ago. I tried it today at 10pm GMT and it worked (surprisingly). Then I tried it again at 1am GMT and I got the same error again. I'm getting quite annoyed with this error:

503 Getting metadata from plugin failed with error: ("Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Status: 404 Response:\nb''", <google.auth.transport.requests._Response object at 0x7bc5054****>)

This is the code I am using:

def multiturn_generate_content():
vertexai.init(project="project_number", location="endpoint_location")
model = GenerativeModel(
"link_to_endpoint",
system_instruction=[textsi_1]
)
chat = model.start_chat()
print(chat.send_message(
[text1_1],
generation_config=generation_config,
safety_settings=safety_settings
))

text1_1 = chatprompt
textsi_1 = systeminstructions

multiturn_generate_content()

Some more information:  I'm a complete newbie to GCP so I don't really know how to use my service account credentials. I just started saving them under the os.environ but it doesn't work anyways. At 10pm GMT (when the endpoint worked) I used my regular Gmail account using "
!gcloud auth application-default login" and clicked on the link that showed up and copied the authorisation code into the input box. The service account I am saving to os.environ has service agent credentials but to no avail.
 
Any help would be greatly appreciated!
0 0 1,443
0 REPLIES 0