Thanks for stopping by to let us know something could be better!
The documentation in https://github.com/googleapis/python-aiplatform/blob/v1.33.0/google/cloud/aiplatform/models.py#L356-L366 states:
This value should be 1-10 characters, and valid characters are /[0-9]/. When using HTTP/JSON, this field is populated based on a query string argument, such as ``?endpoint_id=12345``. This is the fallback for fields that are not included in either the URI or the body.
It describes only subset of valid values.
Environment details
google-cloud-aiplatform version: v1.33.0
Steps to reproduce and Code example
Here are my experiments with possible values of endpoint_id.
from google.cloud import aiplatform
project = '...'
location = '...'
endpoint_id = 'experiment-endpoint'
display_name = 'experiment-endpoint-display-name'
endpoint = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# created https://console.cloud.google.com/vertex-ai/locations/.../endpoints/experiment-endpoint?project=...
#%%
endpoint_id = 'experiment_endpoint'
display_name = 'experiment_endpoint-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint2 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# got error 1.Field: endpoint_id; Message: endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters. [field_violations {
# field: "endpoint_id"
# description: "endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters."
# }
# ]
#%%
display_name = 'experiment2_endpoint-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint3 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/8595586081766768640?project=...
#%%
display_name = 'experiment2-endpoint-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint4 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/3652885490727649280?project=...
#%%
endpoint_id = 'experiment3-endpoint'
display_name = 'experiment3-endpoint-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint5 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/experiment3-endpoint?project=...
#%%
endpoint_id = 'experiment3-endpoint-very-long-endpoint-id'
display_name = 'experiment3-endpoint-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint6 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/experiment3-endpoint-very-long-endpoint-id?project=...
#%%
endpoint_id = '7894561234567894561234856789456123456789789456123456789456123456789'
display_name = 'experiment7-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint7 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# google.api_core.exceptions.InvalidArgument: 400 List of found errors: 1.Field: endpoint_id; Message: endpoint_id can have at most 63 characters. [field_violations {
# field: "endpoint_id"
# description: "endpoint_id can have at most 63 characters."
# }
# ]
#%%
endpoint_id = '789456123456789456123485678945612345678978945612345678945612345'
display_name = 'experiment7-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint8 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# google.api_core.exceptions.InvalidArgument: 400 List of found errors: 1.Field: endpoint_id; Message: endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters. [field_violations {
# field: "endpoint_id"
# description: "endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters."
# }
# ]
#%%
endpoint_id = '7894561234'
display_name = 'experiment7-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint9 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/7894561234?project=...
#%%
endpoint_id = '3652885490727649285'
display_name = 'experiment8-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint10 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# google.api_core.exceptions.InvalidArgument: 400 List of found errors: 1.Field: endpoint_id; Message: endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters. [field_violations {
# field: "endpoint_id"
# description: "endpoint_id can only contain lowercase letters, digits and hyphens. If the first character is a letter, the last character must be a letter or number and there can be at most 63 characters. If the first character is a number, all characters must be numbers with no leading zeros and there can be at most 10 characters."
# }
# ]
#%%
endpoint_id = 'a3652885490727649285b'
display_name = 'experiment8-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint11 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/a3652885490727649285b?project=...
#%%
endpoint_id = 'experiment3-endpoint-very-long-endpoint-id-very-long-endpoint-id'
display_name = 'experiment3-endpoint-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint12 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# google.api_core.exceptions.InvalidArgument: 400 List of found errors: 1.Field: endpoint_id; Message: endpoint_id can have at most 63 characters. [field_violations {
# field: "endpoint_id"
# description: "endpoint_id can have at most 63 characters."
# }
# ]
#%%
endpoint_id = 'experiment3-endpoint-very-long-endpoint-id-very-long-endpoint-i'
display_name = 'experiment3-endpoint-display-name-very-long-display-name'
# if endpoint_id is not None and not endpoint_id_re.match(endpoint_id):
# raise Exception("Endpoint id is invalid")
endpoint13 = aiplatform.Endpoint.create(
project=project, location=location, display_name=display_name, endpoint_id=endpoint_id
)
# https://console.cloud.google.com/vertex-ai/locations/.../endpoints/experiment3-endpoint-very-long-endpoint-id-very-long-endpoint-i?project=...
# Using endpoint [https://...-aiplatform.googleapis.com/]
# ENDPOINT_ID DISPLAY_NAME
# experiment3-endpoint-very-long-endpoint-id-very-long-endpoint-i experiment3-endpoint-display-name-very-long-display-name
# a3652885490727649285b experiment8-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name
# 7894561234 experiment7-endpoint-display-name-very-long-display-name-very-long-display-name-very-long-display-name
# experiment3-endpoint-very-long-endpoint-id experiment3-endpoint-display-name-very-long-display-name
# experiment3-endpoint experiment3-endpoint-display-name
# 3652885490727649280 experiment2-endpoint-display-name
# 8595586081766768640 experiment2_endpoint-display-name
# experiment-endpoint experiment-endpoint-display-name
from the code itself you can see which values failed and which did not. Providing the correct allowed values in the documentation would be appreciated
Thanks for stopping by to let us know something could be better!
The documentation in https://github.com/googleapis/python-aiplatform/blob/v1.33.0/google/cloud/aiplatform/models.py#L356-L366 states:
It describes only subset of valid values.
Environment details
google-cloud-aiplatformversion: v1.33.0Steps to reproduce and Code example
Here are my experiments with possible values of endpoint_id.
from the code itself you can see which values failed and which did not. Providing the correct allowed values in the documentation would be appreciated