From c69ac2bb8d64e443fa4296204a770f5120cb9682 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 12:03:09 -0700 Subject: [PATCH] feat: add Examples to Explanation related messages in aiplatform v1beta1 explanation.proto (#307) * feat: add Examples to Explanation related messages in aiplatform v1beta1 explanation.proto --- .../aiplatform/v1beta1/explanation.proto | 108 +- .../v1beta1/explanation_metadata.proto | 3 + .../aiplatform/v1beta1/model_service.proto | 54 + protos/protos.d.ts | 768 ++++++- protos/protos.js | 1899 ++++++++++++++++- protos/protos.json | 199 +- .../v1beta1/model_service.export_model.js | 2 + .../v1beta1/model_service.get_model.js | 9 + ...odel_service.update_explanation_dataset.js | 64 + ...adata.google.cloud.aiplatform.v1beta1.json | 48 +- src/v1beta1/gapic_metadata.json | 10 + src/v1beta1/model_service_client.ts | 172 ++ src/v1beta1/model_service_client_config.json | 4 + test/gapic_model_service_v1beta1.ts | 198 ++ 14 files changed, 3498 insertions(+), 40 deletions(-) create mode 100644 samples/generated/v1beta1/model_service.update_explanation_dataset.js diff --git a/protos/google/cloud/aiplatform/v1beta1/explanation.proto b/protos/google/cloud/aiplatform/v1beta1/explanation.proto index 1f3b2512..11e4c6c5 100644 --- a/protos/google/cloud/aiplatform/v1beta1/explanation.proto +++ b/protos/google/cloud/aiplatform/v1beta1/explanation.proto @@ -47,6 +47,12 @@ message Explanation { // the attributions are stored by [Attribution.output_index][google.cloud.aiplatform.v1beta1.Attribution.output_index] in the same // order as they appear in the output_indices. repeated Attribution attributions = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List of the nearest neighbors for example-based explanations. + // + // For models deployed with the examples explanations feature enabled, the + // attributions field is empty and instead the neighbors field is populated. + repeated Neighbor neighbors = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Aggregated explanation metrics for a Model over a set of instances. @@ -163,6 +169,15 @@ message Attribution { string output_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; } +// Neighbors for example-based explanations. +message Neighbor { + // Output only. The neighbor id. + string neighbor_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The neighbor distance. + double neighbor_distance = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + // Specification of Model explanation. message ExplanationSpec { // Required. Parameters that configure explaining of the Model's predictions. @@ -373,17 +388,57 @@ message BlurBaselineConfig { // Example-based explainability that returns the nearest neighbors from the // provided dataset. message Examples { + oneof config { + // The configuration for the generated index, the semantics are the same as + // [metadata][google.cloud.aiplatform.v1beta1.Index.metadata] and should match NearestNeighborSearchConfig. + google.protobuf.Value nearest_neighbor_search_config = 2; + + // Preset config based on the desired query speed-precision trade-off + // and modality + Preset preset = 4; + } + // The Cloud Storage location for the input instances. GcsSource gcs_source = 1; - // The configuration for the generated index, the semantics are the same as - // [metadata][google.cloud.aiplatform.v1beta1.Index.metadata] and should match NearestNeighborSearchConfig. - google.protobuf.Value nearest_neighbor_search_config = 2; - // The number of neighbors to return. int32 neighbor_count = 3; } +// Preset configuration for example-based explanations +message Preset { + // Preset option controlling parameters for query speed-precision trade-off + enum Query { + // More precise neighbors as a trade-off against slower response. + // This is also the default value (field-number 0). + PRECISE = 0; + + // Faster response as a trade-off against less precise neighbors. + FAST = 1; + } + + // Preset option controlling parameters for different modalities + enum Modality { + // Should not be set. Added as a recommended best practice for enums + MODALITY_UNSPECIFIED = 0; + + // IMAGE modality + IMAGE = 1; + + // TEXT modality + TEXT = 2; + + // TABULAR modality + TABULAR = 3; + } + + // Preset option controlling parameters for query speed-precision trade-off + optional Query query = 1; + + // Preset option controlling parameters for different modalities + Modality modality = 2; +} + // The [ExplanationSpec][google.cloud.aiplatform.v1beta1.ExplanationSpec] entries that can be overridden at // [online explanation][google.cloud.aiplatform.v1beta1.PredictionService.Explain] time. message ExplanationSpecOverride { @@ -394,6 +449,9 @@ message ExplanationSpecOverride { // The metadata to be overridden. If not specified, no metadata is overridden. ExplanationMetadataOverride metadata = 2; + + // The example-based explanations parameter overrides. + ExamplesOverride examples_override = 3; } // The [ExplanationMetadata][google.cloud.aiplatform.v1beta1.ExplanationMetadata] entries that can be overridden at @@ -418,3 +476,45 @@ message ExplanationMetadataOverride { // overridden. map inputs = 1 [(google.api.field_behavior) = REQUIRED]; } + +// Overrides for example-based explanations. +message ExamplesOverride { + // Data format enum. + enum DataFormat { + // Unspecified format. Must not be used. + DATA_FORMAT_UNSPECIFIED = 0; + + // Provided data is a set of model inputs. + INSTANCES = 1; + + // Provided data is a set of embeddings. + EMBEDDINGS = 2; + } + + // The number of neighbors to return. + int32 neighbor_count = 1; + + // The number of neighbors to return that have the same crowding tag. + int32 crowding_count = 2; + + // Restrict the resulting nearest neighbors to respect these constraints. + repeated ExamplesRestrictionsNamespace restrictions = 3; + + // If true, return the embeddings instead of neighbors. + bool return_embeddings = 4; + + // The format of the data being provided with each call. + DataFormat data_format = 5; +} + +// Restrictions namespace for example-based explanations overrides. +message ExamplesRestrictionsNamespace { + // The namespace name. + string namespace_name = 1; + + // The list of allowed tags. + repeated string allow = 2; + + // The list of deny tags. + repeated string deny = 3; +} diff --git a/protos/google/cloud/aiplatform/v1beta1/explanation_metadata.proto b/protos/google/cloud/aiplatform/v1beta1/explanation_metadata.proto index 8d59f088..ef962a51 100644 --- a/protos/google/cloud/aiplatform/v1beta1/explanation_metadata.proto +++ b/protos/google/cloud/aiplatform/v1beta1/explanation_metadata.proto @@ -392,4 +392,7 @@ message ExplanationMetadata { // than the one given on input. The output URI will point to a location where // the user only has a read access. string feature_attributions_schema_uri = 3; + + // Name of the source to generate embeddings for example based explanations. + string latent_space_source = 5; } diff --git a/protos/google/cloud/aiplatform/v1beta1/model_service.proto b/protos/google/cloud/aiplatform/v1beta1/model_service.proto index 4bc803b0..273718e0 100644 --- a/protos/google/cloud/aiplatform/v1beta1/model_service.proto +++ b/protos/google/cloud/aiplatform/v1beta1/model_service.proto @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/aiplatform/v1beta1/explanation.proto"; import "google/cloud/aiplatform/v1beta1/io.proto"; import "google/cloud/aiplatform/v1beta1/model.proto"; import "google/cloud/aiplatform/v1beta1/model_evaluation.proto"; @@ -87,6 +88,19 @@ service ModelService { option (google.api.method_signature) = "model,update_mask"; } + // Incremental update the dataset used for a examples model. + rpc UpdateExplanationDataset(UpdateExplanationDatasetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{model=projects/*/locations/*/models/*}:updateExplanationDataset" + body: "*" + }; + option (google.api.method_signature) = "model"; + option (google.longrunning.operation_info) = { + response_type: "UpdateExplanationDatasetResponse" + metadata_type: "UpdateExplanationDatasetOperationMetadata" + }; + } + // Deletes a Model. // // A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a @@ -233,6 +247,16 @@ message UploadModelResponse { message GetModelRequest { // Required. The name of the Model resource. // Format: `projects/{project}/locations/{location}/models/{model}` + // + // In order to retrieve a specific version of the model, also provide + // the version ID or version alias. + // Example: projects/{project}/locations/{location}/models/{model}@2 + // or + // projects/{project}/locations/{location}/models/{model}@golden + // If no version ID or alias is specified, the "default" version will be + // returned. The "default" version alias is created for the first version of + // the model, and can be moved to other versions later on. There will be + // exactly one default version. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -366,6 +390,29 @@ message UpdateModelRequest { google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } +// Request message for +// [ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDataset]. +message UpdateExplanationDatasetRequest { + // Required. The resource name of the Model to update. + // Format: `projects/{project}/locations/{location}/models/{model}` + string model = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Model" + } + ]; + + // The example config containing the location of the dataset. + Examples examples = 2; +} + +// Runtime operation information for +// [ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDataset]. +message UpdateExplanationDatasetOperationMetadata { + // The common part of the operation metadata. + GenericOperationMetadata generic_metadata = 1; +} + // Request message for [ModelService.DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel]. message DeleteModelRequest { // Required. The name of the Model resource to be deleted. @@ -448,6 +495,8 @@ message ExportModelRequest { } // Required. The resource name of the Model to export. + // The resource name may contain version id or version alias to specify the + // version, if no version is specified, the default version will be exported. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -481,6 +530,11 @@ message ExportModelOperationMetadata { OutputInfo output_info = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; } +// Response message of [ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDataset] operation. +message UpdateExplanationDatasetResponse { + +} + // Response message of [ModelService.ExportModel][google.cloud.aiplatform.v1beta1.ModelService.ExportModel] operation. message ExportModelResponse { diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 806c7345..e696d548 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -63019,6 +63019,9 @@ export namespace google { /** Explanation attributions */ attributions?: (google.cloud.aiplatform.v1beta1.IAttribution[]|null); + + /** Explanation neighbors */ + neighbors?: (google.cloud.aiplatform.v1beta1.INeighbor[]|null); } /** Represents an Explanation. */ @@ -63033,6 +63036,9 @@ export namespace google { /** Explanation attributions. */ public attributions: google.cloud.aiplatform.v1beta1.IAttribution[]; + /** Explanation neighbors. */ + public neighbors: google.cloud.aiplatform.v1beta1.INeighbor[]; + /** * Creates a new Explanation instance using the specified properties. * @param [properties] Properties to set @@ -63320,6 +63326,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a Neighbor. */ + interface INeighbor { + + /** Neighbor neighborId */ + neighborId?: (string|null); + + /** Neighbor neighborDistance */ + neighborDistance?: (number|null); + } + + /** Represents a Neighbor. */ + class Neighbor implements INeighbor { + + /** + * Constructs a new Neighbor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.INeighbor); + + /** Neighbor neighborId. */ + public neighborId: string; + + /** Neighbor neighborDistance. */ + public neighborDistance: number; + + /** + * Creates a new Neighbor instance using the specified properties. + * @param [properties] Properties to set + * @returns Neighbor instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.INeighbor): google.cloud.aiplatform.v1beta1.Neighbor; + + /** + * Encodes the specified Neighbor message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Neighbor.verify|verify} messages. + * @param message Neighbor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.INeighbor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Neighbor message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Neighbor.verify|verify} messages. + * @param message Neighbor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.INeighbor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Neighbor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Neighbor + * @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.Neighbor; + + /** + * Decodes a Neighbor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Neighbor + * @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.Neighbor; + + /** + * Verifies a Neighbor 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 Neighbor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Neighbor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.Neighbor; + + /** + * Creates a plain object from a Neighbor message. Also converts values to other types if specified. + * @param message Neighbor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.Neighbor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Neighbor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an ExplanationSpec. */ interface IExplanationSpec { @@ -64220,12 +64322,15 @@ export namespace google { /** Properties of an Examples. */ interface IExamples { - /** Examples gcsSource */ - gcsSource?: (google.cloud.aiplatform.v1beta1.IGcsSource|null); - /** Examples nearestNeighborSearchConfig */ nearestNeighborSearchConfig?: (google.protobuf.IValue|null); + /** Examples preset */ + preset?: (google.cloud.aiplatform.v1beta1.IPreset|null); + + /** Examples gcsSource */ + gcsSource?: (google.cloud.aiplatform.v1beta1.IGcsSource|null); + /** Examples neighborCount */ neighborCount?: (number|null); } @@ -64239,15 +64344,21 @@ export namespace google { */ constructor(properties?: google.cloud.aiplatform.v1beta1.IExamples); - /** Examples gcsSource. */ - public gcsSource?: (google.cloud.aiplatform.v1beta1.IGcsSource|null); - /** Examples nearestNeighborSearchConfig. */ public nearestNeighborSearchConfig?: (google.protobuf.IValue|null); + /** Examples preset. */ + public preset?: (google.cloud.aiplatform.v1beta1.IPreset|null); + + /** Examples gcsSource. */ + public gcsSource?: (google.cloud.aiplatform.v1beta1.IGcsSource|null); + /** Examples neighborCount. */ public neighborCount: number; + /** Examples config. */ + public config?: ("nearestNeighborSearchConfig"|"preset"); + /** * Creates a new Examples instance using the specified properties. * @param [properties] Properties to set @@ -64319,6 +64430,122 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a Preset. */ + interface IPreset { + + /** Preset query */ + query?: (google.cloud.aiplatform.v1beta1.Preset.Query|keyof typeof google.cloud.aiplatform.v1beta1.Preset.Query|null); + + /** Preset modality */ + modality?: (google.cloud.aiplatform.v1beta1.Preset.Modality|keyof typeof google.cloud.aiplatform.v1beta1.Preset.Modality|null); + } + + /** Represents a Preset. */ + class Preset implements IPreset { + + /** + * Constructs a new Preset. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IPreset); + + /** Preset query. */ + public query?: (google.cloud.aiplatform.v1beta1.Preset.Query|keyof typeof google.cloud.aiplatform.v1beta1.Preset.Query|null); + + /** Preset modality. */ + public modality: (google.cloud.aiplatform.v1beta1.Preset.Modality|keyof typeof google.cloud.aiplatform.v1beta1.Preset.Modality); + + /** Preset _query. */ + public _query?: "query"; + + /** + * Creates a new Preset instance using the specified properties. + * @param [properties] Properties to set + * @returns Preset instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IPreset): google.cloud.aiplatform.v1beta1.Preset; + + /** + * Encodes the specified Preset message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Preset.verify|verify} messages. + * @param message Preset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IPreset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Preset message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Preset.verify|verify} messages. + * @param message Preset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IPreset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Preset message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Preset + * @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.Preset; + + /** + * Decodes a Preset message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Preset + * @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.Preset; + + /** + * Verifies a Preset 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 Preset message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Preset + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.Preset; + + /** + * Creates a plain object from a Preset message. Also converts values to other types if specified. + * @param message Preset + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.Preset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Preset to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Preset { + + /** Query enum. */ + enum Query { + PRECISE = 0, + FAST = 1 + } + + /** Modality enum. */ + enum Modality { + MODALITY_UNSPECIFIED = 0, + IMAGE = 1, + TEXT = 2, + TABULAR = 3 + } + } + /** Properties of an ExplanationSpecOverride. */ interface IExplanationSpecOverride { @@ -64327,6 +64554,9 @@ export namespace google { /** ExplanationSpecOverride metadata */ metadata?: (google.cloud.aiplatform.v1beta1.IExplanationMetadataOverride|null); + + /** ExplanationSpecOverride examplesOverride */ + examplesOverride?: (google.cloud.aiplatform.v1beta1.IExamplesOverride|null); } /** Represents an ExplanationSpecOverride. */ @@ -64344,6 +64574,9 @@ export namespace google { /** ExplanationSpecOverride metadata. */ public metadata?: (google.cloud.aiplatform.v1beta1.IExplanationMetadataOverride|null); + /** ExplanationSpecOverride examplesOverride. */ + public examplesOverride?: (google.cloud.aiplatform.v1beta1.IExamplesOverride|null); + /** * Creates a new ExplanationSpecOverride instance using the specified properties. * @param [properties] Properties to set @@ -64598,6 +64831,232 @@ export namespace google { } } + /** Properties of an ExamplesOverride. */ + interface IExamplesOverride { + + /** ExamplesOverride neighborCount */ + neighborCount?: (number|null); + + /** ExamplesOverride crowdingCount */ + crowdingCount?: (number|null); + + /** ExamplesOverride restrictions */ + restrictions?: (google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace[]|null); + + /** ExamplesOverride returnEmbeddings */ + returnEmbeddings?: (boolean|null); + + /** ExamplesOverride dataFormat */ + dataFormat?: (google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat|keyof typeof google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat|null); + } + + /** Represents an ExamplesOverride. */ + class ExamplesOverride implements IExamplesOverride { + + /** + * Constructs a new ExamplesOverride. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IExamplesOverride); + + /** ExamplesOverride neighborCount. */ + public neighborCount: number; + + /** ExamplesOverride crowdingCount. */ + public crowdingCount: number; + + /** ExamplesOverride restrictions. */ + public restrictions: google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace[]; + + /** ExamplesOverride returnEmbeddings. */ + public returnEmbeddings: boolean; + + /** ExamplesOverride dataFormat. */ + public dataFormat: (google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat|keyof typeof google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat); + + /** + * Creates a new ExamplesOverride instance using the specified properties. + * @param [properties] Properties to set + * @returns ExamplesOverride instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IExamplesOverride): google.cloud.aiplatform.v1beta1.ExamplesOverride; + + /** + * Encodes the specified ExamplesOverride message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesOverride.verify|verify} messages. + * @param message ExamplesOverride message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IExamplesOverride, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExamplesOverride message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesOverride.verify|verify} messages. + * @param message ExamplesOverride message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IExamplesOverride, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExamplesOverride message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExamplesOverride + * @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.ExamplesOverride; + + /** + * Decodes an ExamplesOverride message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExamplesOverride + * @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.ExamplesOverride; + + /** + * Verifies an ExamplesOverride 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 ExamplesOverride message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExamplesOverride + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.ExamplesOverride; + + /** + * Creates a plain object from an ExamplesOverride message. Also converts values to other types if specified. + * @param message ExamplesOverride + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.ExamplesOverride, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExamplesOverride to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ExamplesOverride { + + /** DataFormat enum. */ + enum DataFormat { + DATA_FORMAT_UNSPECIFIED = 0, + INSTANCES = 1, + EMBEDDINGS = 2 + } + } + + /** Properties of an ExamplesRestrictionsNamespace. */ + interface IExamplesRestrictionsNamespace { + + /** ExamplesRestrictionsNamespace namespaceName */ + namespaceName?: (string|null); + + /** ExamplesRestrictionsNamespace allow */ + allow?: (string[]|null); + + /** ExamplesRestrictionsNamespace deny */ + deny?: (string[]|null); + } + + /** Represents an ExamplesRestrictionsNamespace. */ + class ExamplesRestrictionsNamespace implements IExamplesRestrictionsNamespace { + + /** + * Constructs a new ExamplesRestrictionsNamespace. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace); + + /** ExamplesRestrictionsNamespace namespaceName. */ + public namespaceName: string; + + /** ExamplesRestrictionsNamespace allow. */ + public allow: string[]; + + /** ExamplesRestrictionsNamespace deny. */ + public deny: string[]; + + /** + * Creates a new ExamplesRestrictionsNamespace instance using the specified properties. + * @param [properties] Properties to set + * @returns ExamplesRestrictionsNamespace instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace): google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace; + + /** + * Encodes the specified ExamplesRestrictionsNamespace message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.verify|verify} messages. + * @param message ExamplesRestrictionsNamespace message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExamplesRestrictionsNamespace message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.verify|verify} messages. + * @param message ExamplesRestrictionsNamespace message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExamplesRestrictionsNamespace message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExamplesRestrictionsNamespace + * @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.ExamplesRestrictionsNamespace; + + /** + * Decodes an ExamplesRestrictionsNamespace message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExamplesRestrictionsNamespace + * @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.ExamplesRestrictionsNamespace; + + /** + * Verifies an ExamplesRestrictionsNamespace 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 ExamplesRestrictionsNamespace message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExamplesRestrictionsNamespace + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace; + + /** + * Creates a plain object from an ExamplesRestrictionsNamespace message. Also converts values to other types if specified. + * @param message ExamplesRestrictionsNamespace + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExamplesRestrictionsNamespace to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an ExplanationMetadata. */ interface IExplanationMetadata { @@ -64609,6 +65068,9 @@ export namespace google { /** ExplanationMetadata featureAttributionsSchemaUri */ featureAttributionsSchemaUri?: (string|null); + + /** ExplanationMetadata latentSpaceSource */ + latentSpaceSource?: (string|null); } /** Represents an ExplanationMetadata. */ @@ -64629,6 +65091,9 @@ export namespace google { /** ExplanationMetadata featureAttributionsSchemaUri. */ public featureAttributionsSchemaUri: string; + /** ExplanationMetadata latentSpaceSource. */ + public latentSpaceSource: string; + /** * Creates a new ExplanationMetadata instance using the specified properties. * @param [properties] Properties to set @@ -102239,6 +102704,20 @@ export namespace google { */ public updateModel(request: google.cloud.aiplatform.v1beta1.IUpdateModelRequest): Promise; + /** + * Calls UpdateExplanationDataset. + * @param request UpdateExplanationDatasetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateExplanationDataset(request: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, callback: google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDatasetCallback): void; + + /** + * Calls UpdateExplanationDataset. + * @param request UpdateExplanationDatasetRequest message or plain object + * @returns Promise + */ + public updateExplanationDataset(request: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest): Promise; + /** * Calls DeleteModel. * @param request DeleteModelRequest message or plain object @@ -102403,6 +102882,13 @@ export namespace google { */ type UpdateModelCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.Model) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#updateExplanationDataset}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateExplanationDatasetCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#deleteModel}. * @param error Error, if any @@ -103367,6 +103853,192 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an UpdateExplanationDatasetRequest. */ + interface IUpdateExplanationDatasetRequest { + + /** UpdateExplanationDatasetRequest model */ + model?: (string|null); + + /** UpdateExplanationDatasetRequest examples */ + examples?: (google.cloud.aiplatform.v1beta1.IExamples|null); + } + + /** Represents an UpdateExplanationDatasetRequest. */ + class UpdateExplanationDatasetRequest implements IUpdateExplanationDatasetRequest { + + /** + * Constructs a new UpdateExplanationDatasetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest); + + /** UpdateExplanationDatasetRequest model. */ + public model: string; + + /** UpdateExplanationDatasetRequest examples. */ + public examples?: (google.cloud.aiplatform.v1beta1.IExamples|null); + + /** + * Creates a new UpdateExplanationDatasetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateExplanationDatasetRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest; + + /** + * Encodes the specified UpdateExplanationDatasetRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest.verify|verify} messages. + * @param message UpdateExplanationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateExplanationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest.verify|verify} messages. + * @param message UpdateExplanationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateExplanationDatasetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateExplanationDatasetRequest + * @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.UpdateExplanationDatasetRequest; + + /** + * Decodes an UpdateExplanationDatasetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateExplanationDatasetRequest + * @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.UpdateExplanationDatasetRequest; + + /** + * Verifies an UpdateExplanationDatasetRequest 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 UpdateExplanationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateExplanationDatasetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest; + + /** + * Creates a plain object from an UpdateExplanationDatasetRequest message. Also converts values to other types if specified. + * @param message UpdateExplanationDatasetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateExplanationDatasetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateExplanationDatasetOperationMetadata. */ + interface IUpdateExplanationDatasetOperationMetadata { + + /** UpdateExplanationDatasetOperationMetadata genericMetadata */ + genericMetadata?: (google.cloud.aiplatform.v1beta1.IGenericOperationMetadata|null); + } + + /** Represents an UpdateExplanationDatasetOperationMetadata. */ + class UpdateExplanationDatasetOperationMetadata implements IUpdateExplanationDatasetOperationMetadata { + + /** + * Constructs a new UpdateExplanationDatasetOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata); + + /** UpdateExplanationDatasetOperationMetadata genericMetadata. */ + public genericMetadata?: (google.cloud.aiplatform.v1beta1.IGenericOperationMetadata|null); + + /** + * Creates a new UpdateExplanationDatasetOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateExplanationDatasetOperationMetadata instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata; + + /** + * Encodes the specified UpdateExplanationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata.verify|verify} messages. + * @param message UpdateExplanationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateExplanationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata.verify|verify} messages. + * @param message UpdateExplanationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateExplanationDatasetOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateExplanationDatasetOperationMetadata + * @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.UpdateExplanationDatasetOperationMetadata; + + /** + * Decodes an UpdateExplanationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateExplanationDatasetOperationMetadata + * @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.UpdateExplanationDatasetOperationMetadata; + + /** + * Verifies an UpdateExplanationDatasetOperationMetadata 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 UpdateExplanationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateExplanationDatasetOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata; + + /** + * Creates a plain object from an UpdateExplanationDatasetOperationMetadata message. Also converts values to other types if specified. + * @param message UpdateExplanationDatasetOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateExplanationDatasetOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DeleteModelRequest. */ interface IDeleteModelRequest { @@ -104039,6 +104711,90 @@ export namespace google { } } + /** Properties of an UpdateExplanationDatasetResponse. */ + interface IUpdateExplanationDatasetResponse { + } + + /** Represents an UpdateExplanationDatasetResponse. */ + class UpdateExplanationDatasetResponse implements IUpdateExplanationDatasetResponse { + + /** + * Constructs a new UpdateExplanationDatasetResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse); + + /** + * Creates a new UpdateExplanationDatasetResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateExplanationDatasetResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + + /** + * Encodes the specified UpdateExplanationDatasetResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse.verify|verify} messages. + * @param message UpdateExplanationDatasetResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateExplanationDatasetResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse.verify|verify} messages. + * @param message UpdateExplanationDatasetResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateExplanationDatasetResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateExplanationDatasetResponse + * @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.UpdateExplanationDatasetResponse; + + /** + * Decodes an UpdateExplanationDatasetResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateExplanationDatasetResponse + * @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.UpdateExplanationDatasetResponse; + + /** + * Verifies an UpdateExplanationDatasetResponse 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 UpdateExplanationDatasetResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateExplanationDatasetResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse; + + /** + * Creates a plain object from an UpdateExplanationDatasetResponse message. Also converts values to other types if specified. + * @param message UpdateExplanationDatasetResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateExplanationDatasetResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an ExportModelResponse. */ interface IExportModelResponse { } diff --git a/protos/protos.js b/protos/protos.js index e2547c91..d293feb3 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -150708,6 +150708,7 @@ * @memberof google.cloud.aiplatform.v1beta1 * @interface IExplanation * @property {Array.|null} [attributions] Explanation attributions + * @property {Array.|null} [neighbors] Explanation neighbors */ /** @@ -150720,6 +150721,7 @@ */ function Explanation(properties) { this.attributions = []; + this.neighbors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -150734,6 +150736,14 @@ */ Explanation.prototype.attributions = $util.emptyArray; + /** + * Explanation neighbors. + * @member {Array.} neighbors + * @memberof google.cloud.aiplatform.v1beta1.Explanation + * @instance + */ + Explanation.prototype.neighbors = $util.emptyArray; + /** * Creates a new Explanation instance using the specified properties. * @function create @@ -150761,6 +150771,9 @@ if (message.attributions != null && message.attributions.length) for (var i = 0; i < message.attributions.length; ++i) $root.google.cloud.aiplatform.v1beta1.Attribution.encode(message.attributions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.neighbors != null && message.neighbors.length) + for (var i = 0; i < message.neighbors.length; ++i) + $root.google.cloud.aiplatform.v1beta1.Neighbor.encode(message.neighbors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -150800,6 +150813,11 @@ message.attributions = []; message.attributions.push($root.google.cloud.aiplatform.v1beta1.Attribution.decode(reader, reader.uint32())); break; + case 2: + if (!(message.neighbors && message.neighbors.length)) + message.neighbors = []; + message.neighbors.push($root.google.cloud.aiplatform.v1beta1.Neighbor.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -150844,6 +150862,15 @@ return "attributions." + error; } } + if (message.neighbors != null && message.hasOwnProperty("neighbors")) { + if (!Array.isArray(message.neighbors)) + return "neighbors: array expected"; + for (var i = 0; i < message.neighbors.length; ++i) { + var error = $root.google.cloud.aiplatform.v1beta1.Neighbor.verify(message.neighbors[i]); + if (error) + return "neighbors." + error; + } + } return null; }; @@ -150869,6 +150896,16 @@ message.attributions[i] = $root.google.cloud.aiplatform.v1beta1.Attribution.fromObject(object.attributions[i]); } } + if (object.neighbors) { + if (!Array.isArray(object.neighbors)) + throw TypeError(".google.cloud.aiplatform.v1beta1.Explanation.neighbors: array expected"); + message.neighbors = []; + for (var i = 0; i < object.neighbors.length; ++i) { + if (typeof object.neighbors[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.Explanation.neighbors: object expected"); + message.neighbors[i] = $root.google.cloud.aiplatform.v1beta1.Neighbor.fromObject(object.neighbors[i]); + } + } return message; }; @@ -150885,13 +150922,20 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.attributions = []; + object.neighbors = []; + } if (message.attributions && message.attributions.length) { object.attributions = []; for (var j = 0; j < message.attributions.length; ++j) object.attributions[j] = $root.google.cloud.aiplatform.v1beta1.Attribution.toObject(message.attributions[j], options); } + if (message.neighbors && message.neighbors.length) { + object.neighbors = []; + for (var j = 0; j < message.neighbors.length; ++j) + object.neighbors[j] = $root.google.cloud.aiplatform.v1beta1.Neighbor.toObject(message.neighbors[j], options); + } return object; }; @@ -151467,6 +151511,216 @@ return Attribution; })(); + v1beta1.Neighbor = (function() { + + /** + * Properties of a Neighbor. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface INeighbor + * @property {string|null} [neighborId] Neighbor neighborId + * @property {number|null} [neighborDistance] Neighbor neighborDistance + */ + + /** + * Constructs a new Neighbor. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a Neighbor. + * @implements INeighbor + * @constructor + * @param {google.cloud.aiplatform.v1beta1.INeighbor=} [properties] Properties to set + */ + function Neighbor(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]]; + } + + /** + * Neighbor neighborId. + * @member {string} neighborId + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @instance + */ + Neighbor.prototype.neighborId = ""; + + /** + * Neighbor neighborDistance. + * @member {number} neighborDistance + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @instance + */ + Neighbor.prototype.neighborDistance = 0; + + /** + * Creates a new Neighbor instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {google.cloud.aiplatform.v1beta1.INeighbor=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.Neighbor} Neighbor instance + */ + Neighbor.create = function create(properties) { + return new Neighbor(properties); + }; + + /** + * Encodes the specified Neighbor message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Neighbor.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {google.cloud.aiplatform.v1beta1.INeighbor} message Neighbor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Neighbor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.neighborId != null && Object.hasOwnProperty.call(message, "neighborId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.neighborId); + if (message.neighborDistance != null && Object.hasOwnProperty.call(message, "neighborDistance")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.neighborDistance); + return writer; + }; + + /** + * Encodes the specified Neighbor message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Neighbor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {google.cloud.aiplatform.v1beta1.INeighbor} message Neighbor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Neighbor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Neighbor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @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.Neighbor} Neighbor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Neighbor.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.Neighbor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.neighborId = reader.string(); + break; + case 2: + message.neighborDistance = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Neighbor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.Neighbor} Neighbor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Neighbor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Neighbor message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Neighbor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.neighborId != null && message.hasOwnProperty("neighborId")) + if (!$util.isString(message.neighborId)) + return "neighborId: string expected"; + if (message.neighborDistance != null && message.hasOwnProperty("neighborDistance")) + if (typeof message.neighborDistance !== "number") + return "neighborDistance: number expected"; + return null; + }; + + /** + * Creates a Neighbor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.Neighbor} Neighbor + */ + Neighbor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.Neighbor) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.Neighbor(); + if (object.neighborId != null) + message.neighborId = String(object.neighborId); + if (object.neighborDistance != null) + message.neighborDistance = Number(object.neighborDistance); + return message; + }; + + /** + * Creates a plain object from a Neighbor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @static + * @param {google.cloud.aiplatform.v1beta1.Neighbor} message Neighbor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Neighbor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.neighborId = ""; + object.neighborDistance = 0; + } + if (message.neighborId != null && message.hasOwnProperty("neighborId")) + object.neighborId = message.neighborId; + if (message.neighborDistance != null && message.hasOwnProperty("neighborDistance")) + object.neighborDistance = options.json && !isFinite(message.neighborDistance) ? String(message.neighborDistance) : message.neighborDistance; + return object; + }; + + /** + * Converts this Neighbor to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.Neighbor + * @instance + * @returns {Object.} JSON object + */ + Neighbor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Neighbor; + })(); + v1beta1.ExplanationSpec = (function() { /** @@ -153595,8 +153849,9 @@ * Properties of an Examples. * @memberof google.cloud.aiplatform.v1beta1 * @interface IExamples - * @property {google.cloud.aiplatform.v1beta1.IGcsSource|null} [gcsSource] Examples gcsSource * @property {google.protobuf.IValue|null} [nearestNeighborSearchConfig] Examples nearestNeighborSearchConfig + * @property {google.cloud.aiplatform.v1beta1.IPreset|null} [preset] Examples preset + * @property {google.cloud.aiplatform.v1beta1.IGcsSource|null} [gcsSource] Examples gcsSource * @property {number|null} [neighborCount] Examples neighborCount */ @@ -153616,20 +153871,28 @@ } /** - * Examples gcsSource. - * @member {google.cloud.aiplatform.v1beta1.IGcsSource|null|undefined} gcsSource + * Examples nearestNeighborSearchConfig. + * @member {google.protobuf.IValue|null|undefined} nearestNeighborSearchConfig * @memberof google.cloud.aiplatform.v1beta1.Examples * @instance */ - Examples.prototype.gcsSource = null; + Examples.prototype.nearestNeighborSearchConfig = null; /** - * Examples nearestNeighborSearchConfig. - * @member {google.protobuf.IValue|null|undefined} nearestNeighborSearchConfig + * Examples preset. + * @member {google.cloud.aiplatform.v1beta1.IPreset|null|undefined} preset * @memberof google.cloud.aiplatform.v1beta1.Examples * @instance */ - Examples.prototype.nearestNeighborSearchConfig = null; + Examples.prototype.preset = null; + + /** + * Examples gcsSource. + * @member {google.cloud.aiplatform.v1beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.aiplatform.v1beta1.Examples + * @instance + */ + Examples.prototype.gcsSource = null; /** * Examples neighborCount. @@ -153639,6 +153902,20 @@ */ Examples.prototype.neighborCount = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Examples config. + * @member {"nearestNeighborSearchConfig"|"preset"|undefined} config + * @memberof google.cloud.aiplatform.v1beta1.Examples + * @instance + */ + Object.defineProperty(Examples.prototype, "config", { + get: $util.oneOfGetter($oneOfFields = ["nearestNeighborSearchConfig", "preset"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new Examples instance using the specified properties. * @function create @@ -153669,6 +153946,8 @@ $root.google.protobuf.Value.encode(message.nearestNeighborSearchConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.neighborCount != null && Object.hasOwnProperty.call(message, "neighborCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.neighborCount); + if (message.preset != null && Object.hasOwnProperty.call(message, "preset")) + $root.google.cloud.aiplatform.v1beta1.Preset.encode(message.preset, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -153703,12 +153982,15 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsSource = $root.google.cloud.aiplatform.v1beta1.GcsSource.decode(reader, reader.uint32()); - break; case 2: message.nearestNeighborSearchConfig = $root.google.protobuf.Value.decode(reader, reader.uint32()); break; + case 4: + message.preset = $root.google.cloud.aiplatform.v1beta1.Preset.decode(reader, reader.uint32()); + break; + case 1: + message.gcsSource = $root.google.cloud.aiplatform.v1beta1.GcsSource.decode(reader, reader.uint32()); + break; case 3: message.neighborCount = reader.int32(); break; @@ -153747,16 +154029,30 @@ Examples.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; + if (message.nearestNeighborSearchConfig != null && message.hasOwnProperty("nearestNeighborSearchConfig")) { + properties.config = 1; + { + var error = $root.google.protobuf.Value.verify(message.nearestNeighborSearchConfig); + if (error) + return "nearestNeighborSearchConfig." + error; + } + } + if (message.preset != null && message.hasOwnProperty("preset")) { + if (properties.config === 1) + return "config: multiple values"; + properties.config = 1; + { + var error = $root.google.cloud.aiplatform.v1beta1.Preset.verify(message.preset); + if (error) + return "preset." + error; + } + } if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { var error = $root.google.cloud.aiplatform.v1beta1.GcsSource.verify(message.gcsSource); if (error) return "gcsSource." + error; } - if (message.nearestNeighborSearchConfig != null && message.hasOwnProperty("nearestNeighborSearchConfig")) { - var error = $root.google.protobuf.Value.verify(message.nearestNeighborSearchConfig); - if (error) - return "nearestNeighborSearchConfig." + error; - } if (message.neighborCount != null && message.hasOwnProperty("neighborCount")) if (!$util.isInteger(message.neighborCount)) return "neighborCount: integer expected"; @@ -153775,16 +154071,21 @@ if (object instanceof $root.google.cloud.aiplatform.v1beta1.Examples) return object; var message = new $root.google.cloud.aiplatform.v1beta1.Examples(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.aiplatform.v1beta1.Examples.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.aiplatform.v1beta1.GcsSource.fromObject(object.gcsSource); - } if (object.nearestNeighborSearchConfig != null) { if (typeof object.nearestNeighborSearchConfig !== "object") throw TypeError(".google.cloud.aiplatform.v1beta1.Examples.nearestNeighborSearchConfig: object expected"); message.nearestNeighborSearchConfig = $root.google.protobuf.Value.fromObject(object.nearestNeighborSearchConfig); } + if (object.preset != null) { + if (typeof object.preset !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.Examples.preset: object expected"); + message.preset = $root.google.cloud.aiplatform.v1beta1.Preset.fromObject(object.preset); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.Examples.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.aiplatform.v1beta1.GcsSource.fromObject(object.gcsSource); + } if (object.neighborCount != null) message.neighborCount = object.neighborCount | 0; return message; @@ -153805,15 +154106,22 @@ var object = {}; if (options.defaults) { object.gcsSource = null; - object.nearestNeighborSearchConfig = null; object.neighborCount = 0; } if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) object.gcsSource = $root.google.cloud.aiplatform.v1beta1.GcsSource.toObject(message.gcsSource, options); - if (message.nearestNeighborSearchConfig != null && message.hasOwnProperty("nearestNeighborSearchConfig")) + if (message.nearestNeighborSearchConfig != null && message.hasOwnProperty("nearestNeighborSearchConfig")) { object.nearestNeighborSearchConfig = $root.google.protobuf.Value.toObject(message.nearestNeighborSearchConfig, options); + if (options.oneofs) + object.config = "nearestNeighborSearchConfig"; + } if (message.neighborCount != null && message.hasOwnProperty("neighborCount")) object.neighborCount = message.neighborCount; + if (message.preset != null && message.hasOwnProperty("preset")) { + object.preset = $root.google.cloud.aiplatform.v1beta1.Preset.toObject(message.preset, options); + if (options.oneofs) + object.config = "preset"; + } return object; }; @@ -153831,6 +154139,302 @@ return Examples; })(); + v1beta1.Preset = (function() { + + /** + * Properties of a Preset. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IPreset + * @property {google.cloud.aiplatform.v1beta1.Preset.Query|null} [query] Preset query + * @property {google.cloud.aiplatform.v1beta1.Preset.Modality|null} [modality] Preset modality + */ + + /** + * Constructs a new Preset. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a Preset. + * @implements IPreset + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IPreset=} [properties] Properties to set + */ + function Preset(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]]; + } + + /** + * Preset query. + * @member {google.cloud.aiplatform.v1beta1.Preset.Query|null|undefined} query + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @instance + */ + Preset.prototype.query = null; + + /** + * Preset modality. + * @member {google.cloud.aiplatform.v1beta1.Preset.Modality} modality + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @instance + */ + Preset.prototype.modality = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Preset _query. + * @member {"query"|undefined} _query + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @instance + */ + Object.defineProperty(Preset.prototype, "_query", { + get: $util.oneOfGetter($oneOfFields = ["query"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Preset instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {google.cloud.aiplatform.v1beta1.IPreset=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.Preset} Preset instance + */ + Preset.create = function create(properties) { + return new Preset(properties); + }; + + /** + * Encodes the specified Preset message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Preset.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {google.cloud.aiplatform.v1beta1.IPreset} message Preset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Preset.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.query); + if (message.modality != null && Object.hasOwnProperty.call(message, "modality")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.modality); + return writer; + }; + + /** + * Encodes the specified Preset message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.Preset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {google.cloud.aiplatform.v1beta1.IPreset} message Preset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Preset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Preset message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @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.Preset} Preset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Preset.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.Preset(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.query = reader.int32(); + break; + case 2: + message.modality = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Preset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.Preset} Preset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Preset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Preset message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Preset.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.query != null && message.hasOwnProperty("query")) { + properties._query = 1; + switch (message.query) { + default: + return "query: enum value expected"; + case 0: + case 1: + break; + } + } + if (message.modality != null && message.hasOwnProperty("modality")) + switch (message.modality) { + default: + return "modality: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Preset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.Preset} Preset + */ + Preset.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.Preset) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.Preset(); + switch (object.query) { + case "PRECISE": + case 0: + message.query = 0; + break; + case "FAST": + case 1: + message.query = 1; + break; + } + switch (object.modality) { + case "MODALITY_UNSPECIFIED": + case 0: + message.modality = 0; + break; + case "IMAGE": + case 1: + message.modality = 1; + break; + case "TEXT": + case 2: + message.modality = 2; + break; + case "TABULAR": + case 3: + message.modality = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Preset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @static + * @param {google.cloud.aiplatform.v1beta1.Preset} message Preset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Preset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.modality = options.enums === String ? "MODALITY_UNSPECIFIED" : 0; + if (message.query != null && message.hasOwnProperty("query")) { + object.query = options.enums === String ? $root.google.cloud.aiplatform.v1beta1.Preset.Query[message.query] : message.query; + if (options.oneofs) + object._query = "query"; + } + if (message.modality != null && message.hasOwnProperty("modality")) + object.modality = options.enums === String ? $root.google.cloud.aiplatform.v1beta1.Preset.Modality[message.modality] : message.modality; + return object; + }; + + /** + * Converts this Preset to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.Preset + * @instance + * @returns {Object.} JSON object + */ + Preset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Query enum. + * @name google.cloud.aiplatform.v1beta1.Preset.Query + * @enum {number} + * @property {number} PRECISE=0 PRECISE value + * @property {number} FAST=1 FAST value + */ + Preset.Query = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PRECISE"] = 0; + values[valuesById[1] = "FAST"] = 1; + return values; + })(); + + /** + * Modality enum. + * @name google.cloud.aiplatform.v1beta1.Preset.Modality + * @enum {number} + * @property {number} MODALITY_UNSPECIFIED=0 MODALITY_UNSPECIFIED value + * @property {number} IMAGE=1 IMAGE value + * @property {number} TEXT=2 TEXT value + * @property {number} TABULAR=3 TABULAR value + */ + Preset.Modality = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODALITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IMAGE"] = 1; + values[valuesById[2] = "TEXT"] = 2; + values[valuesById[3] = "TABULAR"] = 3; + return values; + })(); + + return Preset; + })(); + v1beta1.ExplanationSpecOverride = (function() { /** @@ -153839,6 +154443,7 @@ * @interface IExplanationSpecOverride * @property {google.cloud.aiplatform.v1beta1.IExplanationParameters|null} [parameters] ExplanationSpecOverride parameters * @property {google.cloud.aiplatform.v1beta1.IExplanationMetadataOverride|null} [metadata] ExplanationSpecOverride metadata + * @property {google.cloud.aiplatform.v1beta1.IExamplesOverride|null} [examplesOverride] ExplanationSpecOverride examplesOverride */ /** @@ -153872,6 +154477,14 @@ */ ExplanationSpecOverride.prototype.metadata = null; + /** + * ExplanationSpecOverride examplesOverride. + * @member {google.cloud.aiplatform.v1beta1.IExamplesOverride|null|undefined} examplesOverride + * @memberof google.cloud.aiplatform.v1beta1.ExplanationSpecOverride + * @instance + */ + ExplanationSpecOverride.prototype.examplesOverride = null; + /** * Creates a new ExplanationSpecOverride instance using the specified properties. * @function create @@ -153900,6 +154513,8 @@ $root.google.cloud.aiplatform.v1beta1.ExplanationParameters.encode(message.parameters, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) $root.google.cloud.aiplatform.v1beta1.ExplanationMetadataOverride.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.examplesOverride != null && Object.hasOwnProperty.call(message, "examplesOverride")) + $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.encode(message.examplesOverride, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -153940,6 +154555,9 @@ case 2: message.metadata = $root.google.cloud.aiplatform.v1beta1.ExplanationMetadataOverride.decode(reader, reader.uint32()); break; + case 3: + message.examplesOverride = $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -153985,6 +154603,11 @@ if (error) return "metadata." + error; } + if (message.examplesOverride != null && message.hasOwnProperty("examplesOverride")) { + var error = $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.verify(message.examplesOverride); + if (error) + return "examplesOverride." + error; + } return null; }; @@ -154010,6 +154633,11 @@ throw TypeError(".google.cloud.aiplatform.v1beta1.ExplanationSpecOverride.metadata: object expected"); message.metadata = $root.google.cloud.aiplatform.v1beta1.ExplanationMetadataOverride.fromObject(object.metadata); } + if (object.examplesOverride != null) { + if (typeof object.examplesOverride !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.ExplanationSpecOverride.examplesOverride: object expected"); + message.examplesOverride = $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.fromObject(object.examplesOverride); + } return message; }; @@ -154029,11 +154657,14 @@ if (options.defaults) { object.parameters = null; object.metadata = null; + object.examplesOverride = null; } if (message.parameters != null && message.hasOwnProperty("parameters")) object.parameters = $root.google.cloud.aiplatform.v1beta1.ExplanationParameters.toObject(message.parameters, options); if (message.metadata != null && message.hasOwnProperty("metadata")) object.metadata = $root.google.cloud.aiplatform.v1beta1.ExplanationMetadataOverride.toObject(message.metadata, options); + if (message.examplesOverride != null && message.hasOwnProperty("examplesOverride")) + object.examplesOverride = $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.toObject(message.examplesOverride, options); return object; }; @@ -154488,6 +155119,603 @@ return ExplanationMetadataOverride; })(); + v1beta1.ExamplesOverride = (function() { + + /** + * Properties of an ExamplesOverride. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IExamplesOverride + * @property {number|null} [neighborCount] ExamplesOverride neighborCount + * @property {number|null} [crowdingCount] ExamplesOverride crowdingCount + * @property {Array.|null} [restrictions] ExamplesOverride restrictions + * @property {boolean|null} [returnEmbeddings] ExamplesOverride returnEmbeddings + * @property {google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat|null} [dataFormat] ExamplesOverride dataFormat + */ + + /** + * Constructs a new ExamplesOverride. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an ExamplesOverride. + * @implements IExamplesOverride + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IExamplesOverride=} [properties] Properties to set + */ + function ExamplesOverride(properties) { + this.restrictions = []; + 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]]; + } + + /** + * ExamplesOverride neighborCount. + * @member {number} neighborCount + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + */ + ExamplesOverride.prototype.neighborCount = 0; + + /** + * ExamplesOverride crowdingCount. + * @member {number} crowdingCount + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + */ + ExamplesOverride.prototype.crowdingCount = 0; + + /** + * ExamplesOverride restrictions. + * @member {Array.} restrictions + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + */ + ExamplesOverride.prototype.restrictions = $util.emptyArray; + + /** + * ExamplesOverride returnEmbeddings. + * @member {boolean} returnEmbeddings + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + */ + ExamplesOverride.prototype.returnEmbeddings = false; + + /** + * ExamplesOverride dataFormat. + * @member {google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat} dataFormat + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + */ + ExamplesOverride.prototype.dataFormat = 0; + + /** + * Creates a new ExamplesOverride instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesOverride=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.ExamplesOverride} ExamplesOverride instance + */ + ExamplesOverride.create = function create(properties) { + return new ExamplesOverride(properties); + }; + + /** + * Encodes the specified ExamplesOverride message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesOverride.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesOverride} message ExamplesOverride message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExamplesOverride.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.neighborCount != null && Object.hasOwnProperty.call(message, "neighborCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.neighborCount); + if (message.crowdingCount != null && Object.hasOwnProperty.call(message, "crowdingCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.crowdingCount); + if (message.restrictions != null && message.restrictions.length) + for (var i = 0; i < message.restrictions.length; ++i) + $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.encode(message.restrictions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.returnEmbeddings != null && Object.hasOwnProperty.call(message, "returnEmbeddings")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.returnEmbeddings); + if (message.dataFormat != null && Object.hasOwnProperty.call(message, "dataFormat")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.dataFormat); + return writer; + }; + + /** + * Encodes the specified ExamplesOverride message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesOverride.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesOverride} message ExamplesOverride message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExamplesOverride.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExamplesOverride message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @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.ExamplesOverride} ExamplesOverride + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExamplesOverride.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.ExamplesOverride(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.neighborCount = reader.int32(); + break; + case 2: + message.crowdingCount = reader.int32(); + break; + case 3: + if (!(message.restrictions && message.restrictions.length)) + message.restrictions = []; + message.restrictions.push($root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.decode(reader, reader.uint32())); + break; + case 4: + message.returnEmbeddings = reader.bool(); + break; + case 5: + message.dataFormat = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExamplesOverride message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.ExamplesOverride} ExamplesOverride + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExamplesOverride.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExamplesOverride message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExamplesOverride.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.neighborCount != null && message.hasOwnProperty("neighborCount")) + if (!$util.isInteger(message.neighborCount)) + return "neighborCount: integer expected"; + if (message.crowdingCount != null && message.hasOwnProperty("crowdingCount")) + if (!$util.isInteger(message.crowdingCount)) + return "crowdingCount: integer expected"; + if (message.restrictions != null && message.hasOwnProperty("restrictions")) { + if (!Array.isArray(message.restrictions)) + return "restrictions: array expected"; + for (var i = 0; i < message.restrictions.length; ++i) { + var error = $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.verify(message.restrictions[i]); + if (error) + return "restrictions." + error; + } + } + if (message.returnEmbeddings != null && message.hasOwnProperty("returnEmbeddings")) + if (typeof message.returnEmbeddings !== "boolean") + return "returnEmbeddings: boolean expected"; + if (message.dataFormat != null && message.hasOwnProperty("dataFormat")) + switch (message.dataFormat) { + default: + return "dataFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an ExamplesOverride message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.ExamplesOverride} ExamplesOverride + */ + ExamplesOverride.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.ExamplesOverride) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.ExamplesOverride(); + if (object.neighborCount != null) + message.neighborCount = object.neighborCount | 0; + if (object.crowdingCount != null) + message.crowdingCount = object.crowdingCount | 0; + if (object.restrictions) { + if (!Array.isArray(object.restrictions)) + throw TypeError(".google.cloud.aiplatform.v1beta1.ExamplesOverride.restrictions: array expected"); + message.restrictions = []; + for (var i = 0; i < object.restrictions.length; ++i) { + if (typeof object.restrictions[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.ExamplesOverride.restrictions: object expected"); + message.restrictions[i] = $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.fromObject(object.restrictions[i]); + } + } + if (object.returnEmbeddings != null) + message.returnEmbeddings = Boolean(object.returnEmbeddings); + switch (object.dataFormat) { + case "DATA_FORMAT_UNSPECIFIED": + case 0: + message.dataFormat = 0; + break; + case "INSTANCES": + case 1: + message.dataFormat = 1; + break; + case "EMBEDDINGS": + case 2: + message.dataFormat = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an ExamplesOverride message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @static + * @param {google.cloud.aiplatform.v1beta1.ExamplesOverride} message ExamplesOverride + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExamplesOverride.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.restrictions = []; + if (options.defaults) { + object.neighborCount = 0; + object.crowdingCount = 0; + object.returnEmbeddings = false; + object.dataFormat = options.enums === String ? "DATA_FORMAT_UNSPECIFIED" : 0; + } + if (message.neighborCount != null && message.hasOwnProperty("neighborCount")) + object.neighborCount = message.neighborCount; + if (message.crowdingCount != null && message.hasOwnProperty("crowdingCount")) + object.crowdingCount = message.crowdingCount; + if (message.restrictions && message.restrictions.length) { + object.restrictions = []; + for (var j = 0; j < message.restrictions.length; ++j) + object.restrictions[j] = $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.toObject(message.restrictions[j], options); + } + if (message.returnEmbeddings != null && message.hasOwnProperty("returnEmbeddings")) + object.returnEmbeddings = message.returnEmbeddings; + if (message.dataFormat != null && message.hasOwnProperty("dataFormat")) + object.dataFormat = options.enums === String ? $root.google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat[message.dataFormat] : message.dataFormat; + return object; + }; + + /** + * Converts this ExamplesOverride to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.ExamplesOverride + * @instance + * @returns {Object.} JSON object + */ + ExamplesOverride.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * DataFormat enum. + * @name google.cloud.aiplatform.v1beta1.ExamplesOverride.DataFormat + * @enum {number} + * @property {number} DATA_FORMAT_UNSPECIFIED=0 DATA_FORMAT_UNSPECIFIED value + * @property {number} INSTANCES=1 INSTANCES value + * @property {number} EMBEDDINGS=2 EMBEDDINGS value + */ + ExamplesOverride.DataFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCES"] = 1; + values[valuesById[2] = "EMBEDDINGS"] = 2; + return values; + })(); + + return ExamplesOverride; + })(); + + v1beta1.ExamplesRestrictionsNamespace = (function() { + + /** + * Properties of an ExamplesRestrictionsNamespace. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IExamplesRestrictionsNamespace + * @property {string|null} [namespaceName] ExamplesRestrictionsNamespace namespaceName + * @property {Array.|null} [allow] ExamplesRestrictionsNamespace allow + * @property {Array.|null} [deny] ExamplesRestrictionsNamespace deny + */ + + /** + * Constructs a new ExamplesRestrictionsNamespace. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an ExamplesRestrictionsNamespace. + * @implements IExamplesRestrictionsNamespace + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace=} [properties] Properties to set + */ + function ExamplesRestrictionsNamespace(properties) { + this.allow = []; + this.deny = []; + 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]]; + } + + /** + * ExamplesRestrictionsNamespace namespaceName. + * @member {string} namespaceName + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @instance + */ + ExamplesRestrictionsNamespace.prototype.namespaceName = ""; + + /** + * ExamplesRestrictionsNamespace allow. + * @member {Array.} allow + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @instance + */ + ExamplesRestrictionsNamespace.prototype.allow = $util.emptyArray; + + /** + * ExamplesRestrictionsNamespace deny. + * @member {Array.} deny + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @instance + */ + ExamplesRestrictionsNamespace.prototype.deny = $util.emptyArray; + + /** + * Creates a new ExamplesRestrictionsNamespace instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace} ExamplesRestrictionsNamespace instance + */ + ExamplesRestrictionsNamespace.create = function create(properties) { + return new ExamplesRestrictionsNamespace(properties); + }; + + /** + * Encodes the specified ExamplesRestrictionsNamespace message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace} message ExamplesRestrictionsNamespace message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExamplesRestrictionsNamespace.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.namespaceName != null && Object.hasOwnProperty.call(message, "namespaceName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namespaceName); + if (message.allow != null && message.allow.length) + for (var i = 0; i < message.allow.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.allow[i]); + if (message.deny != null && message.deny.length) + for (var i = 0; i < message.deny.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deny[i]); + return writer; + }; + + /** + * Encodes the specified ExamplesRestrictionsNamespace message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {google.cloud.aiplatform.v1beta1.IExamplesRestrictionsNamespace} message ExamplesRestrictionsNamespace message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExamplesRestrictionsNamespace.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExamplesRestrictionsNamespace message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @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.ExamplesRestrictionsNamespace} ExamplesRestrictionsNamespace + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExamplesRestrictionsNamespace.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.ExamplesRestrictionsNamespace(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namespaceName = reader.string(); + break; + case 2: + if (!(message.allow && message.allow.length)) + message.allow = []; + message.allow.push(reader.string()); + break; + case 3: + if (!(message.deny && message.deny.length)) + message.deny = []; + message.deny.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExamplesRestrictionsNamespace message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace} ExamplesRestrictionsNamespace + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExamplesRestrictionsNamespace.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExamplesRestrictionsNamespace message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExamplesRestrictionsNamespace.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.namespaceName != null && message.hasOwnProperty("namespaceName")) + if (!$util.isString(message.namespaceName)) + return "namespaceName: string expected"; + if (message.allow != null && message.hasOwnProperty("allow")) { + if (!Array.isArray(message.allow)) + return "allow: array expected"; + for (var i = 0; i < message.allow.length; ++i) + if (!$util.isString(message.allow[i])) + return "allow: string[] expected"; + } + if (message.deny != null && message.hasOwnProperty("deny")) { + if (!Array.isArray(message.deny)) + return "deny: array expected"; + for (var i = 0; i < message.deny.length; ++i) + if (!$util.isString(message.deny[i])) + return "deny: string[] expected"; + } + return null; + }; + + /** + * Creates an ExamplesRestrictionsNamespace message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace} ExamplesRestrictionsNamespace + */ + ExamplesRestrictionsNamespace.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace(); + if (object.namespaceName != null) + message.namespaceName = String(object.namespaceName); + if (object.allow) { + if (!Array.isArray(object.allow)) + throw TypeError(".google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.allow: array expected"); + message.allow = []; + for (var i = 0; i < object.allow.length; ++i) + message.allow[i] = String(object.allow[i]); + } + if (object.deny) { + if (!Array.isArray(object.deny)) + throw TypeError(".google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace.deny: array expected"); + message.deny = []; + for (var i = 0; i < object.deny.length; ++i) + message.deny[i] = String(object.deny[i]); + } + return message; + }; + + /** + * Creates a plain object from an ExamplesRestrictionsNamespace message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @static + * @param {google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace} message ExamplesRestrictionsNamespace + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExamplesRestrictionsNamespace.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.allow = []; + object.deny = []; + } + if (options.defaults) + object.namespaceName = ""; + if (message.namespaceName != null && message.hasOwnProperty("namespaceName")) + object.namespaceName = message.namespaceName; + if (message.allow && message.allow.length) { + object.allow = []; + for (var j = 0; j < message.allow.length; ++j) + object.allow[j] = message.allow[j]; + } + if (message.deny && message.deny.length) { + object.deny = []; + for (var j = 0; j < message.deny.length; ++j) + object.deny[j] = message.deny[j]; + } + return object; + }; + + /** + * Converts this ExamplesRestrictionsNamespace to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.ExamplesRestrictionsNamespace + * @instance + * @returns {Object.} JSON object + */ + ExamplesRestrictionsNamespace.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExamplesRestrictionsNamespace; + })(); + v1beta1.ExplanationMetadata = (function() { /** @@ -154497,6 +155725,7 @@ * @property {Object.|null} [inputs] ExplanationMetadata inputs * @property {Object.|null} [outputs] ExplanationMetadata outputs * @property {string|null} [featureAttributionsSchemaUri] ExplanationMetadata featureAttributionsSchemaUri + * @property {string|null} [latentSpaceSource] ExplanationMetadata latentSpaceSource */ /** @@ -154540,6 +155769,14 @@ */ ExplanationMetadata.prototype.featureAttributionsSchemaUri = ""; + /** + * ExplanationMetadata latentSpaceSource. + * @member {string} latentSpaceSource + * @memberof google.cloud.aiplatform.v1beta1.ExplanationMetadata + * @instance + */ + ExplanationMetadata.prototype.latentSpaceSource = ""; + /** * Creates a new ExplanationMetadata instance using the specified properties. * @function create @@ -154576,6 +155813,8 @@ } if (message.featureAttributionsSchemaUri != null && Object.hasOwnProperty.call(message, "featureAttributionsSchemaUri")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.featureAttributionsSchemaUri); + if (message.latentSpaceSource != null && Object.hasOwnProperty.call(message, "latentSpaceSource")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.latentSpaceSource); return writer; }; @@ -154657,6 +155896,9 @@ case 3: message.featureAttributionsSchemaUri = reader.string(); break; + case 5: + message.latentSpaceSource = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -154715,6 +155957,9 @@ if (message.featureAttributionsSchemaUri != null && message.hasOwnProperty("featureAttributionsSchemaUri")) if (!$util.isString(message.featureAttributionsSchemaUri)) return "featureAttributionsSchemaUri: string expected"; + if (message.latentSpaceSource != null && message.hasOwnProperty("latentSpaceSource")) + if (!$util.isString(message.latentSpaceSource)) + return "latentSpaceSource: string expected"; return null; }; @@ -154752,6 +155997,8 @@ } if (object.featureAttributionsSchemaUri != null) message.featureAttributionsSchemaUri = String(object.featureAttributionsSchemaUri); + if (object.latentSpaceSource != null) + message.latentSpaceSource = String(object.latentSpaceSource); return message; }; @@ -154772,8 +156019,10 @@ object.inputs = {}; object.outputs = {}; } - if (options.defaults) + if (options.defaults) { object.featureAttributionsSchemaUri = ""; + object.latentSpaceSource = ""; + } var keys2; if (message.inputs && (keys2 = Object.keys(message.inputs)).length) { object.inputs = {}; @@ -154787,6 +156036,8 @@ } if (message.featureAttributionsSchemaUri != null && message.hasOwnProperty("featureAttributionsSchemaUri")) object.featureAttributionsSchemaUri = message.featureAttributionsSchemaUri; + if (message.latentSpaceSource != null && message.hasOwnProperty("latentSpaceSource")) + object.latentSpaceSource = message.latentSpaceSource; return object; }; @@ -244698,6 +245949,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#updateExplanationDataset}. + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @typedef UpdateExplanationDatasetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateExplanationDataset. + * @function updateExplanationDataset + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest} request UpdateExplanationDatasetRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDatasetCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.updateExplanationDataset = function updateExplanationDataset(request, callback) { + return this.rpcCall(updateExplanationDataset, $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateExplanationDataset" }); + + /** + * Calls UpdateExplanationDataset. + * @function updateExplanationDataset + * @memberof google.cloud.aiplatform.v1beta1.ModelService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest} request UpdateExplanationDatasetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.ModelService#deleteModel}. * @memberof google.cloud.aiplatform.v1beta1.ModelService @@ -247090,6 +248374,413 @@ return UpdateModelRequest; })(); + v1beta1.UpdateExplanationDatasetRequest = (function() { + + /** + * Properties of an UpdateExplanationDatasetRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IUpdateExplanationDatasetRequest + * @property {string|null} [model] UpdateExplanationDatasetRequest model + * @property {google.cloud.aiplatform.v1beta1.IExamples|null} [examples] UpdateExplanationDatasetRequest examples + */ + + /** + * Constructs a new UpdateExplanationDatasetRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an UpdateExplanationDatasetRequest. + * @implements IUpdateExplanationDatasetRequest + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest=} [properties] Properties to set + */ + function UpdateExplanationDatasetRequest(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]]; + } + + /** + * UpdateExplanationDatasetRequest model. + * @member {string} model + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @instance + */ + UpdateExplanationDatasetRequest.prototype.model = ""; + + /** + * UpdateExplanationDatasetRequest examples. + * @member {google.cloud.aiplatform.v1beta1.IExamples|null|undefined} examples + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @instance + */ + UpdateExplanationDatasetRequest.prototype.examples = null; + + /** + * Creates a new UpdateExplanationDatasetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest} UpdateExplanationDatasetRequest instance + */ + UpdateExplanationDatasetRequest.create = function create(properties) { + return new UpdateExplanationDatasetRequest(properties); + }; + + /** + * Encodes the specified UpdateExplanationDatasetRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest} message UpdateExplanationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + if (message.examples != null && Object.hasOwnProperty.call(message, "examples")) + $root.google.cloud.aiplatform.v1beta1.Examples.encode(message.examples, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateExplanationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest} message UpdateExplanationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateExplanationDatasetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @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.UpdateExplanationDatasetRequest} UpdateExplanationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetRequest.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.UpdateExplanationDatasetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.model = reader.string(); + break; + case 2: + message.examples = $root.google.cloud.aiplatform.v1beta1.Examples.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateExplanationDatasetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest} UpdateExplanationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateExplanationDatasetRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateExplanationDatasetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.examples != null && message.hasOwnProperty("examples")) { + var error = $root.google.cloud.aiplatform.v1beta1.Examples.verify(message.examples); + if (error) + return "examples." + error; + } + return null; + }; + + /** + * Creates an UpdateExplanationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest} UpdateExplanationDatasetRequest + */ + UpdateExplanationDatasetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest(); + if (object.model != null) + message.model = String(object.model); + if (object.examples != null) { + if (typeof object.examples !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest.examples: object expected"); + message.examples = $root.google.cloud.aiplatform.v1beta1.Examples.fromObject(object.examples); + } + return message; + }; + + /** + * Creates a plain object from an UpdateExplanationDatasetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest} message UpdateExplanationDatasetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateExplanationDatasetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.model = ""; + object.examples = null; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.examples != null && message.hasOwnProperty("examples")) + object.examples = $root.google.cloud.aiplatform.v1beta1.Examples.toObject(message.examples, options); + return object; + }; + + /** + * Converts this UpdateExplanationDatasetRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateExplanationDatasetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateExplanationDatasetRequest; + })(); + + v1beta1.UpdateExplanationDatasetOperationMetadata = (function() { + + /** + * Properties of an UpdateExplanationDatasetOperationMetadata. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IUpdateExplanationDatasetOperationMetadata + * @property {google.cloud.aiplatform.v1beta1.IGenericOperationMetadata|null} [genericMetadata] UpdateExplanationDatasetOperationMetadata genericMetadata + */ + + /** + * Constructs a new UpdateExplanationDatasetOperationMetadata. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an UpdateExplanationDatasetOperationMetadata. + * @implements IUpdateExplanationDatasetOperationMetadata + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata=} [properties] Properties to set + */ + function UpdateExplanationDatasetOperationMetadata(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]]; + } + + /** + * UpdateExplanationDatasetOperationMetadata genericMetadata. + * @member {google.cloud.aiplatform.v1beta1.IGenericOperationMetadata|null|undefined} genericMetadata + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @instance + */ + UpdateExplanationDatasetOperationMetadata.prototype.genericMetadata = null; + + /** + * Creates a new UpdateExplanationDatasetOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata} UpdateExplanationDatasetOperationMetadata instance + */ + UpdateExplanationDatasetOperationMetadata.create = function create(properties) { + return new UpdateExplanationDatasetOperationMetadata(properties); + }; + + /** + * Encodes the specified UpdateExplanationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata} message UpdateExplanationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.genericMetadata != null && Object.hasOwnProperty.call(message, "genericMetadata")) + $root.google.cloud.aiplatform.v1beta1.GenericOperationMetadata.encode(message.genericMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateExplanationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata} message UpdateExplanationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateExplanationDatasetOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @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.UpdateExplanationDatasetOperationMetadata} UpdateExplanationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetOperationMetadata.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.UpdateExplanationDatasetOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.genericMetadata = $root.google.cloud.aiplatform.v1beta1.GenericOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateExplanationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata} UpdateExplanationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateExplanationDatasetOperationMetadata message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateExplanationDatasetOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.genericMetadata != null && message.hasOwnProperty("genericMetadata")) { + var error = $root.google.cloud.aiplatform.v1beta1.GenericOperationMetadata.verify(message.genericMetadata); + if (error) + return "genericMetadata." + error; + } + return null; + }; + + /** + * Creates an UpdateExplanationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata} UpdateExplanationDatasetOperationMetadata + */ + UpdateExplanationDatasetOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata(); + if (object.genericMetadata != null) { + if (typeof object.genericMetadata !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata.genericMetadata: object expected"); + message.genericMetadata = $root.google.cloud.aiplatform.v1beta1.GenericOperationMetadata.fromObject(object.genericMetadata); + } + return message; + }; + + /** + * Creates a plain object from an UpdateExplanationDatasetOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @static + * @param {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata} message UpdateExplanationDatasetOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateExplanationDatasetOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.genericMetadata = null; + if (message.genericMetadata != null && message.hasOwnProperty("genericMetadata")) + object.genericMetadata = $root.google.cloud.aiplatform.v1beta1.GenericOperationMetadata.toObject(message.genericMetadata, options); + return object; + }; + + /** + * Converts this UpdateExplanationDatasetOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + UpdateExplanationDatasetOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateExplanationDatasetOperationMetadata; + })(); + v1beta1.DeleteModelRequest = (function() { /** @@ -248577,6 +250268,166 @@ return ExportModelOperationMetadata; })(); + v1beta1.UpdateExplanationDatasetResponse = (function() { + + /** + * Properties of an UpdateExplanationDatasetResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IUpdateExplanationDatasetResponse + */ + + /** + * Constructs a new UpdateExplanationDatasetResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents an UpdateExplanationDatasetResponse. + * @implements IUpdateExplanationDatasetResponse + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse=} [properties] Properties to set + */ + function UpdateExplanationDatasetResponse(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]]; + } + + /** + * Creates a new UpdateExplanationDatasetResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse} UpdateExplanationDatasetResponse instance + */ + UpdateExplanationDatasetResponse.create = function create(properties) { + return new UpdateExplanationDatasetResponse(properties); + }; + + /** + * Encodes the specified UpdateExplanationDatasetResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse} message UpdateExplanationDatasetResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified UpdateExplanationDatasetResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse} message UpdateExplanationDatasetResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExplanationDatasetResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateExplanationDatasetResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @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.UpdateExplanationDatasetResponse} UpdateExplanationDatasetResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetResponse.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.UpdateExplanationDatasetResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateExplanationDatasetResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse} UpdateExplanationDatasetResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExplanationDatasetResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateExplanationDatasetResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateExplanationDatasetResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UpdateExplanationDatasetResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse} UpdateExplanationDatasetResponse + */ + UpdateExplanationDatasetResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse) + return object; + return new $root.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse(); + }; + + /** + * Creates a plain object from an UpdateExplanationDatasetResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse} message UpdateExplanationDatasetResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateExplanationDatasetResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UpdateExplanationDatasetResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse + * @instance + * @returns {Object.} JSON object + */ + UpdateExplanationDatasetResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateExplanationDatasetResponse; + })(); + v1beta1.ExportModelResponse = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 39e746d7..8fb1a4fc 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -17144,6 +17144,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "neighbors": { + "rule": "repeated", + "type": "Neighbor", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, @@ -17213,6 +17221,24 @@ } } }, + "Neighbor": { + "fields": { + "neighborId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "neighborDistance": { + "type": "double", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "ExplanationSpec": { "fields": { "parameters": { @@ -17374,21 +17400,71 @@ } }, "Examples": { + "oneofs": { + "config": { + "oneof": [ + "nearestNeighborSearchConfig", + "preset" + ] + } + }, "fields": { - "gcsSource": { - "type": "GcsSource", - "id": 1 - }, "nearestNeighborSearchConfig": { "type": "google.protobuf.Value", "id": 2 }, + "preset": { + "type": "Preset", + "id": 4 + }, + "gcsSource": { + "type": "GcsSource", + "id": 1 + }, "neighborCount": { "type": "int32", "id": 3 } } }, + "Preset": { + "oneofs": { + "_query": { + "oneof": [ + "query" + ] + } + }, + "fields": { + "query": { + "type": "Query", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "modality": { + "type": "Modality", + "id": 2 + } + }, + "nested": { + "Query": { + "values": { + "PRECISE": 0, + "FAST": 1 + } + }, + "Modality": { + "values": { + "MODALITY_UNSPECIFIED": 0, + "IMAGE": 1, + "TEXT": 2, + "TABULAR": 3 + } + } + } + }, "ExplanationSpecOverride": { "fields": { "parameters": { @@ -17398,6 +17474,10 @@ "metadata": { "type": "ExplanationMetadataOverride", "id": 2 + }, + "examplesOverride": { + "type": "ExamplesOverride", + "id": 3 } } }, @@ -17424,6 +17504,58 @@ } } }, + "ExamplesOverride": { + "fields": { + "neighborCount": { + "type": "int32", + "id": 1 + }, + "crowdingCount": { + "type": "int32", + "id": 2 + }, + "restrictions": { + "rule": "repeated", + "type": "ExamplesRestrictionsNamespace", + "id": 3 + }, + "returnEmbeddings": { + "type": "bool", + "id": 4 + }, + "dataFormat": { + "type": "DataFormat", + "id": 5 + } + }, + "nested": { + "DataFormat": { + "values": { + "DATA_FORMAT_UNSPECIFIED": 0, + "INSTANCES": 1, + "EMBEDDINGS": 2 + } + } + } + }, + "ExamplesRestrictionsNamespace": { + "fields": { + "namespaceName": { + "type": "string", + "id": 1 + }, + "allow": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "deny": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, "ExplanationMetadata": { "fields": { "inputs": { @@ -17445,6 +17577,10 @@ "featureAttributionsSchemaUri": { "type": "string", "id": 3 + }, + "latentSpaceSource": { + "type": "string", + "id": 5 } }, "nested": { @@ -27973,6 +28109,34 @@ } ] }, + "UpdateExplanationDataset": { + "requestType": "UpdateExplanationDatasetRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta1/{model=projects/*/locations/*/models/*}:updateExplanationDataset", + "(google.api.http).body": "*", + "(google.api.method_signature)": "model", + "(google.longrunning.operation_info).response_type": "UpdateExplanationDatasetResponse", + "(google.longrunning.operation_info).metadata_type": "UpdateExplanationDatasetOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{model=projects/*/locations/*/models/*}:updateExplanationDataset", + "body": "*" + } + }, + { + "(google.api.method_signature)": "model" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "UpdateExplanationDatasetResponse", + "metadata_type": "UpdateExplanationDatasetOperationMetadata" + } + } + ] + }, "DeleteModel": { "requestType": "DeleteModelRequest", "responseType": "google.longrunning.Operation", @@ -28338,6 +28502,30 @@ } } }, + "UpdateExplanationDatasetRequest": { + "fields": { + "model": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Model" + } + }, + "examples": { + "type": "Examples", + "id": 2 + } + } + }, + "UpdateExplanationDatasetOperationMetadata": { + "fields": { + "genericMetadata": { + "type": "GenericOperationMetadata", + "id": 1 + } + } + }, "DeleteModelRequest": { "fields": { "name": { @@ -28454,6 +28642,9 @@ } } }, + "UpdateExplanationDatasetResponse": { + "fields": {} + }, "ExportModelResponse": { "fields": {} }, diff --git a/samples/generated/v1beta1/model_service.export_model.js b/samples/generated/v1beta1/model_service.export_model.js index 470c5b25..01f38fdc 100644 --- a/samples/generated/v1beta1/model_service.export_model.js +++ b/samples/generated/v1beta1/model_service.export_model.js @@ -27,6 +27,8 @@ function main(name, outputConfig) { */ /** * Required. The resource name of the Model to export. + * The resource name may contain version id or version alias to specify the + * version, if no version is specified, the default version will be exported. */ // const name = 'abc123' /** diff --git a/samples/generated/v1beta1/model_service.get_model.js b/samples/generated/v1beta1/model_service.get_model.js index 8841f719..e9c2de6e 100644 --- a/samples/generated/v1beta1/model_service.get_model.js +++ b/samples/generated/v1beta1/model_service.get_model.js @@ -28,6 +28,15 @@ function main(name) { /** * Required. The name of the Model resource. * Format: `projects/{project}/locations/{location}/models/{model}` + * In order to retrieve a specific version of the model, also provide + * the version ID or version alias. + * Example: projects/{project}/locations/{location}/models/{model}@2 + * or + * projects/{project}/locations/{location}/models/{model}@golden + * If no version ID or alias is specified, the "default" version will be + * returned. The "default" version alias is created for the first version of + * the model, and can be moved to other versions later on. There will be + * exactly one default version. */ // const name = 'abc123' diff --git a/samples/generated/v1beta1/model_service.update_explanation_dataset.js b/samples/generated/v1beta1/model_service.update_explanation_dataset.js new file mode 100644 index 00000000..0fb2dd9d --- /dev/null +++ b/samples/generated/v1beta1/model_service.update_explanation_dataset.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(model) { + // [START aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Model to update. + * Format: `projects/{project}/locations/{location}/models/{model}` + */ + // const model = 'abc123' + /** + * The example config containing the location of the dataset. + */ + // const examples = {} + + // Imports the Aiplatform library + const {ModelServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new ModelServiceClient(); + + async function callUpdateExplanationDataset() { + // Construct request + const request = { + model, + }; + + // Run request + const [operation] = await aiplatformClient.updateExplanationDataset(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateExplanationDataset(); + // [END aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_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 5e087b4e..b832c34f 100644 --- a/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json +++ b/samples/generated/v1beta1/snippet_metadata.google.cloud.aiplatform.v1beta1.json @@ -5342,7 +5342,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 60, "type": "FULL" } ], @@ -5527,6 +5527,50 @@ } } }, + { + "regionTag": "aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async", + "title": "DatasetService updateExplanationDataset Sample", + "origin": "API_DEFINITION", + "description": " Incremental update the dataset used for a examples model.", + "canonical": true, + "file": "model_service.update_explanation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateExplanationDataset", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDataset", + "async": true, + "parameters": [ + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "examples", + "type": ".google.cloud.aiplatform.v1beta1.Examples" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.ModelServiceClient" + }, + "method": { + "shortName": "UpdateExplanationDataset", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService.UpdateExplanationDataset", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.aiplatform.v1beta1.ModelService" + } + } + } + }, { "regionTag": "aiplatform_v1beta1_generated_ModelService_DeleteModel_async", "title": "DatasetService deleteModel Sample", @@ -5662,7 +5706,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 58, "type": "FULL" } ], diff --git a/src/v1beta1/gapic_metadata.json b/src/v1beta1/gapic_metadata.json index 52343ee5..a8aca391 100644 --- a/src/v1beta1/gapic_metadata.json +++ b/src/v1beta1/gapic_metadata.json @@ -1384,6 +1384,11 @@ "uploadModel" ] }, + "UpdateExplanationDataset": { + "methods": [ + "updateExplanationDataset" + ] + }, "DeleteModel": { "methods": [ "deleteModel" @@ -1467,6 +1472,11 @@ "uploadModel" ] }, + "UpdateExplanationDataset": { + "methods": [ + "updateExplanationDataset" + ] + }, "DeleteModel": { "methods": [ "deleteModel" diff --git a/src/v1beta1/model_service_client.ts b/src/v1beta1/model_service_client.ts index c16ccca2..a43309a4 100644 --- a/src/v1beta1/model_service_client.ts +++ b/src/v1beta1/model_service_client.ts @@ -312,6 +312,12 @@ export class ModelServiceClient { const uploadModelMetadata = protoFilesRoot.lookup( '.google.cloud.aiplatform.v1beta1.UploadModelOperationMetadata' ) as gax.protobuf.Type; + const updateExplanationDatasetResponse = protoFilesRoot.lookup( + '.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse' + ) as gax.protobuf.Type; + const updateExplanationDatasetMetadata = protoFilesRoot.lookup( + '.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata' + ) as gax.protobuf.Type; const deleteModelResponse = protoFilesRoot.lookup( '.google.protobuf.Empty' ) as gax.protobuf.Type; @@ -337,6 +343,15 @@ export class ModelServiceClient { uploadModelResponse.decode.bind(uploadModelResponse), uploadModelMetadata.decode.bind(uploadModelMetadata) ), + updateExplanationDataset: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateExplanationDatasetResponse.decode.bind( + updateExplanationDatasetResponse + ), + updateExplanationDatasetMetadata.decode.bind( + updateExplanationDatasetMetadata + ) + ), deleteModel: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteModelResponse.decode.bind(deleteModelResponse), @@ -409,6 +424,7 @@ export class ModelServiceClient { 'listModels', 'listModelVersions', 'updateModel', + 'updateExplanationDataset', 'deleteModel', 'deleteModelVersion', 'mergeVersionAliases', @@ -511,6 +527,16 @@ export class ModelServiceClient { * @param {string} request.name * Required. The name of the Model resource. * Format: `projects/{project}/locations/{location}/models/{model}` + * + * In order to retrieve a specific version of the model, also provide + * the version ID or version alias. + * Example: projects/{project}/locations/{location}/models/{model}@2 + * or + * projects/{project}/locations/{location}/models/{model}@golden + * If no version ID or alias is specified, the "default" version will be + * returned. The "default" version alias is created for the first version of + * the model, and can be moved to other versions later on. There will be + * exactly one default version. * @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. @@ -1271,6 +1297,150 @@ export class ModelServiceClient { protos.google.cloud.aiplatform.v1beta1.UploadModelOperationMetadata >; } + /** + * Incremental update the dataset used for a examples model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.model + * Required. The resource name of the Model to update. + * Format: `projects/{project}/locations/{location}/models/{model}` + * @param {google.cloud.aiplatform.v1beta1.Examples} request.examples + * The example config containing the location of the dataset. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/model_service.update_explanation_dataset.js + * region_tag:aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async + */ + updateExplanationDataset( + request?: protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateExplanationDataset( + request: protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateExplanationDataset( + request: protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, + callback: Callback< + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateExplanationDataset( + request?: protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | 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({ + model: request.model || '', + }); + this.initialize(); + return this.innerApiCalls.updateExplanationDataset( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `updateExplanationDataset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/model_service.update_explanation_dataset.js + * region_tag:aiplatform_v1beta1_generated_ModelService_UpdateExplanationDataset_async + */ + async checkUpdateExplanationDatasetProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateExplanationDataset, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.UpdateExplanationDatasetOperationMetadata + >; + } /** * Deletes a Model. * @@ -1566,6 +1736,8 @@ export class ModelServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the Model to export. + * The resource name may contain version id or version alias to specify the + * version, if no version is specified, the default version will be exported. * @param {google.cloud.aiplatform.v1beta1.ExportModelRequest.OutputConfig} request.outputConfig * Required. The desired output location and configuration. * @param {object} [options] diff --git a/src/v1beta1/model_service_client_config.json b/src/v1beta1/model_service_client_config.json index 40806050..5d0c4612 100644 --- a/src/v1beta1/model_service_client_config.json +++ b/src/v1beta1/model_service_client_config.json @@ -44,6 +44,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UpdateExplanationDataset": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeleteModel": { "timeout_millis": 5000, "retry_codes_name": "non_idempotent", diff --git a/test/gapic_model_service_v1beta1.ts b/test/gapic_model_service_v1beta1.ts index 82029a2e..e05a8d16 100644 --- a/test/gapic_model_service_v1beta1.ts +++ b/test/gapic_model_service_v1beta1.ts @@ -1205,6 +1205,204 @@ describe('v1beta1.ModelServiceClient', () => { }); }); + describe('updateExplanationDataset', () => { + it('invokes updateExplanationDataset 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.UpdateExplanationDatasetRequest() + ); + request.model = ''; + const expectedHeaderRequestParams = 'model='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateExplanationDataset = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateExplanationDataset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateExplanationDataset as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateExplanationDataset 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.UpdateExplanationDatasetRequest() + ); + request.model = ''; + const expectedHeaderRequestParams = 'model='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateExplanationDataset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExplanationDataset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetResponse, + protos.google.cloud.aiplatform.v1beta1.IUpdateExplanationDatasetOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateExplanationDataset as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateExplanationDataset with call 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.UpdateExplanationDatasetRequest() + ); + request.model = ''; + const expectedHeaderRequestParams = 'model='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExplanationDataset = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateExplanationDataset(request), + expectedError + ); + assert( + (client.innerApiCalls.updateExplanationDataset as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateExplanationDataset with LRO 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.UpdateExplanationDatasetRequest() + ); + request.model = ''; + const expectedHeaderRequestParams = 'model='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExplanationDataset = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateExplanationDataset(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateExplanationDataset as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateExplanationDatasetProgress without error', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateExplanationDatasetProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateExplanationDatasetProgress with error', async () => { + const client = new modelserviceModule.v1beta1.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateExplanationDatasetProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('deleteModel', () => { it('invokes deleteModel without error', async () => { const client = new modelserviceModule.v1beta1.ModelServiceClient({