Skip to content

Commit 1cbd4a5

Browse files
authored
feat: add schema namespace (#140)
* feat: add schema namespace
1 parent 1a302d2 commit 1cbd4a5

File tree

11 files changed

+114
-15
lines changed

11 files changed

+114
-15
lines changed

google/cloud/aiplatform/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
#
1717

1818
from google.cloud.aiplatform import gapic
19+
from google.cloud.aiplatform import schema
1920

20-
__all__ = (gapic,)
21+
22+
__all__ = (gapic, schema)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1beta1.schema import predict
19+
from google.cloud.aiplatform.v1beta1.schema import trainingjob
20+
21+
22+
__all__ = (
23+
"predict",
24+
"trainingjob",
25+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1beta1.schema import predict
19+
from google.cloud.aiplatform.v1beta1.schema import trainingjob
20+
21+
22+
__all__ = (
23+
"predict",
24+
"trainingjob",
25+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1beta1.schema.predict import instance
19+
from google.cloud.aiplatform.v1beta1.schema.predict import params
20+
from google.cloud.aiplatform.v1beta1.schema.predict import prediction
21+
22+
__all__ = (
23+
"instance",
24+
"params",
25+
"prediction",
26+
)

google/cloud/aiplatform/v1beta1/schema/predict/instance/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717
from google.cloud.aiplatform.helpers import _decorators
18-
import google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1.types as pkg
18+
from google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1 import types as pkg
1919

2020
from google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1.types.image_classification import (
2121
ImageClassificationPredictionInstance,

google/cloud/aiplatform/v1beta1/schema/predict/params/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717
from google.cloud.aiplatform.helpers import _decorators
18-
import google.cloud.aiplatform.v1beta1.schema.predict.params_v1beta1.types as pkg
18+
from google.cloud.aiplatform.v1beta1.schema.predict.params_v1beta1 import types as pkg
1919

2020
from google.cloud.aiplatform.v1beta1.schema.predict.params_v1beta1.types.image_classification import (
2121
ImageClassificationPredictionParams,

google/cloud/aiplatform/v1beta1/schema/predict/prediction/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# limitations under the License.
1616
#
1717
from google.cloud.aiplatform.helpers import _decorators
18-
import google.cloud.aiplatform.v1beta1.schema.predict.prediction_v1beta1.types as pkg
18+
from google.cloud.aiplatform.v1beta1.schema.predict.prediction_v1beta1 import (
19+
types as pkg,
20+
)
1921

2022
from google.cloud.aiplatform.v1beta1.schema.predict.prediction_v1beta1.types.classification import (
2123
ClassificationPredictionResult,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1beta1.schema.trainingjob import definition
19+
20+
__all__ = ("definition",)

google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# limitations under the License.
1616
#
1717
from google.cloud.aiplatform.helpers import _decorators
18-
import google.cloud.aiplatform.v1beta1.schema.trainingjob.definition_v1beta1.types as pkg
18+
from google.cloud.aiplatform.v1beta1.schema.trainingjob.definition_v1beta1 import (
19+
types as pkg,
20+
)
1921

2022
from google.cloud.aiplatform.v1beta1.schema.trainingjob.definition_v1beta1.types.automl_forecasting import (
2123
AutoMlForecasting,

samples/snippets/create_training_pipeline_image_classification_sample.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
# [START aiplatform_create_training_pipeline_image_classification_sample]
1616
from google.cloud import aiplatform
17-
from google.cloud.aiplatform.v1beta1.schema.trainingjob import definition
18-
ModelType = definition.AutoMlImageClassificationInputs().ModelType
17+
from google.cloud.aiplatform.schema import trainingjob
1918

2019

2120
def create_training_pipeline_image_classification_sample(
@@ -32,9 +31,9 @@ def create_training_pipeline_image_classification_sample(
3231
# This client only needs to be created once, and can be reused for multiple requests.
3332
client = aiplatform.gapic.PipelineServiceClient(client_options=client_options)
3433

35-
icn_training_inputs = definition.AutoMlImageClassificationInputs(
34+
icn_training_inputs = trainingjob.definition.AutoMlImageClassificationInputs(
3635
multi_label=True,
37-
model_type=ModelType.CLOUD,
36+
model_type=trainingjob.definition.AutoMlImageClassificationInputs.ModelType.CLOUD,
3837
budget_milli_node_hours=8000,
3938
disable_early_stopping=False
4039
)

0 commit comments

Comments
 (0)