googleapis / googleapis/python-aiplatform

endpoint_id arg to Endpoint#create method has incorrect doumentation

未关闭
#2,599 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: vertex-ai
主要语言
Python
星标
905
派生
465
平均合并
1 天 13 小时
30 天内合并 PR
44

描述

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.

```python
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

贡献指南

打开贡献指南

调研方向

Start in google/cloud/aiplatform/models.py around lines 356-366, where the Endpoint#create endpoint_id documentation is defined. Compare the documented constraints with the successful and failed values in the issue, then update the documentation to describe the valid formats and length limits accurately. Done means the parameter documentation matches the observed API behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
documentation
Issue 类型
文档
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。