diff --git a/protos/google/cloud/aiplatform/v1/model_evaluation.proto b/protos/google/cloud/aiplatform/v1/model_evaluation.proto index 2063ce2e..8d86509b 100644 --- a/protos/google/cloud/aiplatform/v1/model_evaluation.proto +++ b/protos/google/cloud/aiplatform/v1/model_evaluation.proto @@ -38,31 +38,70 @@ message ModelEvaluation { pattern: "projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}" }; + message ModelEvaluationExplanationSpec { + // Explanation type. + // + // For AutoML Image Classification models, possible values are: + // + // * `image-integrated-gradients` + // * `image-xrai` + string explanation_type = 1; + + // Explanation spec details. + ExplanationSpec explanation_spec = 2; + } + // Output only. The resource name of the ModelEvaluation. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Points to a YAML file stored on Google Cloud Storage describing the + // Points to a YAML file stored on Google Cloud Storage describing the // [metrics][google.cloud.aiplatform.v1.ModelEvaluation.metrics] of this ModelEvaluation. The schema is // defined as an OpenAPI 3.0.2 [Schema // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject). - string metrics_schema_uri = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + string metrics_schema_uri = 2; - // Output only. Evaluation metrics of the Model. The schema of the metrics is stored in + // Evaluation metrics of the Model. The schema of the metrics is stored in // [metrics_schema_uri][google.cloud.aiplatform.v1.ModelEvaluation.metrics_schema_uri] - google.protobuf.Value metrics = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Value metrics = 3; // Output only. Timestamp when this ModelEvaluation was created. google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. All possible [dimensions][ModelEvaluationSlice.slice.dimension] of + // All possible [dimensions][ModelEvaluationSlice.slice.dimension] of // ModelEvaluationSlices. The dimensions can be used as the filter of the // [ModelService.ListModelEvaluationSlices][google.cloud.aiplatform.v1.ModelService.ListModelEvaluationSlices] request, in the form of // `slice.dimension = `. - repeated string slice_dimensions = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated string slice_dimensions = 5; + + // Points to a YAML file stored on Google Cloud Storage describing + // [EvaluatedDataItemView.data_item_payload][] and + // [EvaluatedAnnotation.data_item_payload][]. The schema is defined as an + // OpenAPI 3.0.2 [Schema + // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject). + // + // This field is not populated if there are neither EvaluatedDataItemViews nor + // EvaluatedAnnotations under this ModelEvaluation. + string data_item_schema_uri = 6; - // Output only. Aggregated explanation metrics for the Model's prediction output over the + // Points to a YAML file stored on Google Cloud Storage describing + // [EvaluatedDataItemView.predictions][], + // [EvaluatedDataItemView.ground_truths][], + // [EvaluatedAnnotation.predictions][], and + // [EvaluatedAnnotation.ground_truths][]. The schema is defined as an + // OpenAPI 3.0.2 [Schema + // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject). + // + // This field is not populated if there are neither EvaluatedDataItemViews nor + // EvaluatedAnnotations under this ModelEvaluation. + string annotation_schema_uri = 7; + + // Aggregated explanation metrics for the Model's prediction output over the // data this ModelEvaluation uses. This field is populated only if the Model // is evaluated with explanations, and only for AutoML tabular Models. // - ModelExplanation model_explanation = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + ModelExplanation model_explanation = 8; + + // Describes the values of [ExplanationSpec][google.cloud.aiplatform.v1.ExplanationSpec] that are used for explaining + // the predicted values on the evaluated data. + repeated ModelEvaluationExplanationSpec explanation_specs = 9; } diff --git a/protos/google/cloud/aiplatform/v1/model_service.proto b/protos/google/cloud/aiplatform/v1/model_service.proto index 5bcb6e23..4799a22e 100644 --- a/protos/google/cloud/aiplatform/v1/model_service.proto +++ b/protos/google/cloud/aiplatform/v1/model_service.proto @@ -110,6 +110,15 @@ service ModelService { }; } + // Imports an externally generated ModelEvaluation. + rpc ImportModelEvaluation(ImportModelEvaluationRequest) returns (ModelEvaluation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/models/*}/evaluations:import" + body: "*" + }; + option (google.api.method_signature) = "parent,model_evaluation"; + } + // Gets a ModelEvaluation. rpc GetModelEvaluation(GetModelEvaluationRequest) returns (ModelEvaluation) { option (google.api.http) = { @@ -334,6 +343,21 @@ message ExportModelResponse { } +// Request message for [ModelService.ImportModelEvaluation][google.cloud.aiplatform.v1.ModelService.ImportModelEvaluation] +message ImportModelEvaluationRequest { + // Required. The name of the parent model resource. + // Format: `projects/{project}/locations/{location}/models/{model}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Model" + } + ]; + + // Required. Model evaluation resource to be imported. + ModelEvaluation model_evaluation = 2 [(google.api.field_behavior) = REQUIRED]; +} + // Request message for [ModelService.GetModelEvaluation][google.cloud.aiplatform.v1.ModelService.GetModelEvaluation]. message GetModelEvaluationRequest { // Required. The name of the ModelEvaluation resource. diff --git a/protos/google/cloud/aiplatform/v1beta1/model_evaluation.proto b/protos/google/cloud/aiplatform/v1beta1/model_evaluation.proto index 67186bb3..3f7b9234 100644 --- a/protos/google/cloud/aiplatform/v1beta1/model_evaluation.proto +++ b/protos/google/cloud/aiplatform/v1beta1/model_evaluation.proto @@ -55,32 +55,32 @@ message ModelEvaluation { // Output only. The resource name of the ModelEvaluation. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Points to a YAML file stored on Google Cloud Storage describing the + // Points to a YAML file stored on Google Cloud Storage describing the // [metrics][google.cloud.aiplatform.v1beta1.ModelEvaluation.metrics] of this ModelEvaluation. The schema is // defined as an OpenAPI 3.0.2 [Schema // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject). - string metrics_schema_uri = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + string metrics_schema_uri = 2; - // Output only. Evaluation metrics of the Model. The schema of the metrics is stored in + // Evaluation metrics of the Model. The schema of the metrics is stored in // [metrics_schema_uri][google.cloud.aiplatform.v1beta1.ModelEvaluation.metrics_schema_uri] - google.protobuf.Value metrics = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Value metrics = 3; // Output only. Timestamp when this ModelEvaluation was created. google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. All possible [dimensions][ModelEvaluationSlice.slice.dimension] of + // All possible [dimensions][ModelEvaluationSlice.slice.dimension] of // ModelEvaluationSlices. The dimensions can be used as the filter of the // [ModelService.ListModelEvaluationSlices][google.cloud.aiplatform.v1beta1.ModelService.ListModelEvaluationSlices] request, in the form of // `slice.dimension = `. - repeated string slice_dimensions = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated string slice_dimensions = 5; - // Output only. Aggregated explanation metrics for the Model's prediction output over the + // Aggregated explanation metrics for the Model's prediction output over the // data this ModelEvaluation uses. This field is populated only if the Model // is evaluated with explanations, and only for AutoML tabular Models. // - ModelExplanation model_explanation = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + ModelExplanation model_explanation = 8; - // Output only. Describes the values of [ExplanationSpec][google.cloud.aiplatform.v1beta1.ExplanationSpec] that are used for explaining + // Describes the values of [ExplanationSpec][google.cloud.aiplatform.v1beta1.ExplanationSpec] that are used for explaining // the predicted values on the evaluated data. - repeated ModelEvaluationExplanationSpec explanation_specs = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated ModelEvaluationExplanationSpec explanation_specs = 9; } diff --git a/protos/google/cloud/aiplatform/v1beta1/model_service.proto b/protos/google/cloud/aiplatform/v1beta1/model_service.proto index 99318b85..239dc8c6 100644 --- a/protos/google/cloud/aiplatform/v1beta1/model_service.proto +++ b/protos/google/cloud/aiplatform/v1beta1/model_service.proto @@ -113,6 +113,15 @@ service ModelService { }; } + // Imports an externally generated ModelEvaluation. + rpc ImportModelEvaluation(ImportModelEvaluationRequest) returns (ModelEvaluation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*/models/*}/evaluations:import" + body: "*" + }; + option (google.api.method_signature) = "parent,model_evaluation"; + } + // Gets a ModelEvaluation. rpc GetModelEvaluation(GetModelEvaluationRequest) returns (ModelEvaluation) { option (google.api.http) = { @@ -327,6 +336,21 @@ message ExportModelResponse { } +// Request message for [ModelService.ImportModelEvaluation][google.cloud.aiplatform.v1beta1.ModelService.ImportModelEvaluation] +message ImportModelEvaluationRequest { + // Required. The name of the parent model resource. + // Format: `projects/{project}/locations/{location}/models/{model}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Model" + } + ]; + + // Required. Model evaluation resource to be imported. + ModelEvaluation model_evaluation = 2 [(google.api.field_behavior) = REQUIRED]; +} + // Request message for [ModelService.GetModelEvaluation][google.cloud.aiplatform.v1beta1.ModelService.GetModelEvaluation]. message GetModelEvaluationRequest { // Required. The name of the ModelEvaluation resource. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 774dd642..d35b0883 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -39285,8 +39285,17 @@ export namespace google { /** ModelEvaluation sliceDimensions */ sliceDimensions?: (string[]|null); + /** ModelEvaluation dataItemSchemaUri */ + dataItemSchemaUri?: (string|null); + + /** ModelEvaluation annotationSchemaUri */ + annotationSchemaUri?: (string|null); + /** ModelEvaluation modelExplanation */ modelExplanation?: (google.cloud.aiplatform.v1.IModelExplanation|null); + + /** ModelEvaluation explanationSpecs */ + explanationSpecs?: (google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec[]|null); } /** Represents a ModelEvaluation. */ @@ -39313,9 +39322,18 @@ export namespace google { /** ModelEvaluation sliceDimensions. */ public sliceDimensions: string[]; + /** ModelEvaluation dataItemSchemaUri. */ + public dataItemSchemaUri: string; + + /** ModelEvaluation annotationSchemaUri. */ + public annotationSchemaUri: string; + /** ModelEvaluation modelExplanation. */ public modelExplanation?: (google.cloud.aiplatform.v1.IModelExplanation|null); + /** ModelEvaluation explanationSpecs. */ + public explanationSpecs: google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec[]; + /** * Creates a new ModelEvaluation instance using the specified properties. * @param [properties] Properties to set @@ -39387,6 +39405,105 @@ export namespace google { public toJSON(): { [k: string]: any }; } + namespace ModelEvaluation { + + /** Properties of a ModelEvaluationExplanationSpec. */ + interface IModelEvaluationExplanationSpec { + + /** ModelEvaluationExplanationSpec explanationType */ + explanationType?: (string|null); + + /** ModelEvaluationExplanationSpec explanationSpec */ + explanationSpec?: (google.cloud.aiplatform.v1.IExplanationSpec|null); + } + + /** Represents a ModelEvaluationExplanationSpec. */ + class ModelEvaluationExplanationSpec implements IModelEvaluationExplanationSpec { + + /** + * Constructs a new ModelEvaluationExplanationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec); + + /** ModelEvaluationExplanationSpec explanationType. */ + public explanationType: string; + + /** ModelEvaluationExplanationSpec explanationSpec. */ + public explanationSpec?: (google.cloud.aiplatform.v1.IExplanationSpec|null); + + /** + * Creates a new ModelEvaluationExplanationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ModelEvaluationExplanationSpec instance + */ + public static create(properties?: google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec): google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec; + + /** + * Encodes the specified ModelEvaluationExplanationSpec message. Does not implicitly {@link google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.verify|verify} messages. + * @param message ModelEvaluationExplanationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ModelEvaluationExplanationSpec message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.verify|verify} messages. + * @param message ModelEvaluationExplanationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ModelEvaluationExplanationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ModelEvaluationExplanationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec; + + /** + * Decodes a ModelEvaluationExplanationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ModelEvaluationExplanationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec; + + /** + * Verifies a ModelEvaluationExplanationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ModelEvaluationExplanationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ModelEvaluationExplanationSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec; + + /** + * Creates a plain object from a ModelEvaluationExplanationSpec message. Also converts values to other types if specified. + * @param message ModelEvaluationExplanationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ModelEvaluationExplanationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Properties of a ModelEvaluationSlice. */ interface IModelEvaluationSlice { @@ -39704,6 +39821,20 @@ export namespace google { */ public exportModel(request: google.cloud.aiplatform.v1.IExportModelRequest): Promise; + /** + * Calls ImportModelEvaluation. + * @param request ImportModelEvaluationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ModelEvaluation + */ + public importModelEvaluation(request: google.cloud.aiplatform.v1.IImportModelEvaluationRequest, callback: google.cloud.aiplatform.v1.ModelService.ImportModelEvaluationCallback): void; + + /** + * Calls ImportModelEvaluation. + * @param request ImportModelEvaluationRequest message or plain object + * @returns Promise + */ + public importModelEvaluation(request: google.cloud.aiplatform.v1.IImportModelEvaluationRequest): Promise; + /** * Calls GetModelEvaluation. * @param request GetModelEvaluationRequest message or plain object @@ -39805,6 +39936,13 @@ export namespace google { */ type ExportModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1.ModelService#importModelEvaluation}. + * @param error Error, if any + * @param [response] ModelEvaluation + */ + type ImportModelEvaluationCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.ModelEvaluation) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1.ModelService#getModelEvaluation}. * @param error Error, if any @@ -41082,6 +41220,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an ImportModelEvaluationRequest. */ + interface IImportModelEvaluationRequest { + + /** ImportModelEvaluationRequest parent */ + parent?: (string|null); + + /** ImportModelEvaluationRequest modelEvaluation */ + modelEvaluation?: (google.cloud.aiplatform.v1.IModelEvaluation|null); + } + + /** Represents an ImportModelEvaluationRequest. */ + class ImportModelEvaluationRequest implements IImportModelEvaluationRequest { + + /** + * Constructs a new ImportModelEvaluationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IImportModelEvaluationRequest); + + /** ImportModelEvaluationRequest parent. */ + public parent: string; + + /** ImportModelEvaluationRequest modelEvaluation. */ + public modelEvaluation?: (google.cloud.aiplatform.v1.IModelEvaluation|null); + + /** + * Creates a new ImportModelEvaluationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportModelEvaluationRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IImportModelEvaluationRequest): google.cloud.aiplatform.v1.ImportModelEvaluationRequest; + + /** + * Encodes the specified ImportModelEvaluationRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.ImportModelEvaluationRequest.verify|verify} messages. + * @param message ImportModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IImportModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.ImportModelEvaluationRequest.verify|verify} messages. + * @param message ImportModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IImportModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.ImportModelEvaluationRequest; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.ImportModelEvaluationRequest; + + /** + * Verifies an ImportModelEvaluationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportModelEvaluationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.ImportModelEvaluationRequest; + + /** + * Creates a plain object from an ImportModelEvaluationRequest message. Also converts values to other types if specified. + * @param message ImportModelEvaluationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.ImportModelEvaluationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportModelEvaluationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GetModelEvaluationRequest. */ interface IGetModelEvaluationRequest { @@ -102237,6 +102471,20 @@ export namespace google { */ public exportModel(request: google.cloud.aiplatform.v1beta1.IExportModelRequest): Promise; + /** + * Calls ImportModelEvaluation. + * @param request ImportModelEvaluationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ModelEvaluation + */ + public importModelEvaluation(request: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, callback: google.cloud.aiplatform.v1beta1.ModelService.ImportModelEvaluationCallback): void; + + /** + * Calls ImportModelEvaluation. + * @param request ImportModelEvaluationRequest message or plain object + * @returns Promise + */ + public importModelEvaluation(request: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest): Promise; + /** * Calls GetModelEvaluation. * @param request GetModelEvaluationRequest message or plain object @@ -102338,6 +102586,13 @@ export namespace google { */ type ExportModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#importModelEvaluation}. + * @param error Error, if any + * @param [response] ModelEvaluation + */ + type ImportModelEvaluationCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.ModelEvaluation) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#getModelEvaluation}. * @param error Error, if any @@ -103609,6 +103864,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an ImportModelEvaluationRequest. */ + interface IImportModelEvaluationRequest { + + /** ImportModelEvaluationRequest parent */ + parent?: (string|null); + + /** ImportModelEvaluationRequest modelEvaluation */ + modelEvaluation?: (google.cloud.aiplatform.v1beta1.IModelEvaluation|null); + } + + /** Represents an ImportModelEvaluationRequest. */ + class ImportModelEvaluationRequest implements IImportModelEvaluationRequest { + + /** + * Constructs a new ImportModelEvaluationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest); + + /** ImportModelEvaluationRequest parent. */ + public parent: string; + + /** ImportModelEvaluationRequest modelEvaluation. */ + public modelEvaluation?: (google.cloud.aiplatform.v1beta1.IModelEvaluation|null); + + /** + * Creates a new ImportModelEvaluationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportModelEvaluationRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest): google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; + + /** + * Encodes the specified ImportModelEvaluationRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest.verify|verify} messages. + * @param message ImportModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest.verify|verify} messages. + * @param message ImportModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; + + /** + * Verifies an ImportModelEvaluationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportModelEvaluationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest; + + /** + * Creates a plain object from an ImportModelEvaluationRequest message. Also converts values to other types if specified. + * @param message ImportModelEvaluationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportModelEvaluationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GetModelEvaluationRequest. */ interface IGetModelEvaluationRequest { diff --git a/protos/protos.js b/protos/protos.js index 45107507..2ad87df7 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -94387,7 +94387,10 @@ * @property {google.protobuf.IValue|null} [metrics] ModelEvaluation metrics * @property {google.protobuf.ITimestamp|null} [createTime] ModelEvaluation createTime * @property {Array.|null} [sliceDimensions] ModelEvaluation sliceDimensions + * @property {string|null} [dataItemSchemaUri] ModelEvaluation dataItemSchemaUri + * @property {string|null} [annotationSchemaUri] ModelEvaluation annotationSchemaUri * @property {google.cloud.aiplatform.v1.IModelExplanation|null} [modelExplanation] ModelEvaluation modelExplanation + * @property {Array.|null} [explanationSpecs] ModelEvaluation explanationSpecs */ /** @@ -94400,6 +94403,7 @@ */ function ModelEvaluation(properties) { this.sliceDimensions = []; + this.explanationSpecs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -94446,6 +94450,22 @@ */ ModelEvaluation.prototype.sliceDimensions = $util.emptyArray; + /** + * ModelEvaluation dataItemSchemaUri. + * @member {string} dataItemSchemaUri + * @memberof google.cloud.aiplatform.v1.ModelEvaluation + * @instance + */ + ModelEvaluation.prototype.dataItemSchemaUri = ""; + + /** + * ModelEvaluation annotationSchemaUri. + * @member {string} annotationSchemaUri + * @memberof google.cloud.aiplatform.v1.ModelEvaluation + * @instance + */ + ModelEvaluation.prototype.annotationSchemaUri = ""; + /** * ModelEvaluation modelExplanation. * @member {google.cloud.aiplatform.v1.IModelExplanation|null|undefined} modelExplanation @@ -94454,6 +94474,14 @@ */ ModelEvaluation.prototype.modelExplanation = null; + /** + * ModelEvaluation explanationSpecs. + * @member {Array.} explanationSpecs + * @memberof google.cloud.aiplatform.v1.ModelEvaluation + * @instance + */ + ModelEvaluation.prototype.explanationSpecs = $util.emptyArray; + /** * Creates a new ModelEvaluation instance using the specified properties. * @function create @@ -94489,8 +94517,15 @@ if (message.sliceDimensions != null && message.sliceDimensions.length) for (var i = 0; i < message.sliceDimensions.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.sliceDimensions[i]); + if (message.dataItemSchemaUri != null && Object.hasOwnProperty.call(message, "dataItemSchemaUri")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataItemSchemaUri); + if (message.annotationSchemaUri != null && Object.hasOwnProperty.call(message, "annotationSchemaUri")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.annotationSchemaUri); if (message.modelExplanation != null && Object.hasOwnProperty.call(message, "modelExplanation")) $root.google.cloud.aiplatform.v1.ModelExplanation.encode(message.modelExplanation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.explanationSpecs != null && message.explanationSpecs.length) + for (var i = 0; i < message.explanationSpecs.length; ++i) + $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.encode(message.explanationSpecs[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; @@ -94542,9 +94577,20 @@ message.sliceDimensions = []; message.sliceDimensions.push(reader.string()); break; + case 6: + message.dataItemSchemaUri = reader.string(); + break; + case 7: + message.annotationSchemaUri = reader.string(); + break; case 8: message.modelExplanation = $root.google.cloud.aiplatform.v1.ModelExplanation.decode(reader, reader.uint32()); break; + case 9: + if (!(message.explanationSpecs && message.explanationSpecs.length)) + message.explanationSpecs = []; + message.explanationSpecs.push($root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -94603,11 +94649,26 @@ if (!$util.isString(message.sliceDimensions[i])) return "sliceDimensions: string[] expected"; } + if (message.dataItemSchemaUri != null && message.hasOwnProperty("dataItemSchemaUri")) + if (!$util.isString(message.dataItemSchemaUri)) + return "dataItemSchemaUri: string expected"; + if (message.annotationSchemaUri != null && message.hasOwnProperty("annotationSchemaUri")) + if (!$util.isString(message.annotationSchemaUri)) + return "annotationSchemaUri: string expected"; if (message.modelExplanation != null && message.hasOwnProperty("modelExplanation")) { var error = $root.google.cloud.aiplatform.v1.ModelExplanation.verify(message.modelExplanation); if (error) return "modelExplanation." + error; } + if (message.explanationSpecs != null && message.hasOwnProperty("explanationSpecs")) { + if (!Array.isArray(message.explanationSpecs)) + return "explanationSpecs: array expected"; + for (var i = 0; i < message.explanationSpecs.length; ++i) { + var error = $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.verify(message.explanationSpecs[i]); + if (error) + return "explanationSpecs." + error; + } + } return null; }; @@ -94644,11 +94705,25 @@ for (var i = 0; i < object.sliceDimensions.length; ++i) message.sliceDimensions[i] = String(object.sliceDimensions[i]); } + if (object.dataItemSchemaUri != null) + message.dataItemSchemaUri = String(object.dataItemSchemaUri); + if (object.annotationSchemaUri != null) + message.annotationSchemaUri = String(object.annotationSchemaUri); if (object.modelExplanation != null) { if (typeof object.modelExplanation !== "object") throw TypeError(".google.cloud.aiplatform.v1.ModelEvaluation.modelExplanation: object expected"); message.modelExplanation = $root.google.cloud.aiplatform.v1.ModelExplanation.fromObject(object.modelExplanation); } + if (object.explanationSpecs) { + if (!Array.isArray(object.explanationSpecs)) + throw TypeError(".google.cloud.aiplatform.v1.ModelEvaluation.explanationSpecs: array expected"); + message.explanationSpecs = []; + for (var i = 0; i < object.explanationSpecs.length; ++i) { + if (typeof object.explanationSpecs[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1.ModelEvaluation.explanationSpecs: object expected"); + message.explanationSpecs[i] = $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.fromObject(object.explanationSpecs[i]); + } + } return message; }; @@ -94665,13 +94740,17 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.sliceDimensions = []; + object.explanationSpecs = []; + } if (options.defaults) { object.name = ""; object.metricsSchemaUri = ""; object.metrics = null; object.createTime = null; + object.dataItemSchemaUri = ""; + object.annotationSchemaUri = ""; object.modelExplanation = null; } if (message.name != null && message.hasOwnProperty("name")) @@ -94687,8 +94766,17 @@ for (var j = 0; j < message.sliceDimensions.length; ++j) object.sliceDimensions[j] = message.sliceDimensions[j]; } + if (message.dataItemSchemaUri != null && message.hasOwnProperty("dataItemSchemaUri")) + object.dataItemSchemaUri = message.dataItemSchemaUri; + if (message.annotationSchemaUri != null && message.hasOwnProperty("annotationSchemaUri")) + object.annotationSchemaUri = message.annotationSchemaUri; if (message.modelExplanation != null && message.hasOwnProperty("modelExplanation")) object.modelExplanation = $root.google.cloud.aiplatform.v1.ModelExplanation.toObject(message.modelExplanation, options); + if (message.explanationSpecs && message.explanationSpecs.length) { + object.explanationSpecs = []; + for (var j = 0; j < message.explanationSpecs.length; ++j) + object.explanationSpecs[j] = $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.toObject(message.explanationSpecs[j], options); + } return object; }; @@ -94703,6 +94791,221 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + ModelEvaluation.ModelEvaluationExplanationSpec = (function() { + + /** + * Properties of a ModelEvaluationExplanationSpec. + * @memberof google.cloud.aiplatform.v1.ModelEvaluation + * @interface IModelEvaluationExplanationSpec + * @property {string|null} [explanationType] ModelEvaluationExplanationSpec explanationType + * @property {google.cloud.aiplatform.v1.IExplanationSpec|null} [explanationSpec] ModelEvaluationExplanationSpec explanationSpec + */ + + /** + * Constructs a new ModelEvaluationExplanationSpec. + * @memberof google.cloud.aiplatform.v1.ModelEvaluation + * @classdesc Represents a ModelEvaluationExplanationSpec. + * @implements IModelEvaluationExplanationSpec + * @constructor + * @param {google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec=} [properties] Properties to set + */ + function ModelEvaluationExplanationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ModelEvaluationExplanationSpec explanationType. + * @member {string} explanationType + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @instance + */ + ModelEvaluationExplanationSpec.prototype.explanationType = ""; + + /** + * ModelEvaluationExplanationSpec explanationSpec. + * @member {google.cloud.aiplatform.v1.IExplanationSpec|null|undefined} explanationSpec + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @instance + */ + ModelEvaluationExplanationSpec.prototype.explanationSpec = null; + + /** + * Creates a new ModelEvaluationExplanationSpec instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec} ModelEvaluationExplanationSpec instance + */ + ModelEvaluationExplanationSpec.create = function create(properties) { + return new ModelEvaluationExplanationSpec(properties); + }; + + /** + * Encodes the specified ModelEvaluationExplanationSpec message. Does not implicitly {@link google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec} message ModelEvaluationExplanationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModelEvaluationExplanationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.explanationType != null && Object.hasOwnProperty.call(message, "explanationType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.explanationType); + if (message.explanationSpec != null && Object.hasOwnProperty.call(message, "explanationSpec")) + $root.google.cloud.aiplatform.v1.ExplanationSpec.encode(message.explanationSpec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ModelEvaluationExplanationSpec message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {google.cloud.aiplatform.v1.ModelEvaluation.IModelEvaluationExplanationSpec} message ModelEvaluationExplanationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModelEvaluationExplanationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ModelEvaluationExplanationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec} ModelEvaluationExplanationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModelEvaluationExplanationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.explanationType = reader.string(); + break; + case 2: + message.explanationSpec = $root.google.cloud.aiplatform.v1.ExplanationSpec.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ModelEvaluationExplanationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec} ModelEvaluationExplanationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModelEvaluationExplanationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ModelEvaluationExplanationSpec message. + * @function verify + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ModelEvaluationExplanationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.explanationType != null && message.hasOwnProperty("explanationType")) + if (!$util.isString(message.explanationType)) + return "explanationType: string expected"; + if (message.explanationSpec != null && message.hasOwnProperty("explanationSpec")) { + var error = $root.google.cloud.aiplatform.v1.ExplanationSpec.verify(message.explanationSpec); + if (error) + return "explanationSpec." + error; + } + return null; + }; + + /** + * Creates a ModelEvaluationExplanationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec} ModelEvaluationExplanationSpec + */ + ModelEvaluationExplanationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec) + return object; + var message = new $root.google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec(); + if (object.explanationType != null) + message.explanationType = String(object.explanationType); + if (object.explanationSpec != null) { + if (typeof object.explanationSpec !== "object") + throw TypeError(".google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec.explanationSpec: object expected"); + message.explanationSpec = $root.google.cloud.aiplatform.v1.ExplanationSpec.fromObject(object.explanationSpec); + } + return message; + }; + + /** + * Creates a plain object from a ModelEvaluationExplanationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @static + * @param {google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec} message ModelEvaluationExplanationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ModelEvaluationExplanationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.explanationType = ""; + object.explanationSpec = null; + } + if (message.explanationType != null && message.hasOwnProperty("explanationType")) + object.explanationType = message.explanationType; + if (message.explanationSpec != null && message.hasOwnProperty("explanationSpec")) + object.explanationSpec = $root.google.cloud.aiplatform.v1.ExplanationSpec.toObject(message.explanationSpec, options); + return object; + }; + + /** + * Converts this ModelEvaluationExplanationSpec to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.ModelEvaluation.ModelEvaluationExplanationSpec + * @instance + * @returns {Object.} JSON object + */ + ModelEvaluationExplanationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ModelEvaluationExplanationSpec; + })(); + return ModelEvaluation; })(); @@ -95437,6 +95740,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1.ModelService#importModelEvaluation}. + * @memberof google.cloud.aiplatform.v1.ModelService + * @typedef ImportModelEvaluationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1.ModelEvaluation} [response] ModelEvaluation + */ + + /** + * Calls ImportModelEvaluation. + * @function importModelEvaluation + * @memberof google.cloud.aiplatform.v1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest} request ImportModelEvaluationRequest message or plain object + * @param {google.cloud.aiplatform.v1.ModelService.ImportModelEvaluationCallback} callback Node-style callback called with the error, if any, and ModelEvaluation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.importModelEvaluation = function importModelEvaluation(request, callback) { + return this.rpcCall(importModelEvaluation, $root.google.cloud.aiplatform.v1.ImportModelEvaluationRequest, $root.google.cloud.aiplatform.v1.ModelEvaluation, request, callback); + }, "name", { value: "ImportModelEvaluation" }); + + /** + * Calls ImportModelEvaluation. + * @function importModelEvaluation + * @memberof google.cloud.aiplatform.v1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest} request ImportModelEvaluationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1.ModelService#getModelEvaluation}. * @memberof google.cloud.aiplatform.v1.ModelService @@ -98341,6 +98677,221 @@ return ExportModelResponse; })(); + v1.ImportModelEvaluationRequest = (function() { + + /** + * Properties of an ImportModelEvaluationRequest. + * @memberof google.cloud.aiplatform.v1 + * @interface IImportModelEvaluationRequest + * @property {string|null} [parent] ImportModelEvaluationRequest parent + * @property {google.cloud.aiplatform.v1.IModelEvaluation|null} [modelEvaluation] ImportModelEvaluationRequest modelEvaluation + */ + + /** + * Constructs a new ImportModelEvaluationRequest. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents an ImportModelEvaluationRequest. + * @implements IImportModelEvaluationRequest + * @constructor + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest=} [properties] Properties to set + */ + function ImportModelEvaluationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportModelEvaluationRequest parent. + * @member {string} parent + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @instance + */ + ImportModelEvaluationRequest.prototype.parent = ""; + + /** + * ImportModelEvaluationRequest modelEvaluation. + * @member {google.cloud.aiplatform.v1.IModelEvaluation|null|undefined} modelEvaluation + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @instance + */ + ImportModelEvaluationRequest.prototype.modelEvaluation = null; + + /** + * Creates a new ImportModelEvaluationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.ImportModelEvaluationRequest} ImportModelEvaluationRequest instance + */ + ImportModelEvaluationRequest.create = function create(properties) { + return new ImportModelEvaluationRequest(properties); + }; + + /** + * Encodes the specified ImportModelEvaluationRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.ImportModelEvaluationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest} message ImportModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportModelEvaluationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.modelEvaluation != null && Object.hasOwnProperty.call(message, "modelEvaluation")) + $root.google.cloud.aiplatform.v1.ModelEvaluation.encode(message.modelEvaluation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.ImportModelEvaluationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1.IImportModelEvaluationRequest} message ImportModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportModelEvaluationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportModelEvaluationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.ImportModelEvaluationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.modelEvaluation = $root.google.cloud.aiplatform.v1.ModelEvaluation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportModelEvaluationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportModelEvaluationRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportModelEvaluationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.modelEvaluation != null && message.hasOwnProperty("modelEvaluation")) { + var error = $root.google.cloud.aiplatform.v1.ModelEvaluation.verify(message.modelEvaluation); + if (error) + return "modelEvaluation." + error; + } + return null; + }; + + /** + * Creates an ImportModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + */ + ImportModelEvaluationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.ImportModelEvaluationRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1.ImportModelEvaluationRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.modelEvaluation != null) { + if (typeof object.modelEvaluation !== "object") + throw TypeError(".google.cloud.aiplatform.v1.ImportModelEvaluationRequest.modelEvaluation: object expected"); + message.modelEvaluation = $root.google.cloud.aiplatform.v1.ModelEvaluation.fromObject(object.modelEvaluation); + } + return message; + }; + + /** + * Creates a plain object from an ImportModelEvaluationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1.ImportModelEvaluationRequest} message ImportModelEvaluationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportModelEvaluationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.modelEvaluation = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.modelEvaluation != null && message.hasOwnProperty("modelEvaluation")) + object.modelEvaluation = $root.google.cloud.aiplatform.v1.ModelEvaluation.toObject(message.modelEvaluation, options); + return object; + }; + + /** + * Converts this ImportModelEvaluationRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.ImportModelEvaluationRequest + * @instance + * @returns {Object.} JSON object + */ + ImportModelEvaluationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportModelEvaluationRequest; + })(); + v1.GetModelEvaluationRequest = (function() { /** @@ -244662,6 +245213,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#importModelEvaluation}. + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @typedef ImportModelEvaluationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1beta1.ModelEvaluation} [response] ModelEvaluation + */ + + /** + * Calls ImportModelEvaluation. + * @function importModelEvaluation + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest} request ImportModelEvaluationRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.ModelService.ImportModelEvaluationCallback} callback Node-style callback called with the error, if any, and ModelEvaluation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.importModelEvaluation = function importModelEvaluation(request, callback) { + return this.rpcCall(importModelEvaluation, $root.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest, $root.google.cloud.aiplatform.v1beta1.ModelEvaluation, request, callback); + }, "name", { value: "ImportModelEvaluation" }); + + /** + * Calls ImportModelEvaluation. + * @function importModelEvaluation + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest} request ImportModelEvaluationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#getModelEvaluation}. * @memberof google.cloud.aiplatform.v1beta1.ModelService @@ -247544,6 +248128,221 @@ return ExportModelResponse; })(); + v1beta1.ImportModelEvaluationRequest = (function() { + + /** + * Properties of an ImportModelEvaluationRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IImportModelEvaluationRequest + * @property {string|null} [parent] ImportModelEvaluationRequest parent + * @property {google.cloud.aiplatform.v1beta1.IModelEvaluation|null} [modelEvaluation] ImportModelEvaluationRequest modelEvaluation + */ + + /** + * Constructs a new ImportModelEvaluationRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an ImportModelEvaluationRequest. + * @implements IImportModelEvaluationRequest + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest=} [properties] Properties to set + */ + function ImportModelEvaluationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportModelEvaluationRequest parent. + * @member {string} parent + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @instance + */ + ImportModelEvaluationRequest.prototype.parent = ""; + + /** + * ImportModelEvaluationRequest modelEvaluation. + * @member {google.cloud.aiplatform.v1beta1.IModelEvaluation|null|undefined} modelEvaluation + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @instance + */ + ImportModelEvaluationRequest.prototype.modelEvaluation = null; + + /** + * Creates a new ImportModelEvaluationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest} ImportModelEvaluationRequest instance + */ + ImportModelEvaluationRequest.create = function create(properties) { + return new ImportModelEvaluationRequest(properties); + }; + + /** + * Encodes the specified ImportModelEvaluationRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest} message ImportModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportModelEvaluationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.modelEvaluation != null && Object.hasOwnProperty.call(message, "modelEvaluation")) + $root.google.cloud.aiplatform.v1beta1.ModelEvaluation.encode(message.modelEvaluation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest} message ImportModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportModelEvaluationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportModelEvaluationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.modelEvaluation = $root.google.cloud.aiplatform.v1beta1.ModelEvaluation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportModelEvaluationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportModelEvaluationRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportModelEvaluationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.modelEvaluation != null && message.hasOwnProperty("modelEvaluation")) { + var error = $root.google.cloud.aiplatform.v1beta1.ModelEvaluation.verify(message.modelEvaluation); + if (error) + return "modelEvaluation." + error; + } + return null; + }; + + /** + * Creates an ImportModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest} ImportModelEvaluationRequest + */ + ImportModelEvaluationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.modelEvaluation != null) { + if (typeof object.modelEvaluation !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest.modelEvaluation: object expected"); + message.modelEvaluation = $root.google.cloud.aiplatform.v1beta1.ModelEvaluation.fromObject(object.modelEvaluation); + } + return message; + }; + + /** + * Creates a plain object from an ImportModelEvaluationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest} message ImportModelEvaluationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportModelEvaluationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.modelEvaluation = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.modelEvaluation != null && message.hasOwnProperty("modelEvaluation")) + object.modelEvaluation = $root.google.cloud.aiplatform.v1beta1.ModelEvaluation.toObject(message.modelEvaluation, options); + return object; + }; + + /** + * Converts this ImportModelEvaluationRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest + * @instance + * @returns {Object.} JSON object + */ + ImportModelEvaluationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportModelEvaluationRequest; + })(); + v1beta1.GetModelEvaluationRequest = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 7d4c18de..3158f3d6 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -10916,17 +10916,11 @@ }, "metricsSchemaUri": { "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 2 }, "metrics": { "type": "google.protobuf.Value", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 3 }, "createTime": { "type": "google.protobuf.Timestamp", @@ -10938,16 +10932,37 @@ "sliceDimensions": { "rule": "repeated", "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 5 + }, + "dataItemSchemaUri": { + "type": "string", + "id": 6 + }, + "annotationSchemaUri": { + "type": "string", + "id": 7 }, "modelExplanation": { "type": "ModelExplanation", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" + "id": 8 + }, + "explanationSpecs": { + "rule": "repeated", + "type": "ModelEvaluationExplanationSpec", + "id": 9 + } + }, + "nested": { + "ModelEvaluationExplanationSpec": { + "fields": { + "explanationType": { + "type": "string", + "id": 1 + }, + "explanationSpec": { + "type": "ExplanationSpec", + "id": 2 + } } } } @@ -11159,6 +11174,26 @@ } ] }, + "ImportModelEvaluation": { + "requestType": "ImportModelEvaluationRequest", + "responseType": "ModelEvaluation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*/models/*}/evaluations:import", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,model_evaluation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*/models/*}/evaluations:import", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,model_evaluation" + } + ] + }, "GetModelEvaluation": { "requestType": "GetModelEvaluationRequest", "responseType": "ModelEvaluation", @@ -11433,6 +11468,25 @@ "ExportModelResponse": { "fields": {} }, + "ImportModelEvaluationRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Model" + } + }, + "modelEvaluation": { + "type": "ModelEvaluation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "GetModelEvaluationRequest": { "fields": { "name": { @@ -27787,17 +27841,11 @@ }, "metricsSchemaUri": { "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 2 }, "metrics": { "type": "google.protobuf.Value", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 3 }, "createTime": { "type": "google.protobuf.Timestamp", @@ -27809,25 +27857,16 @@ "sliceDimensions": { "rule": "repeated", "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 5 }, "modelExplanation": { "type": "ModelExplanation", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 8 }, "explanationSpecs": { "rule": "repeated", "type": "ModelEvaluationExplanationSpec", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": 9 } }, "nested": { @@ -28052,6 +28091,26 @@ } ] }, + "ImportModelEvaluation": { + "requestType": "ImportModelEvaluationRequest", + "responseType": "ModelEvaluation", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/locations/*/models/*}/evaluations:import", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,model_evaluation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/locations/*/models/*}/evaluations:import", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,model_evaluation" + } + ] + }, "GetModelEvaluation": { "requestType": "GetModelEvaluationRequest", "responseType": "ModelEvaluation", @@ -28322,6 +28381,25 @@ "ExportModelResponse": { "fields": {} }, + "ImportModelEvaluationRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Model" + } + }, + "modelEvaluation": { + "type": "ModelEvaluation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "GetModelEvaluationRequest": { "fields": { "name": { diff --git a/samples/generated/v1/model_service.import_model_evaluation.js b/samples/generated/v1/model_service.import_model_evaluation.js new file mode 100644 index 00000000..3aa60678 --- /dev/null +++ b/samples/generated/v1/model_service.import_model_evaluation.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, modelEvaluation) { + // [START aiplatform_v1_generated_ModelService_ImportModelEvaluation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent model resource. + * Format: `projects/{project}/locations/{location}/models/{model}` + */ + // const parent = 'abc123' + /** + * Required. Model evaluation resource to be imported. + */ + // const modelEvaluation = {} + + // Imports the Aiplatform library + const {ModelServiceClient} = require('@google-cloud/aiplatform').v1; + + // Instantiates a client + const aiplatformClient = new ModelServiceClient(); + + async function callImportModelEvaluation() { + // Construct request + const request = { + parent, + modelEvaluation, + }; + + // Run request + const response = await aiplatformClient.importModelEvaluation(request); + console.log(response); + } + + callImportModelEvaluation(); + // [END aiplatform_v1_generated_ModelService_ImportModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1/snippet_metadata.google.cloud.aiplatform.v1.json b/samples/generated/v1/snippet_metadata.google.cloud.aiplatform.v1.json index 322f5240..7ba89644 100644 --- a/samples/generated/v1/snippet_metadata.google.cloud.aiplatform.v1.json +++ b/samples/generated/v1/snippet_metadata.google.cloud.aiplatform.v1.json @@ -5555,6 +5555,50 @@ } } }, + { + "regionTag": "aiplatform_v1_generated_ModelService_ImportModelEvaluation_async", + "title": "DatasetService importModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Imports an externally generated ModelEvaluation.", + "canonical": true, + "file": "model_service.import_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportModelEvaluation", + "fullName": "google.cloud.aiplatform.v1.ModelService.ImportModelEvaluation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model_evaluation", + "type": ".google.cloud.aiplatform.v1.ModelEvaluation" + } + ], + "resultType": ".google.cloud.aiplatform.v1.ModelEvaluation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.aiplatform.v1.ModelServiceClient" + }, + "method": { + "shortName": "ImportModelEvaluation", + "fullName": "google.cloud.aiplatform.v1.ModelService.ImportModelEvaluation", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.aiplatform.v1.ModelService" + } + } + } + }, { "regionTag": "aiplatform_v1_generated_ModelService_GetModelEvaluation_async", "title": "DatasetService getModelEvaluation Sample", diff --git a/samples/generated/v1beta1/model_service.import_model_evaluation.js b/samples/generated/v1beta1/model_service.import_model_evaluation.js new file mode 100644 index 00000000..1f4795b7 --- /dev/null +++ b/samples/generated/v1beta1/model_service.import_model_evaluation.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, modelEvaluation) { + // [START aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the parent model resource. + * Format: `projects/{project}/locations/{location}/models/{model}` + */ + // const parent = 'abc123' + /** + * Required. Model evaluation resource to be imported. + */ + // const modelEvaluation = {} + + // Imports the Aiplatform library + const {ModelServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new ModelServiceClient(); + + async function callImportModelEvaluation() { + // Construct request + const request = { + parent, + modelEvaluation, + }; + + // Run request + const response = await aiplatformClient.importModelEvaluation(request); + console.log(response); + } + + callImportModelEvaluation(); + // [END aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json b/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json index 2c2e3746..c4c44ff4 100644 --- a/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json +++ b/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json @@ -5547,6 +5547,50 @@ } } }, + { + "regionTag": "aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async", + "title": "DatasetService importModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Imports an externally generated ModelEvaluation.", + "canonical": true, + "file": "model_service.import_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportModelEvaluation", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService.ImportModelEvaluation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model_evaluation", + "type": ".google.cloud.aiplatform.v1beta1.ModelEvaluation" + } + ], + "resultType": ".google.cloud.aiplatform.v1beta1.ModelEvaluation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.ModelServiceClient" + }, + "method": { + "shortName": "ImportModelEvaluation", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService.ImportModelEvaluation", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService" + } + } + } + }, { "regionTag": "aiplatform_v1beta1_generated_ModelService_GetModelEvaluation_async", "title": "DatasetService getModelEvaluation Sample", diff --git a/src/v1/gapic_metadata.json b/src/v1/gapic_metadata.json index 04b8a401..8c7e4346 100644 --- a/src/v1/gapic_metadata.json +++ b/src/v1/gapic_metadata.json @@ -1359,6 +1359,11 @@ "updateModel" ] }, + "ImportModelEvaluation": { + "methods": [ + "importModelEvaluation" + ] + }, "GetModelEvaluation": { "methods": [ "getModelEvaluation" @@ -1420,6 +1425,11 @@ "updateModel" ] }, + "ImportModelEvaluation": { + "methods": [ + "importModelEvaluation" + ] + }, "GetModelEvaluation": { "methods": [ "getModelEvaluation" diff --git a/src/v1/model_service_client.ts b/src/v1/model_service_client.ts index da86a562..a04a7081 100644 --- a/src/v1/model_service_client.ts +++ b/src/v1/model_service_client.ts @@ -394,6 +394,7 @@ export class ModelServiceClient { 'updateModel', 'deleteModel', 'exportModel', + 'importModelEvaluation', 'getModelEvaluation', 'listModelEvaluations', 'getModelEvaluationSlice', @@ -655,6 +656,106 @@ export class ModelServiceClient { this.initialize(); return this.innerApiCalls.updateModel(request, options, callback); } + /** + * Imports an externally generated ModelEvaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent model resource. + * Format: `projects/{project}/locations/{location}/models/{model}` + * @param {google.cloud.aiplatform.v1.ModelEvaluation} request.modelEvaluation + * Required. Model evaluation resource to be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ModelEvaluation]{@link google.cloud.aiplatform.v1.ModelEvaluation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/model_service.import_model_evaluation.js + * region_tag:aiplatform_v1_generated_ModelService_ImportModelEvaluation_async + */ + importModelEvaluation( + request?: protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IModelEvaluation, + ( + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | undefined + ), + {} | undefined + ] + >; + importModelEvaluation( + request: protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importModelEvaluation( + request: protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importModelEvaluation( + request?: protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IModelEvaluation, + ( + | protos.google.cloud.aiplatform.v1.IImportModelEvaluationRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importModelEvaluation(request, options, callback); + } /** * Gets a ModelEvaluation. * diff --git a/src/v1/model_service_client_config.json b/src/v1/model_service_client_config.json index 498c56c4..8ecf5e9a 100644 --- a/src/v1/model_service_client_config.json +++ b/src/v1/model_service_client_config.json @@ -44,6 +44,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ImportModelEvaluation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GetModelEvaluation": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/src/v1beta1/gapic_metadata.json b/src/v1beta1/gapic_metadata.json index 3b5a35ee..32560cce 100644 --- a/src/v1beta1/gapic_metadata.json +++ b/src/v1beta1/gapic_metadata.json @@ -1359,6 +1359,11 @@ "updateModel" ] }, + "ImportModelEvaluation": { + "methods": [ + "importModelEvaluation" + ] + }, "GetModelEvaluation": { "methods": [ "getModelEvaluation" @@ -1420,6 +1425,11 @@ "updateModel" ] }, + "ImportModelEvaluation": { + "methods": [ + "importModelEvaluation" + ] + }, "GetModelEvaluation": { "methods": [ "getModelEvaluation" diff --git a/src/v1beta1/model_service_client.ts b/src/v1beta1/model_service_client.ts index ced4fecd..b6cfa250 100644 --- a/src/v1beta1/model_service_client.ts +++ b/src/v1beta1/model_service_client.ts @@ -394,6 +394,7 @@ export class ModelServiceClient { 'updateModel', 'deleteModel', 'exportModel', + 'importModelEvaluation', 'getModelEvaluation', 'listModelEvaluations', 'getModelEvaluationSlice', @@ -669,6 +670,106 @@ export class ModelServiceClient { this.initialize(); return this.innerApiCalls.updateModel(request, options, callback); } + /** + * Imports an externally generated ModelEvaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent model resource. + * Format: `projects/{project}/locations/{location}/models/{model}` + * @param {google.cloud.aiplatform.v1beta1.ModelEvaluation} request.modelEvaluation + * Required. Model evaluation resource to be imported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ModelEvaluation]{@link google.cloud.aiplatform.v1beta1.ModelEvaluation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/model_service.import_model_evaluation.js + * region_tag:aiplatform_v1beta1_generated_ModelService_ImportModelEvaluation_async + */ + importModelEvaluation( + request?: protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + ( + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | undefined + ), + {} | undefined + ] + >; + importModelEvaluation( + request: protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importModelEvaluation( + request: protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importModelEvaluation( + request?: protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IModelEvaluation, + ( + | protos.google.cloud.aiplatform.v1beta1.IImportModelEvaluationRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importModelEvaluation(request, options, callback); + } /** * Gets a ModelEvaluation. * diff --git a/src/v1beta1/model_service_client_config.json b/src/v1beta1/model_service_client_config.json index 2308e462..65b4fdcf 100644 --- a/src/v1beta1/model_service_client_config.json +++ b/src/v1beta1/model_service_client_config.json @@ -50,6 +50,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ImportModelEvaluation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GetModelEvaluation": { "timeout_millis": 5000, "retry_codes_name": "non_idempotent", diff --git a/test/gapic_model_service_v1.ts b/test/gapic_model_service_v1.ts index 451ae34d..3cf6a02b 100644 --- a/test/gapic_model_service_v1.ts +++ b/test/gapic_model_service_v1.ts @@ -493,6 +493,139 @@ describe('v1.ModelServiceClient', () => { }); }); + describe('importModelEvaluation', () => { + it('invokes importModelEvaluation without error', async () => { + const client = new modelserviceModule.v1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ModelEvaluation() + ); + client.innerApiCalls.importModelEvaluation = + stubSimpleCall(expectedResponse); + const [response] = await client.importModelEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importModelEvaluation without error using callback', async () => { + const client = new modelserviceModule.v1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ModelEvaluation() + ); + client.innerApiCalls.importModelEvaluation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importModelEvaluation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1.IModelEvaluation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importModelEvaluation with error', async () => { + const client = new modelserviceModule.v1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importModelEvaluation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.importModelEvaluation(request), + expectedError + ); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importModelEvaluation with closed client', async () => { + const client = new modelserviceModule.v1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.importModelEvaluation(request), + expectedError + ); + }); + }); + describe('getModelEvaluation', () => { it('invokes getModelEvaluation without error', async () => { const client = new modelserviceModule.v1.ModelServiceClient({ diff --git a/test/gapic_model_service_v1beta1.ts b/test/gapic_model_service_v1beta1.ts index 93f9bca3..88c8f256 100644 --- a/test/gapic_model_service_v1beta1.ts +++ b/test/gapic_model_service_v1beta1.ts @@ -495,6 +495,139 @@ describe('v1beta1.ModelServiceClient', () => { }); }); + describe('importModelEvaluation', () => { + it('invokes importModelEvaluation without error', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() + ); + client.innerApiCalls.importModelEvaluation = + stubSimpleCall(expectedResponse); + const [response] = await client.importModelEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importModelEvaluation without error using callback', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() + ); + client.innerApiCalls.importModelEvaluation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importModelEvaluation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1beta1.IModelEvaluation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importModelEvaluation with error', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importModelEvaluation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.importModelEvaluation(request), + expectedError + ); + assert( + (client.innerApiCalls.importModelEvaluation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importModelEvaluation with closed client', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.ImportModelEvaluationRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.importModelEvaluation(request), + expectedError + ); + }); + }); + describe('getModelEvaluation', () => { it('invokes getModelEvaluation without error', async () => { const client = new modelserviceModule.v1beta1.ModelServiceClient({