diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java index c488ef24ba7b..fd34bd39d5d8 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java @@ -42,7 +42,6 @@ public class GenerativeModel { private GenerationConfig generationConfig = null; private List safetySettings = null; private List tools = null; - private Transport transport; public static Builder newBuilder() { return new Builder(); @@ -67,12 +66,6 @@ private GenerativeModel(Builder builder) { if (builder.tools != null) { this.tools = builder.tools; } - - if (builder.transport != null) { - this.transport = builder.transport; - } else { - this.transport = this.vertexAi.getTransport(); - } } /** Builder class for {@link GenerativeModel}. */ @@ -82,7 +75,6 @@ public static class Builder { private GenerationConfig generationConfig; private List safetySettings; private List tools; - private Transport transport; private Builder() {} @@ -158,15 +150,6 @@ public Builder setTools(List tools) { } return this; } - - /** - * Sets the {@link Transport} layer for API calls in the generative model. It overrides the - * transport setting in {@link com.google.cloud.vertexai.VertexAI} - */ - public Builder setTransport(Transport transport) { - this.transport = transport; - return this; - } } /** @@ -180,21 +163,7 @@ public Builder setTransport(Transport transport) { * for the generative model */ public GenerativeModel(String modelName, VertexAI vertexAi) { - this(modelName, null, null, vertexAi, null); - } - - /** - * Constructs a GenerativeModel instance. - * - * @param modelName the name of the generative model. Supported format: "gemini-pro", - * "models/gemini-pro", "publishers/google/models/gemini-pro" - * @param vertexAI a {@link com.google.cloud.vertexai.VertexAI} that contains the default configs - * for the generative model - * @param transport the {@link Transport} layer for API calls in the generative model. It - * overrides the transport setting in {@link com.google.cloud.vertexai.VertexAI} - */ - public GenerativeModel(String modelName, VertexAI vertexAi, Transport transport) { - this(modelName, null, null, vertexAi, transport); + this(modelName, null, null, vertexAi); } /** @@ -209,25 +178,7 @@ public GenerativeModel(String modelName, VertexAI vertexAi, Transport transport) */ @BetaApi public GenerativeModel(String modelName, GenerationConfig generationConfig, VertexAI vertexAi) { - this(modelName, generationConfig, null, vertexAi, null); - } - - /** - * Constructs a GenerativeModel instance with default generation config. - * - * @param modelName the name of the generative model. Supported format: "gemini-pro", - * "models/gemini-pro", "publishers/google/models/gemini-pro" - * @param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} instance that - * will be used by default for generating response - * @param vertexAI a {@link com.google.cloud.vertexai.VertexAI} that contains the default configs - * for the generative model - * @param transport the {@link Transport} layer for API calls in the generative model. It - * overrides the transport setting in {@link com.google.cloud.vertexai.VertexAI} - */ - @BetaApi - public GenerativeModel( - String modelName, GenerationConfig generationConfig, VertexAI vertexAi, Transport transport) { - this(modelName, generationConfig, null, vertexAi, transport); + this(modelName, generationConfig, null, vertexAi); } /** @@ -242,28 +193,7 @@ public GenerativeModel( */ @BetaApi("safetySettings is a preview feature.") public GenerativeModel(String modelName, List safetySettings, VertexAI vertexAi) { - this(modelName, null, safetySettings, vertexAi, null); - } - - /** - * Constructs a GenerativeModel instance with default safety settings. - * - * @param modelName the name of the generative model. Supported format: "gemini-pro", - * "models/gemini-pro", "publishers/google/models/gemini-pro" - * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} instances - * that will be used by default for generating response - * @param vertexAI a {@link com.google.cloud.vertexai.VertexAI} that contains the default configs - * for the generative model - * @param transport the {@link Transport} layer for API calls in the generative model. It - * overrides the transport setting in {@link com.google.cloud.vertexai.VertexAI} - */ - @BetaApi("safetySettings is a preview feature.") - public GenerativeModel( - String modelName, - List safetySettings, - VertexAI vertexAi, - Transport transport) { - this(modelName, null, safetySettings, vertexAi, transport); + this(modelName, null, safetySettings, vertexAi); } /** @@ -284,30 +214,6 @@ public GenerativeModel( GenerationConfig generationConfig, List safetySettings, VertexAI vertexAi) { - this(modelName, generationConfig, safetySettings, vertexAi, null); - } - - /** - * Constructs a GenerativeModel instance with default generation config and safety settings. - * - * @param modelName the name of the generative model. Supported format: "gemini-pro", - * "models/gemini-pro", "publishers/google/models/gemini-pro" - * @param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} instance that - * will be used by default for generating response - * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} instances - * that will be used by default for generating response - * @param vertexAI a {@link com.google.cloud.vertexai.VertexAI} that contains the default configs - * for the generative model - * @param transport the {@link Transport} layer for API calls in the generative model. It - * overrides the transport setting in {@link com.google.cloud.vertexai.VertexAI} - */ - @BetaApi - public GenerativeModel( - String modelName, - GenerationConfig generationConfig, - List safetySettings, - VertexAI vertexAi, - Transport transport) { modelName = reconcileModelName(modelName); this.modelName = modelName; this.resourceName = @@ -324,11 +230,6 @@ public GenerativeModel( } } this.vertexAi = vertexAi; - if (transport != null) { - this.transport = transport; - } else { - this.transport = vertexAi.getTransport(); - } } /** @@ -388,7 +289,7 @@ public CountTokensResponse countTokens(List contents) throws IOExceptio @BetaApi private CountTokensResponse countTokensFromRequest(CountTokensRequest request) throws IOException { - if (this.transport == Transport.REST) { + if (vertexAi.getTransport() == Transport.REST) { return vertexAi.getLlmUtilityRestClient().countTokens(request); } else { return vertexAi.getLlmUtilityClient().countTokens(request); @@ -619,7 +520,7 @@ public GenerateContentResponse generateContent( */ private GenerateContentResponse generateContent(GenerateContentRequest request) throws IOException { - if (this.transport == Transport.REST) { + if (vertexAi.getTransport() == Transport.REST) { return vertexAi.getPredictionServiceRestClient().generateContentCallable().call(request); } else { return vertexAi.getPredictionServiceClient().generateContentCallable().call(request); @@ -1031,7 +932,7 @@ public ResponseStream generateContentStream( */ private ResponseStream generateContentStream( GenerateContentRequest request) throws IOException { - if (this.transport == Transport.REST) { + if (vertexAi.getTransport() == Transport.REST) { return new ResponseStream( new ResponseStreamIteratorWithHistory( vertexAi @@ -1082,24 +983,11 @@ public void setTools(List tools) { } } - /** - * Sets the value for {@link #getTransport}, which defines the layer for API calls in this - * generative model. - */ - public void setTransport(Transport transport) { - this.transport = transport; - } - /** Returns the model name of this generative model. */ public String getModelName() { return this.modelName; } - /** Returns the {@link Transport} layer for API calls in this generative model. */ - public Transport getTransport() { - return this.transport; - } - /** * Returns the {@link com.google.cloud.vertexai.api.GenerationConfig} of this generative model. */ diff --git a/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/GenerativeModelTest.java b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/GenerativeModelTest.java index f6930b38fca5..740934aae8ce 100644 --- a/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/GenerativeModelTest.java +++ b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/generativeai/GenerativeModelTest.java @@ -26,7 +26,6 @@ import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.auth.oauth2.GoogleCredentials; -import com.google.cloud.vertexai.Transport; import com.google.cloud.vertexai.VertexAI; import com.google.cloud.vertexai.api.Content; import com.google.cloud.vertexai.api.CountTokensRequest; @@ -35,15 +34,18 @@ import com.google.cloud.vertexai.api.GenerateContentRequest; import com.google.cloud.vertexai.api.GenerateContentResponse; import com.google.cloud.vertexai.api.GenerationConfig; +import com.google.cloud.vertexai.api.GoogleSearchRetrieval; import com.google.cloud.vertexai.api.HarmCategory; import com.google.cloud.vertexai.api.LlmUtilityServiceClient; import com.google.cloud.vertexai.api.Part; import com.google.cloud.vertexai.api.PredictionServiceClient; +import com.google.cloud.vertexai.api.Retrieval; import com.google.cloud.vertexai.api.SafetySetting; import com.google.cloud.vertexai.api.SafetySetting.HarmBlockThreshold; import com.google.cloud.vertexai.api.Schema; import com.google.cloud.vertexai.api.Tool; import com.google.cloud.vertexai.api.Type; +import com.google.cloud.vertexai.api.VertexAISearch; import java.lang.reflect.Field; import java.util.Arrays; import java.util.Iterator; @@ -96,6 +98,22 @@ public final class GenerativeModelTest { .build()) .addRequired("location"))) .build(); + private static final Tool GOOGLE_SEARCH_TOOL = + Tool.newBuilder() + .setGoogleSearchRetrieval(GoogleSearchRetrieval.newBuilder().setDisableAttribution(false)) + .build(); + private static final Tool VERTEX_AI_SEARCH_TOOL = + Tool.newBuilder() + .setRetrieval( + Retrieval.newBuilder() + .setVertexAiSearch( + VertexAISearch.newBuilder() + .setDatastore( + String.format( + "projects/%s/locations/%s/collections/%s/dataStores/%s", + PROJECT, "global", "default_collection", "test_123"))) + .setDisableAttribution(false)) + .build(); private static final String TEXT = "What is your name?"; @@ -103,7 +121,7 @@ public final class GenerativeModelTest { private GenerativeModel model; private List safetySettings = Arrays.asList(SAFETY_SETTING); private List defaultSafetySettings = Arrays.asList(DEFAULT_SAFETY_SETTING); - private List tools = Arrays.asList(TOOL); + private List tools = Arrays.asList(TOOL, GOOGLE_SEARCH_TOOL, VERTEX_AI_SEARCH_TOOL); @Rule public final MockitoRule mocksRule = MockitoJUnit.rule(); @@ -169,7 +187,6 @@ public void testInstantiateGenerativeModelwithBuilder() { assertThat(model.getGenerationConfig()).isNull(); assertThat(model.getSafetySettings()).isNull(); assertThat(model.getTools()).isNull(); - assertThat(model.getTransport()).isEqualTo(Transport.GRPC); } @Test @@ -181,13 +198,11 @@ public void testInstantiateGenerativeModelwithBuilderAllConfigs() { .setGenerationConfig(GENERATION_CONFIG) .setSafetySettings(safetySettings) .setTools(tools) - .setTransport(Transport.REST) .build(); assertThat(model.getModelName()).isEqualTo(MODEL_NAME); assertThat(model.getGenerationConfig()).isEqualTo(GENERATION_CONFIG); assertThat(model.getSafetySettings()).isEqualTo(safetySettings); assertThat(model.getTools()).isEqualTo(tools); - assertThat(model.getTransport()).isEqualTo(Transport.REST); } @Test diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Candidate.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Candidate.java index acbe96592eb9..98e45b2d4437 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Candidate.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Candidate.java @@ -625,6 +625,62 @@ public com.google.cloud.vertexai.api.CitationMetadataOrBuilder getCitationMetada : citationMetadata_; } + public static final int GROUNDING_METADATA_FIELD_NUMBER = 7; + private com.google.cloud.vertexai.api.GroundingMetadata groundingMetadata_; + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the groundingMetadata field is set. + */ + @java.lang.Override + public boolean hasGroundingMetadata() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The groundingMetadata. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadata getGroundingMetadata() { + return groundingMetadata_ == null + ? com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance() + : groundingMetadata_; + } + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadataOrBuilder getGroundingMetadataOrBuilder() { + return groundingMetadata_ == null + ? com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance() + : groundingMetadata_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -659,6 +715,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000004) != 0)) { output.writeMessage(6, getCitationMetadata()); } + if (((bitField0_ & 0x00000008) != 0)) { + output.writeMessage(7, getGroundingMetadata()); + } getUnknownFields().writeTo(output); } @@ -688,6 +747,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCitationMetadata()); } + if (((bitField0_ & 0x00000008) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getGroundingMetadata()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -718,6 +780,10 @@ public boolean equals(final java.lang.Object obj) { if (hasCitationMetadata()) { if (!getCitationMetadata().equals(other.getCitationMetadata())) return false; } + if (hasGroundingMetadata() != other.hasGroundingMetadata()) return false; + if (hasGroundingMetadata()) { + if (!getGroundingMetadata().equals(other.getGroundingMetadata())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -749,6 +815,10 @@ public int hashCode() { hash = (37 * hash) + CITATION_METADATA_FIELD_NUMBER; hash = (53 * hash) + getCitationMetadata().hashCode(); } + if (hasGroundingMetadata()) { + hash = (37 * hash) + GROUNDING_METADATA_FIELD_NUMBER; + hash = (53 * hash) + getGroundingMetadata().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -892,6 +962,7 @@ private void maybeForceBuilderInitialization() { getContentFieldBuilder(); getSafetyRatingsFieldBuilder(); getCitationMetadataFieldBuilder(); + getGroundingMetadataFieldBuilder(); } } @@ -919,6 +990,11 @@ public Builder clear() { citationMetadataBuilder_.dispose(); citationMetadataBuilder_ = null; } + groundingMetadata_ = null; + if (groundingMetadataBuilder_ != null) { + groundingMetadataBuilder_.dispose(); + groundingMetadataBuilder_ = null; + } return this; } @@ -988,6 +1064,13 @@ private void buildPartial0(com.google.cloud.vertexai.api.Candidate result) { citationMetadataBuilder_ == null ? citationMetadata_ : citationMetadataBuilder_.build(); to_bitField0_ |= 0x00000004; } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.groundingMetadata_ = + groundingMetadataBuilder_ == null + ? groundingMetadata_ + : groundingMetadataBuilder_.build(); + to_bitField0_ |= 0x00000008; + } result.bitField0_ |= to_bitField0_; } @@ -1080,6 +1163,9 @@ public Builder mergeFrom(com.google.cloud.vertexai.api.Candidate other) { if (other.hasCitationMetadata()) { mergeCitationMetadata(other.getCitationMetadata()); } + if (other.hasGroundingMetadata()) { + mergeGroundingMetadata(other.getGroundingMetadata()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1150,6 +1236,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000020; break; } // case 50 + case 58: + { + input.readMessage( + getGroundingMetadataFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2290,6 +2383,212 @@ public com.google.cloud.vertexai.api.CitationMetadataOrBuilder getCitationMetada return citationMetadataBuilder_; } + private com.google.cloud.vertexai.api.GroundingMetadata groundingMetadata_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingMetadata, + com.google.cloud.vertexai.api.GroundingMetadata.Builder, + com.google.cloud.vertexai.api.GroundingMetadataOrBuilder> + groundingMetadataBuilder_; + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the groundingMetadata field is set. + */ + public boolean hasGroundingMetadata() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The groundingMetadata. + */ + public com.google.cloud.vertexai.api.GroundingMetadata getGroundingMetadata() { + if (groundingMetadataBuilder_ == null) { + return groundingMetadata_ == null + ? com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance() + : groundingMetadata_; + } else { + return groundingMetadataBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setGroundingMetadata(com.google.cloud.vertexai.api.GroundingMetadata value) { + if (groundingMetadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + groundingMetadata_ = value; + } else { + groundingMetadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setGroundingMetadata( + com.google.cloud.vertexai.api.GroundingMetadata.Builder builderForValue) { + if (groundingMetadataBuilder_ == null) { + groundingMetadata_ = builderForValue.build(); + } else { + groundingMetadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeGroundingMetadata(com.google.cloud.vertexai.api.GroundingMetadata value) { + if (groundingMetadataBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && groundingMetadata_ != null + && groundingMetadata_ + != com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance()) { + getGroundingMetadataBuilder().mergeFrom(value); + } else { + groundingMetadata_ = value; + } + } else { + groundingMetadataBuilder_.mergeFrom(value); + } + if (groundingMetadata_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearGroundingMetadata() { + bitField0_ = (bitField0_ & ~0x00000040); + groundingMetadata_ = null; + if (groundingMetadataBuilder_ != null) { + groundingMetadataBuilder_.dispose(); + groundingMetadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.vertexai.api.GroundingMetadata.Builder getGroundingMetadataBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return getGroundingMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.vertexai.api.GroundingMetadataOrBuilder + getGroundingMetadataOrBuilder() { + if (groundingMetadataBuilder_ != null) { + return groundingMetadataBuilder_.getMessageOrBuilder(); + } else { + return groundingMetadata_ == null + ? com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance() + : groundingMetadata_; + } + } + /** + * + * + *
+     * Output only. Metadata specifies sources used to ground generated content.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingMetadata, + com.google.cloud.vertexai.api.GroundingMetadata.Builder, + com.google.cloud.vertexai.api.GroundingMetadataOrBuilder> + getGroundingMetadataFieldBuilder() { + if (groundingMetadataBuilder_ == null) { + groundingMetadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingMetadata, + com.google.cloud.vertexai.api.GroundingMetadata.Builder, + com.google.cloud.vertexai.api.GroundingMetadataOrBuilder>( + getGroundingMetadata(), getParentForChildren(), isClean()); + groundingMetadata_ = null; + } + return groundingMetadataBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/CandidateOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/CandidateOrBuilder.java index 8802ce27924b..0fc412a53656 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/CandidateOrBuilder.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/CandidateOrBuilder.java @@ -261,4 +261,45 @@ public interface CandidateOrBuilder * */ com.google.cloud.vertexai.api.CitationMetadataOrBuilder getCitationMetadataOrBuilder(); + + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the groundingMetadata field is set. + */ + boolean hasGroundingMetadata(); + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The groundingMetadata. + */ + com.google.cloud.vertexai.api.GroundingMetadata getGroundingMetadata(); + /** + * + * + *
+   * Output only. Metadata specifies sources used to ground generated content.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.vertexai.api.GroundingMetadataOrBuilder getGroundingMetadataOrBuilder(); } diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ContentProto.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ContentProto.java index 98d9039f181e..d8cfbbccd30e 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ContentProto.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ContentProto.java @@ -72,6 +72,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_vertexai_v1_Candidate_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_vertexai_v1_Candidate_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_Segment_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_Segment_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_GroundingAttribution_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_GroundingMetadata_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -131,7 +147,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "rt_index\030\001 \001(\005B\003\340A\003\022\026\n\tend_index\030\002 \001(\005B\003" + "\340A\003\022\020\n\003uri\030\003 \001(\tB\003\340A\003\022\022\n\005title\030\004 \001(\tB\003\340A" + "\003\022\024\n\007license\030\005 \001(\tB\003\340A\003\0220\n\020publication_d" - + "ate\030\006 \001(\0132\021.google.type.DateB\003\340A\003\"\334\003\n\tCa" + + "ate\030\006 \001(\0132\021.google.type.DateB\003\340A\003\"\252\004\n\tCa" + "ndidate\022\022\n\005index\030\001 \001(\005B\003\340A\003\0227\n\007content\030\002" + " \001(\0132!.google.cloud.vertexai.v1.ContentB" + "\003\340A\003\022L\n\rfinish_reason\030\003 \001(\01620.google.clo" @@ -140,20 +156,35 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "d.vertexai.v1.SafetyRatingB\003\340A\003\022 \n\016finis" + "h_message\030\005 \001(\tB\003\340A\003H\000\210\001\001\022J\n\021citation_me" + "tadata\030\006 \001(\0132*.google.cloud.vertexai.v1." - + "CitationMetadataB\003\340A\003\"n\n\014FinishReason\022\035\n" - + "\031FINISH_REASON_UNSPECIFIED\020\000\022\010\n\004STOP\020\001\022\016" - + "\n\nMAX_TOKENS\020\002\022\n\n\006SAFETY\020\003\022\016\n\nRECITATION" - + "\020\004\022\t\n\005OTHER\020\005B\021\n\017_finish_message*\264\001\n\014Har" - + "mCategory\022\035\n\031HARM_CATEGORY_UNSPECIFIED\020\000" - + "\022\035\n\031HARM_CATEGORY_HATE_SPEECH\020\001\022#\n\037HARM_" - + "CATEGORY_DANGEROUS_CONTENT\020\002\022\034\n\030HARM_CAT" - + "EGORY_HARASSMENT\020\003\022#\n\037HARM_CATEGORY_SEXU" - + "ALLY_EXPLICIT\020\004B\311\001\n\035com.google.cloud.ver" - + "texai.apiB\014ContentProtoP\001Z>cloud.google." - + "com/go/aiplatform/apiv1/aiplatformpb;aip" - + "latformpb\252\002\032Google.Cloud.AIPlatform.V1\312\002" - + "\032Google\\Cloud\\AIPlatform\\V1\352\002\035Google::Cl" - + "oud::AIPlatform::V1b\006proto3" + + "CitationMetadataB\003\340A\003\022L\n\022grounding_metad" + + "ata\030\007 \001(\0132+.google.cloud.vertexai.v1.Gro" + + "undingMetadataB\003\340A\003\"n\n\014FinishReason\022\035\n\031F" + + "INISH_REASON_UNSPECIFIED\020\000\022\010\n\004STOP\020\001\022\016\n\n" + + "MAX_TOKENS\020\002\022\n\n\006SAFETY\020\003\022\016\n\nRECITATION\020\004" + + "\022\t\n\005OTHER\020\005B\021\n\017_finish_message\"T\n\007Segmen" + + "t\022\027\n\npart_index\030\001 \001(\005B\003\340A\003\022\030\n\013start_inde" + + "x\030\002 \001(\005B\003\340A\003\022\026\n\tend_index\030\003 \001(\005B\003\340A\003\"\215\002\n" + + "\024GroundingAttribution\022F\n\003web\030\003 \001(\01322.goo" + + "gle.cloud.vertexai.v1.GroundingAttributi" + + "on.WebB\003\340A\001H\000\0227\n\007segment\030\001 \001(\0132!.google." + + "cloud.vertexai.v1.SegmentB\003\340A\003\022%\n\020confid" + + "ence_score\030\002 \001(\002B\006\340A\001\340A\003H\001\210\001\001\032+\n\003Web\022\020\n\003" + + "uri\030\001 \001(\tB\003\340A\003\022\022\n\005title\030\002 \001(\tB\003\340A\003B\013\n\tre" + + "ferenceB\023\n\021_confidence_score\"\211\001\n\021Groundi" + + "ngMetadata\022\037\n\022web_search_queries\030\001 \003(\tB\003" + + "\340A\001\022S\n\026grounding_attributions\030\002 \003(\0132..go" + + "ogle.cloud.vertexai.v1.GroundingAttribut" + + "ionB\003\340A\001*\264\001\n\014HarmCategory\022\035\n\031HARM_CATEGO" + + "RY_UNSPECIFIED\020\000\022\035\n\031HARM_CATEGORY_HATE_S" + + "PEECH\020\001\022#\n\037HARM_CATEGORY_DANGEROUS_CONTE" + + "NT\020\002\022\034\n\030HARM_CATEGORY_HARASSMENT\020\003\022#\n\037HA" + + "RM_CATEGORY_SEXUALLY_EXPLICIT\020\004B\311\001\n\035com." + + "google.cloud.vertexai.apiB\014ContentProtoP" + + "\001Z>cloud.google.com/go/aiplatform/apiv1/" + + "aiplatformpb;aiplatformpb\252\002\032Google.Cloud" + + ".AIPlatform.V1\312\002\032Google\\Cloud\\AIPlatform" + + "\\V1\352\002\035Google::Cloud::AIPlatform::V1b\006pro" + + "to3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -263,6 +294,41 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "SafetyRatings", "FinishMessage", "CitationMetadata", + "GroundingMetadata", + }); + internal_static_google_cloud_vertexai_v1_Segment_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_google_cloud_vertexai_v1_Segment_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_Segment_descriptor, + new java.lang.String[] { + "PartIndex", "StartIndex", "EndIndex", + }); + internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_google_cloud_vertexai_v1_GroundingAttribution_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor, + new java.lang.String[] { + "Web", "Segment", "ConfidenceScore", "Reference", + }); + internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor = + internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor, + new java.lang.String[] { + "Uri", "Title", + }); + internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_google_cloud_vertexai_v1_GroundingMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor, + new java.lang.String[] { + "WebSearchQueries", "GroundingAttributions", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrieval.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrieval.java new file mode 100644 index 000000000000..b95257e6e8c4 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrieval.java @@ -0,0 +1,543 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Tool to retrieve public web data for grounding, powered by Google.
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GoogleSearchRetrieval} + */ +public final class GoogleSearchRetrieval extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.GoogleSearchRetrieval) + GoogleSearchRetrievalOrBuilder { + private static final long serialVersionUID = 0L; + // Use GoogleSearchRetrieval.newBuilder() to construct. + private GoogleSearchRetrieval(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GoogleSearchRetrieval() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GoogleSearchRetrieval(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GoogleSearchRetrieval.class, + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder.class); + } + + public static final int DISABLE_ATTRIBUTION_FIELD_NUMBER = 1; + private boolean disableAttribution_ = false; + /** + * + * + *
+   * Optional. Disable using the result from this tool in detecting grounding
+   * attribution. This does not affect how the result is given to the model for
+   * generation.
+   * 
+ * + * bool disable_attribution = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + @java.lang.Override + public boolean getDisableAttribution() { + return disableAttribution_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (disableAttribution_ != false) { + output.writeBool(1, disableAttribution_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (disableAttribution_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, disableAttribution_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.GoogleSearchRetrieval)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.GoogleSearchRetrieval other = + (com.google.cloud.vertexai.api.GoogleSearchRetrieval) obj; + + if (getDisableAttribution() != other.getDisableAttribution()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DISABLE_ATTRIBUTION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisableAttribution()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.GoogleSearchRetrieval prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Tool to retrieve public web data for grounding, powered by Google.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GoogleSearchRetrieval} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.GoogleSearchRetrieval) + com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GoogleSearchRetrieval.class, + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.GoogleSearchRetrieval.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + disableAttribution_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrieval getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrieval build() { + com.google.cloud.vertexai.api.GoogleSearchRetrieval result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrieval buildPartial() { + com.google.cloud.vertexai.api.GoogleSearchRetrieval result = + new com.google.cloud.vertexai.api.GoogleSearchRetrieval(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.GoogleSearchRetrieval result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.disableAttribution_ = disableAttribution_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.GoogleSearchRetrieval) { + return mergeFrom((com.google.cloud.vertexai.api.GoogleSearchRetrieval) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.GoogleSearchRetrieval other) { + if (other == com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance()) + return this; + if (other.getDisableAttribution() != false) { + setDisableAttribution(other.getDisableAttribution()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + disableAttribution_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private boolean disableAttribution_; + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + @java.lang.Override + public boolean getDisableAttribution() { + return disableAttribution_; + } + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The disableAttribution to set. + * @return This builder for chaining. + */ + public Builder setDisableAttribution(boolean value) { + + disableAttribution_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDisableAttribution() { + bitField0_ = (bitField0_ & ~0x00000001); + disableAttribution_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.GoogleSearchRetrieval) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.GoogleSearchRetrieval) + private static final com.google.cloud.vertexai.api.GoogleSearchRetrieval DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.GoogleSearchRetrieval(); + } + + public static com.google.cloud.vertexai.api.GoogleSearchRetrieval getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GoogleSearchRetrieval parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrieval getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrievalOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrievalOrBuilder.java new file mode 100644 index 000000000000..a45b10552d0d --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GoogleSearchRetrievalOrBuilder.java @@ -0,0 +1,41 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface GoogleSearchRetrievalOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.GoogleSearchRetrieval) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. Disable using the result from this tool in detecting grounding
+   * attribution. This does not affect how the result is given to the model for
+   * generation.
+   * 
+ * + * bool disable_attribution = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + boolean getDisableAttribution(); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttribution.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttribution.java new file mode 100644 index 000000000000..6d1980582528 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttribution.java @@ -0,0 +1,2138 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Grounding attribution.
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingAttribution} + */ +public final class GroundingAttribution extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.GroundingAttribution) + GroundingAttributionOrBuilder { + private static final long serialVersionUID = 0L; + // Use GroundingAttribution.newBuilder() to construct. + private GroundingAttribution(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GroundingAttribution() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GroundingAttribution(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingAttribution.class, + com.google.cloud.vertexai.api.GroundingAttribution.Builder.class); + } + + public interface WebOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.GroundingAttribution.Web) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Output only. URI reference of the attribution.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+     * Output only. URI reference of the attribution.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+     * Output only. Title of the attribution.
+     * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The title. + */ + java.lang.String getTitle(); + /** + * + * + *
+     * Output only. Title of the attribution.
+     * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for title. + */ + com.google.protobuf.ByteString getTitleBytes(); + } + /** + * + * + *
+   * Attribution from the web.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingAttribution.Web} + */ + public static final class Web extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.GroundingAttribution.Web) + WebOrBuilder { + private static final long serialVersionUID = 0L; + // Use Web.newBuilder() to construct. + private Web(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Web() { + uri_ = ""; + title_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Web(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingAttribution.Web.class, + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder.class); + } + + public static final int URI_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object uri_ = ""; + /** + * + * + *
+     * Output only. URI reference of the attribution.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+     * Output only. URI reference of the attribution.
+     * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TITLE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object title_ = ""; + /** + * + * + *
+     * Output only. Title of the attribution.
+     * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The title. + */ + @java.lang.Override + public java.lang.String getTitle() { + java.lang.Object ref = title_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + title_ = s; + return s; + } + } + /** + * + * + *
+     * Output only. Title of the attribution.
+     * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for title. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTitleBytes() { + java.lang.Object ref = title_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + title_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(title_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, title_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(title_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, title_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.GroundingAttribution.Web)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.GroundingAttribution.Web other = + (com.google.cloud.vertexai.api.GroundingAttribution.Web) obj; + + if (!getUri().equals(other.getUri())) return false; + if (!getTitle().equals(other.getTitle())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + TITLE_FIELD_NUMBER; + hash = (53 * hash) + getTitle().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.vertexai.api.GroundingAttribution.Web prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Attribution from the web.
+     * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingAttribution.Web} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.GroundingAttribution.Web) + com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingAttribution.Web.class, + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.GroundingAttribution.Web.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + uri_ = ""; + title_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_Web_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web build() { + com.google.cloud.vertexai.api.GroundingAttribution.Web result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web buildPartial() { + com.google.cloud.vertexai.api.GroundingAttribution.Web result = + new com.google.cloud.vertexai.api.GroundingAttribution.Web(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.GroundingAttribution.Web result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.uri_ = uri_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.title_ = title_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.GroundingAttribution.Web) { + return mergeFrom((com.google.cloud.vertexai.api.GroundingAttribution.Web) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.GroundingAttribution.Web other) { + if (other == com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance()) + return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTitle().isEmpty()) { + title_ = other.title_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + uri_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + title_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object uri_ = ""; + /** + * + * + *
+       * Output only. URI reference of the attribution.
+       * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Output only. URI reference of the attribution.
+       * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Output only. URI reference of the attribution.
+       * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. URI reference of the attribution.
+       * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + uri_ = getDefaultInstance().getUri(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. URI reference of the attribution.
+       * 
+ * + * string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object title_ = ""; + /** + * + * + *
+       * Output only. Title of the attribution.
+       * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The title. + */ + public java.lang.String getTitle() { + java.lang.Object ref = title_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + title_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Output only. Title of the attribution.
+       * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for title. + */ + public com.google.protobuf.ByteString getTitleBytes() { + java.lang.Object ref = title_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + title_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Output only. Title of the attribution.
+       * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The title to set. + * @return This builder for chaining. + */ + public Builder setTitle(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + title_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Title of the attribution.
+       * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearTitle() { + title_ = getDefaultInstance().getTitle(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Title of the attribution.
+       * 
+ * + * string title = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for title to set. + * @return This builder for chaining. + */ + public Builder setTitleBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + title_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.GroundingAttribution.Web) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.GroundingAttribution.Web) + private static final com.google.cloud.vertexai.api.GroundingAttribution.Web DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.GroundingAttribution.Web(); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution.Web getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Web parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + private int referenceCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reference_; + + public enum ReferenceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + WEB(3), + REFERENCE_NOT_SET(0); + private final int value; + + private ReferenceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReferenceCase valueOf(int value) { + return forNumber(value); + } + + public static ReferenceCase forNumber(int value) { + switch (value) { + case 3: + return WEB; + case 0: + return REFERENCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReferenceCase getReferenceCase() { + return ReferenceCase.forNumber(referenceCase_); + } + + public static final int WEB_FIELD_NUMBER = 3; + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the web field is set. + */ + @java.lang.Override + public boolean hasWeb() { + return referenceCase_ == 3; + } + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The web. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web getWeb() { + if (referenceCase_ == 3) { + return (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_; + } + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder getWebOrBuilder() { + if (referenceCase_ == 3) { + return (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_; + } + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + + public static final int SEGMENT_FIELD_NUMBER = 1; + private com.google.cloud.vertexai.api.Segment segment_; + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the segment field is set. + */ + @java.lang.Override + public boolean hasSegment() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The segment. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.Segment getSegment() { + return segment_ == null ? com.google.cloud.vertexai.api.Segment.getDefaultInstance() : segment_; + } + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.SegmentOrBuilder getSegmentOrBuilder() { + return segment_ == null ? com.google.cloud.vertexai.api.Segment.getDefaultInstance() : segment_; + } + + public static final int CONFIDENCE_SCORE_FIELD_NUMBER = 2; + private float confidenceScore_ = 0F; + /** + * + * + *
+   * Optional. Output only. Confidence score of the attribution. Ranges from 0
+   * to 1. 1 is the most confident.
+   * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the confidenceScore field is set. + */ + @java.lang.Override + public boolean hasConfidenceScore() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Optional. Output only. Confidence score of the attribution. Ranges from 0
+   * to 1. 1 is the most confident.
+   * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The confidenceScore. + */ + @java.lang.Override + public float getConfidenceScore() { + return confidenceScore_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getSegment()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeFloat(2, confidenceScore_); + } + if (referenceCase_ == 3) { + output.writeMessage(3, (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSegment()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidenceScore_); + } + if (referenceCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.GroundingAttribution)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.GroundingAttribution other = + (com.google.cloud.vertexai.api.GroundingAttribution) obj; + + if (hasSegment() != other.hasSegment()) return false; + if (hasSegment()) { + if (!getSegment().equals(other.getSegment())) return false; + } + if (hasConfidenceScore() != other.hasConfidenceScore()) return false; + if (hasConfidenceScore()) { + if (java.lang.Float.floatToIntBits(getConfidenceScore()) + != java.lang.Float.floatToIntBits(other.getConfidenceScore())) return false; + } + if (!getReferenceCase().equals(other.getReferenceCase())) return false; + switch (referenceCase_) { + case 3: + if (!getWeb().equals(other.getWeb())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasSegment()) { + hash = (37 * hash) + SEGMENT_FIELD_NUMBER; + hash = (53 * hash) + getSegment().hashCode(); + } + if (hasConfidenceScore()) { + hash = (37 * hash) + CONFIDENCE_SCORE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidenceScore()); + } + switch (referenceCase_) { + case 3: + hash = (37 * hash) + WEB_FIELD_NUMBER; + hash = (53 * hash) + getWeb().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.GroundingAttribution prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Grounding attribution.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingAttribution} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.GroundingAttribution) + com.google.cloud.vertexai.api.GroundingAttributionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingAttribution.class, + com.google.cloud.vertexai.api.GroundingAttribution.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.GroundingAttribution.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSegmentFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (webBuilder_ != null) { + webBuilder_.clear(); + } + segment_ = null; + if (segmentBuilder_ != null) { + segmentBuilder_.dispose(); + segmentBuilder_ = null; + } + confidenceScore_ = 0F; + referenceCase_ = 0; + reference_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingAttribution_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.GroundingAttribution.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution build() { + com.google.cloud.vertexai.api.GroundingAttribution result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution buildPartial() { + com.google.cloud.vertexai.api.GroundingAttribution result = + new com.google.cloud.vertexai.api.GroundingAttribution(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.GroundingAttribution result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.segment_ = segmentBuilder_ == null ? segment_ : segmentBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.confidenceScore_ = confidenceScore_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(com.google.cloud.vertexai.api.GroundingAttribution result) { + result.referenceCase_ = referenceCase_; + result.reference_ = this.reference_; + if (referenceCase_ == 3 && webBuilder_ != null) { + result.reference_ = webBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.GroundingAttribution) { + return mergeFrom((com.google.cloud.vertexai.api.GroundingAttribution) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.GroundingAttribution other) { + if (other == com.google.cloud.vertexai.api.GroundingAttribution.getDefaultInstance()) + return this; + if (other.hasSegment()) { + mergeSegment(other.getSegment()); + } + if (other.hasConfidenceScore()) { + setConfidenceScore(other.getConfidenceScore()); + } + switch (other.getReferenceCase()) { + case WEB: + { + mergeWeb(other.getWeb()); + break; + } + case REFERENCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getSegmentFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 10 + case 21: + { + confidenceScore_ = input.readFloat(); + bitField0_ |= 0x00000004; + break; + } // case 21 + case 26: + { + input.readMessage(getWebFieldBuilder().getBuilder(), extensionRegistry); + referenceCase_ = 3; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int referenceCase_ = 0; + private java.lang.Object reference_; + + public ReferenceCase getReferenceCase() { + return ReferenceCase.forNumber(referenceCase_); + } + + public Builder clearReference() { + referenceCase_ = 0; + reference_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution.Web, + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder, + com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder> + webBuilder_; + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the web field is set. + */ + @java.lang.Override + public boolean hasWeb() { + return referenceCase_ == 3; + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The web. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.Web getWeb() { + if (webBuilder_ == null) { + if (referenceCase_ == 3) { + return (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_; + } + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } else { + if (referenceCase_ == 3) { + return webBuilder_.getMessage(); + } + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setWeb(com.google.cloud.vertexai.api.GroundingAttribution.Web value) { + if (webBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reference_ = value; + onChanged(); + } else { + webBuilder_.setMessage(value); + } + referenceCase_ = 3; + return this; + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setWeb( + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder builderForValue) { + if (webBuilder_ == null) { + reference_ = builderForValue.build(); + onChanged(); + } else { + webBuilder_.setMessage(builderForValue.build()); + } + referenceCase_ = 3; + return this; + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeWeb(com.google.cloud.vertexai.api.GroundingAttribution.Web value) { + if (webBuilder_ == null) { + if (referenceCase_ == 3 + && reference_ + != com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance()) { + reference_ = + com.google.cloud.vertexai.api.GroundingAttribution.Web.newBuilder( + (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_) + .mergeFrom(value) + .buildPartial(); + } else { + reference_ = value; + } + onChanged(); + } else { + if (referenceCase_ == 3) { + webBuilder_.mergeFrom(value); + } else { + webBuilder_.setMessage(value); + } + } + referenceCase_ = 3; + return this; + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearWeb() { + if (webBuilder_ == null) { + if (referenceCase_ == 3) { + referenceCase_ = 0; + reference_ = null; + onChanged(); + } + } else { + if (referenceCase_ == 3) { + referenceCase_ = 0; + reference_ = null; + } + webBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder getWebBuilder() { + return getWebFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder getWebOrBuilder() { + if ((referenceCase_ == 3) && (webBuilder_ != null)) { + return webBuilder_.getMessageOrBuilder(); + } else { + if (referenceCase_ == 3) { + return (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_; + } + return com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + } + /** + * + * + *
+     * Optional. Attribution from the web.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution.Web, + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder, + com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder> + getWebFieldBuilder() { + if (webBuilder_ == null) { + if (!(referenceCase_ == 3)) { + reference_ = com.google.cloud.vertexai.api.GroundingAttribution.Web.getDefaultInstance(); + } + webBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution.Web, + com.google.cloud.vertexai.api.GroundingAttribution.Web.Builder, + com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder>( + (com.google.cloud.vertexai.api.GroundingAttribution.Web) reference_, + getParentForChildren(), + isClean()); + reference_ = null; + } + referenceCase_ = 3; + onChanged(); + return webBuilder_; + } + + private com.google.cloud.vertexai.api.Segment segment_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Segment, + com.google.cloud.vertexai.api.Segment.Builder, + com.google.cloud.vertexai.api.SegmentOrBuilder> + segmentBuilder_; + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the segment field is set. + */ + public boolean hasSegment() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The segment. + */ + public com.google.cloud.vertexai.api.Segment getSegment() { + if (segmentBuilder_ == null) { + return segment_ == null + ? com.google.cloud.vertexai.api.Segment.getDefaultInstance() + : segment_; + } else { + return segmentBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSegment(com.google.cloud.vertexai.api.Segment value) { + if (segmentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + segment_ = value; + } else { + segmentBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSegment(com.google.cloud.vertexai.api.Segment.Builder builderForValue) { + if (segmentBuilder_ == null) { + segment_ = builderForValue.build(); + } else { + segmentBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeSegment(com.google.cloud.vertexai.api.Segment value) { + if (segmentBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && segment_ != null + && segment_ != com.google.cloud.vertexai.api.Segment.getDefaultInstance()) { + getSegmentBuilder().mergeFrom(value); + } else { + segment_ = value; + } + } else { + segmentBuilder_.mergeFrom(value); + } + if (segment_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearSegment() { + bitField0_ = (bitField0_ & ~0x00000002); + segment_ = null; + if (segmentBuilder_ != null) { + segmentBuilder_.dispose(); + segmentBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.vertexai.api.Segment.Builder getSegmentBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getSegmentFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.vertexai.api.SegmentOrBuilder getSegmentOrBuilder() { + if (segmentBuilder_ != null) { + return segmentBuilder_.getMessageOrBuilder(); + } else { + return segment_ == null + ? com.google.cloud.vertexai.api.Segment.getDefaultInstance() + : segment_; + } + } + /** + * + * + *
+     * Output only. Segment of the content this attribution belongs to.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Segment, + com.google.cloud.vertexai.api.Segment.Builder, + com.google.cloud.vertexai.api.SegmentOrBuilder> + getSegmentFieldBuilder() { + if (segmentBuilder_ == null) { + segmentBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Segment, + com.google.cloud.vertexai.api.Segment.Builder, + com.google.cloud.vertexai.api.SegmentOrBuilder>( + getSegment(), getParentForChildren(), isClean()); + segment_ = null; + } + return segmentBuilder_; + } + + private float confidenceScore_; + /** + * + * + *
+     * Optional. Output only. Confidence score of the attribution. Ranges from 0
+     * to 1. 1 is the most confident.
+     * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the confidenceScore field is set. + */ + @java.lang.Override + public boolean hasConfidenceScore() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Optional. Output only. Confidence score of the attribution. Ranges from 0
+     * to 1. 1 is the most confident.
+     * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The confidenceScore. + */ + @java.lang.Override + public float getConfidenceScore() { + return confidenceScore_; + } + /** + * + * + *
+     * Optional. Output only. Confidence score of the attribution. Ranges from 0
+     * to 1. 1 is the most confident.
+     * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The confidenceScore to set. + * @return This builder for chaining. + */ + public Builder setConfidenceScore(float value) { + + confidenceScore_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Output only. Confidence score of the attribution. Ranges from 0
+     * to 1. 1 is the most confident.
+     * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearConfidenceScore() { + bitField0_ = (bitField0_ & ~0x00000004); + confidenceScore_ = 0F; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.GroundingAttribution) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.GroundingAttribution) + private static final com.google.cloud.vertexai.api.GroundingAttribution DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.GroundingAttribution(); + } + + public static com.google.cloud.vertexai.api.GroundingAttribution getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GroundingAttribution parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttributionOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttributionOrBuilder.java new file mode 100644 index 000000000000..3026cd831ec8 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingAttributionOrBuilder.java @@ -0,0 +1,141 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface GroundingAttributionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.GroundingAttribution) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the web field is set. + */ + boolean hasWeb(); + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The web. + */ + com.google.cloud.vertexai.api.GroundingAttribution.Web getWeb(); + /** + * + * + *
+   * Optional. Attribution from the web.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GroundingAttribution.Web web = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.vertexai.api.GroundingAttribution.WebOrBuilder getWebOrBuilder(); + + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the segment field is set. + */ + boolean hasSegment(); + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The segment. + */ + com.google.cloud.vertexai.api.Segment getSegment(); + /** + * + * + *
+   * Output only. Segment of the content this attribution belongs to.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Segment segment = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.vertexai.api.SegmentOrBuilder getSegmentOrBuilder(); + + /** + * + * + *
+   * Optional. Output only. Confidence score of the attribution. Ranges from 0
+   * to 1. 1 is the most confident.
+   * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the confidenceScore field is set. + */ + boolean hasConfidenceScore(); + /** + * + * + *
+   * Optional. Output only. Confidence score of the attribution. Ranges from 0
+   * to 1. 1 is the most confident.
+   * 
+ * + * + * optional float confidence_score = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The confidenceScore. + */ + float getConfidenceScore(); + + com.google.cloud.vertexai.api.GroundingAttribution.ReferenceCase getReferenceCase(); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadata.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadata.java new file mode 100644 index 000000000000..2fcce13b3ba7 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadata.java @@ -0,0 +1,1288 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Metadata returned to client when grounding is enabled.
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingMetadata} + */ +public final class GroundingMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.GroundingMetadata) + GroundingMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use GroundingMetadata.newBuilder() to construct. + private GroundingMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GroundingMetadata() { + webSearchQueries_ = com.google.protobuf.LazyStringArrayList.emptyList(); + groundingAttributions_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GroundingMetadata(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingMetadata.class, + com.google.cloud.vertexai.api.GroundingMetadata.Builder.class); + } + + public static final int WEB_SEARCH_QUERIES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList webSearchQueries_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the webSearchQueries. + */ + public com.google.protobuf.ProtocolStringList getWebSearchQueriesList() { + return webSearchQueries_; + } + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of webSearchQueries. + */ + public int getWebSearchQueriesCount() { + return webSearchQueries_.size(); + } + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The webSearchQueries at the given index. + */ + public java.lang.String getWebSearchQueries(int index) { + return webSearchQueries_.get(index); + } + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the webSearchQueries at the given index. + */ + public com.google.protobuf.ByteString getWebSearchQueriesBytes(int index) { + return webSearchQueries_.getByteString(index); + } + + public static final int GROUNDING_ATTRIBUTIONS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List groundingAttributions_; + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getGroundingAttributionsList() { + return groundingAttributions_; + } + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getGroundingAttributionsOrBuilderList() { + return groundingAttributions_; + } + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getGroundingAttributionsCount() { + return groundingAttributions_.size(); + } + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttribution getGroundingAttributions(int index) { + return groundingAttributions_.get(index); + } + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingAttributionOrBuilder + getGroundingAttributionsOrBuilder(int index) { + return groundingAttributions_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < webSearchQueries_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, webSearchQueries_.getRaw(i)); + } + for (int i = 0; i < groundingAttributions_.size(); i++) { + output.writeMessage(2, groundingAttributions_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < webSearchQueries_.size(); i++) { + dataSize += computeStringSizeNoTag(webSearchQueries_.getRaw(i)); + } + size += dataSize; + size += 1 * getWebSearchQueriesList().size(); + } + for (int i = 0; i < groundingAttributions_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, groundingAttributions_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.GroundingMetadata)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.GroundingMetadata other = + (com.google.cloud.vertexai.api.GroundingMetadata) obj; + + if (!getWebSearchQueriesList().equals(other.getWebSearchQueriesList())) return false; + if (!getGroundingAttributionsList().equals(other.getGroundingAttributionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getWebSearchQueriesCount() > 0) { + hash = (37 * hash) + WEB_SEARCH_QUERIES_FIELD_NUMBER; + hash = (53 * hash) + getWebSearchQueriesList().hashCode(); + } + if (getGroundingAttributionsCount() > 0) { + hash = (37 * hash) + GROUNDING_ATTRIBUTIONS_FIELD_NUMBER; + hash = (53 * hash) + getGroundingAttributionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.GroundingMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata returned to client when grounding is enabled.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.GroundingMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.GroundingMetadata) + com.google.cloud.vertexai.api.GroundingMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.GroundingMetadata.class, + com.google.cloud.vertexai.api.GroundingMetadata.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.GroundingMetadata.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + webSearchQueries_ = com.google.protobuf.LazyStringArrayList.emptyList(); + if (groundingAttributionsBuilder_ == null) { + groundingAttributions_ = java.util.Collections.emptyList(); + } else { + groundingAttributions_ = null; + groundingAttributionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_GroundingMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadata getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadata build() { + com.google.cloud.vertexai.api.GroundingMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadata buildPartial() { + com.google.cloud.vertexai.api.GroundingMetadata result = + new com.google.cloud.vertexai.api.GroundingMetadata(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.vertexai.api.GroundingMetadata result) { + if (groundingAttributionsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + groundingAttributions_ = java.util.Collections.unmodifiableList(groundingAttributions_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.groundingAttributions_ = groundingAttributions_; + } else { + result.groundingAttributions_ = groundingAttributionsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.vertexai.api.GroundingMetadata result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + webSearchQueries_.makeImmutable(); + result.webSearchQueries_ = webSearchQueries_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.GroundingMetadata) { + return mergeFrom((com.google.cloud.vertexai.api.GroundingMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.GroundingMetadata other) { + if (other == com.google.cloud.vertexai.api.GroundingMetadata.getDefaultInstance()) + return this; + if (!other.webSearchQueries_.isEmpty()) { + if (webSearchQueries_.isEmpty()) { + webSearchQueries_ = other.webSearchQueries_; + bitField0_ |= 0x00000001; + } else { + ensureWebSearchQueriesIsMutable(); + webSearchQueries_.addAll(other.webSearchQueries_); + } + onChanged(); + } + if (groundingAttributionsBuilder_ == null) { + if (!other.groundingAttributions_.isEmpty()) { + if (groundingAttributions_.isEmpty()) { + groundingAttributions_ = other.groundingAttributions_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.addAll(other.groundingAttributions_); + } + onChanged(); + } + } else { + if (!other.groundingAttributions_.isEmpty()) { + if (groundingAttributionsBuilder_.isEmpty()) { + groundingAttributionsBuilder_.dispose(); + groundingAttributionsBuilder_ = null; + groundingAttributions_ = other.groundingAttributions_; + bitField0_ = (bitField0_ & ~0x00000002); + groundingAttributionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getGroundingAttributionsFieldBuilder() + : null; + } else { + groundingAttributionsBuilder_.addAllMessages(other.groundingAttributions_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureWebSearchQueriesIsMutable(); + webSearchQueries_.add(s); + break; + } // case 10 + case 18: + { + com.google.cloud.vertexai.api.GroundingAttribution m = + input.readMessage( + com.google.cloud.vertexai.api.GroundingAttribution.parser(), + extensionRegistry); + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.add(m); + } else { + groundingAttributionsBuilder_.addMessage(m); + } + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList webSearchQueries_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureWebSearchQueriesIsMutable() { + if (!webSearchQueries_.isModifiable()) { + webSearchQueries_ = new com.google.protobuf.LazyStringArrayList(webSearchQueries_); + } + bitField0_ |= 0x00000001; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the webSearchQueries. + */ + public com.google.protobuf.ProtocolStringList getWebSearchQueriesList() { + webSearchQueries_.makeImmutable(); + return webSearchQueries_; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of webSearchQueries. + */ + public int getWebSearchQueriesCount() { + return webSearchQueries_.size(); + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The webSearchQueries at the given index. + */ + public java.lang.String getWebSearchQueries(int index) { + return webSearchQueries_.get(index); + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the webSearchQueries at the given index. + */ + public com.google.protobuf.ByteString getWebSearchQueriesBytes(int index) { + return webSearchQueries_.getByteString(index); + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index to set the value at. + * @param value The webSearchQueries to set. + * @return This builder for chaining. + */ + public Builder setWebSearchQueries(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureWebSearchQueriesIsMutable(); + webSearchQueries_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The webSearchQueries to add. + * @return This builder for chaining. + */ + public Builder addWebSearchQueries(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureWebSearchQueriesIsMutable(); + webSearchQueries_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param values The webSearchQueries to add. + * @return This builder for chaining. + */ + public Builder addAllWebSearchQueries(java.lang.Iterable values) { + ensureWebSearchQueriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, webSearchQueries_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearWebSearchQueries() { + webSearchQueries_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Web search queries for the following-up web search.
+     * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The bytes of the webSearchQueries to add. + * @return This builder for chaining. + */ + public Builder addWebSearchQueriesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureWebSearchQueriesIsMutable(); + webSearchQueries_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List + groundingAttributions_ = java.util.Collections.emptyList(); + + private void ensureGroundingAttributionsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + groundingAttributions_ = + new java.util.ArrayList( + groundingAttributions_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution, + com.google.cloud.vertexai.api.GroundingAttribution.Builder, + com.google.cloud.vertexai.api.GroundingAttributionOrBuilder> + groundingAttributionsBuilder_; + + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getGroundingAttributionsList() { + if (groundingAttributionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(groundingAttributions_); + } else { + return groundingAttributionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getGroundingAttributionsCount() { + if (groundingAttributionsBuilder_ == null) { + return groundingAttributions_.size(); + } else { + return groundingAttributionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttribution getGroundingAttributions(int index) { + if (groundingAttributionsBuilder_ == null) { + return groundingAttributions_.get(index); + } else { + return groundingAttributionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGroundingAttributions( + int index, com.google.cloud.vertexai.api.GroundingAttribution value) { + if (groundingAttributionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.set(index, value); + onChanged(); + } else { + groundingAttributionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGroundingAttributions( + int index, com.google.cloud.vertexai.api.GroundingAttribution.Builder builderForValue) { + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.set(index, builderForValue.build()); + onChanged(); + } else { + groundingAttributionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addGroundingAttributions( + com.google.cloud.vertexai.api.GroundingAttribution value) { + if (groundingAttributionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.add(value); + onChanged(); + } else { + groundingAttributionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addGroundingAttributions( + int index, com.google.cloud.vertexai.api.GroundingAttribution value) { + if (groundingAttributionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.add(index, value); + onChanged(); + } else { + groundingAttributionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addGroundingAttributions( + com.google.cloud.vertexai.api.GroundingAttribution.Builder builderForValue) { + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.add(builderForValue.build()); + onChanged(); + } else { + groundingAttributionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addGroundingAttributions( + int index, com.google.cloud.vertexai.api.GroundingAttribution.Builder builderForValue) { + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.add(index, builderForValue.build()); + onChanged(); + } else { + groundingAttributionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllGroundingAttributions( + java.lang.Iterable values) { + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, groundingAttributions_); + onChanged(); + } else { + groundingAttributionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearGroundingAttributions() { + if (groundingAttributionsBuilder_ == null) { + groundingAttributions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + groundingAttributionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeGroundingAttributions(int index) { + if (groundingAttributionsBuilder_ == null) { + ensureGroundingAttributionsIsMutable(); + groundingAttributions_.remove(index); + onChanged(); + } else { + groundingAttributionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttribution.Builder + getGroundingAttributionsBuilder(int index) { + return getGroundingAttributionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttributionOrBuilder + getGroundingAttributionsOrBuilder(int index) { + if (groundingAttributionsBuilder_ == null) { + return groundingAttributions_.get(index); + } else { + return groundingAttributionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getGroundingAttributionsOrBuilderList() { + if (groundingAttributionsBuilder_ != null) { + return groundingAttributionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(groundingAttributions_); + } + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttribution.Builder + addGroundingAttributionsBuilder() { + return getGroundingAttributionsFieldBuilder() + .addBuilder(com.google.cloud.vertexai.api.GroundingAttribution.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GroundingAttribution.Builder + addGroundingAttributionsBuilder(int index) { + return getGroundingAttributionsFieldBuilder() + .addBuilder( + index, com.google.cloud.vertexai.api.GroundingAttribution.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. List of grounding attributions.
+     * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getGroundingAttributionsBuilderList() { + return getGroundingAttributionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution, + com.google.cloud.vertexai.api.GroundingAttribution.Builder, + com.google.cloud.vertexai.api.GroundingAttributionOrBuilder> + getGroundingAttributionsFieldBuilder() { + if (groundingAttributionsBuilder_ == null) { + groundingAttributionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.vertexai.api.GroundingAttribution, + com.google.cloud.vertexai.api.GroundingAttribution.Builder, + com.google.cloud.vertexai.api.GroundingAttributionOrBuilder>( + groundingAttributions_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + groundingAttributions_ = null; + } + return groundingAttributionsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.GroundingMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.GroundingMetadata) + private static final com.google.cloud.vertexai.api.GroundingMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.GroundingMetadata(); + } + + public static com.google.cloud.vertexai.api.GroundingMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GroundingMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.GroundingMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadataOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadataOrBuilder.java new file mode 100644 index 000000000000..f0de898071a9 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GroundingMetadataOrBuilder.java @@ -0,0 +1,140 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface GroundingMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.GroundingMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the webSearchQueries. + */ + java.util.List getWebSearchQueriesList(); + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of webSearchQueries. + */ + int getWebSearchQueriesCount(); + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The webSearchQueries at the given index. + */ + java.lang.String getWebSearchQueries(int index); + /** + * + * + *
+   * Optional. Web search queries for the following-up web search.
+   * 
+ * + * repeated string web_search_queries = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the webSearchQueries at the given index. + */ + com.google.protobuf.ByteString getWebSearchQueriesBytes(int index); + + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getGroundingAttributionsList(); + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.vertexai.api.GroundingAttribution getGroundingAttributions(int index); + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getGroundingAttributionsCount(); + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getGroundingAttributionsOrBuilderList(); + /** + * + * + *
+   * Optional. List of grounding attributions.
+   * 
+ * + * + * repeated .google.cloud.vertexai.v1.GroundingAttribution grounding_attributions = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.vertexai.api.GroundingAttributionOrBuilder getGroundingAttributionsOrBuilder( + int index); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Retrieval.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Retrieval.java new file mode 100644 index 000000000000..771bb31c763d --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Retrieval.java @@ -0,0 +1,916 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Defines a retrieval tool that model can call to access external knowledge.
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.Retrieval} + */ +public final class Retrieval extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.Retrieval) + RetrievalOrBuilder { + private static final long serialVersionUID = 0L; + // Use Retrieval.newBuilder() to construct. + private Retrieval(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Retrieval() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Retrieval(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_Retrieval_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_Retrieval_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.Retrieval.class, + com.google.cloud.vertexai.api.Retrieval.Builder.class); + } + + private int sourceCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object source_; + + public enum SourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + VERTEX_AI_SEARCH(2), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 2: + return VERTEX_AI_SEARCH; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int VERTEX_AI_SEARCH_FIELD_NUMBER = 2; + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return Whether the vertexAiSearch field is set. + */ + @java.lang.Override + public boolean hasVertexAiSearch() { + return sourceCase_ == 2; + } + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return The vertexAiSearch. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch getVertexAiSearch() { + if (sourceCase_ == 2) { + return (com.google.cloud.vertexai.api.VertexAISearch) source_; + } + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearchOrBuilder getVertexAiSearchOrBuilder() { + if (sourceCase_ == 2) { + return (com.google.cloud.vertexai.api.VertexAISearch) source_; + } + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + + public static final int DISABLE_ATTRIBUTION_FIELD_NUMBER = 3; + private boolean disableAttribution_ = false; + /** + * + * + *
+   * Optional. Disable using the result from this tool in detecting grounding
+   * attribution. This does not affect how the result is given to the model for
+   * generation.
+   * 
+ * + * bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + @java.lang.Override + public boolean getDisableAttribution() { + return disableAttribution_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 2) { + output.writeMessage(2, (com.google.cloud.vertexai.api.VertexAISearch) source_); + } + if (disableAttribution_ != false) { + output.writeBool(3, disableAttribution_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.vertexai.api.VertexAISearch) source_); + } + if (disableAttribution_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, disableAttribution_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.Retrieval)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.Retrieval other = (com.google.cloud.vertexai.api.Retrieval) obj; + + if (getDisableAttribution() != other.getDisableAttribution()) return false; + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 2: + if (!getVertexAiSearch().equals(other.getVertexAiSearch())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DISABLE_ATTRIBUTION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisableAttribution()); + switch (sourceCase_) { + case 2: + hash = (37 * hash) + VERTEX_AI_SEARCH_FIELD_NUMBER; + hash = (53 * hash) + getVertexAiSearch().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Retrieval parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Retrieval parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Retrieval parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.Retrieval prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Defines a retrieval tool that model can call to access external knowledge.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.Retrieval} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.Retrieval) + com.google.cloud.vertexai.api.RetrievalOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_Retrieval_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_Retrieval_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.Retrieval.class, + com.google.cloud.vertexai.api.Retrieval.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.Retrieval.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (vertexAiSearchBuilder_ != null) { + vertexAiSearchBuilder_.clear(); + } + disableAttribution_ = false; + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_Retrieval_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Retrieval getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.Retrieval.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Retrieval build() { + com.google.cloud.vertexai.api.Retrieval result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Retrieval buildPartial() { + com.google.cloud.vertexai.api.Retrieval result = + new com.google.cloud.vertexai.api.Retrieval(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.Retrieval result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.disableAttribution_ = disableAttribution_; + } + } + + private void buildPartialOneofs(com.google.cloud.vertexai.api.Retrieval result) { + result.sourceCase_ = sourceCase_; + result.source_ = this.source_; + if (sourceCase_ == 2 && vertexAiSearchBuilder_ != null) { + result.source_ = vertexAiSearchBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.Retrieval) { + return mergeFrom((com.google.cloud.vertexai.api.Retrieval) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.Retrieval other) { + if (other == com.google.cloud.vertexai.api.Retrieval.getDefaultInstance()) return this; + if (other.getDisableAttribution() != false) { + setDisableAttribution(other.getDisableAttribution()); + } + switch (other.getSourceCase()) { + case VERTEX_AI_SEARCH: + { + mergeVertexAiSearch(other.getVertexAiSearch()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + input.readMessage(getVertexAiSearchFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 2; + break; + } // case 18 + case 24: + { + disableAttribution_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.VertexAISearch, + com.google.cloud.vertexai.api.VertexAISearch.Builder, + com.google.cloud.vertexai.api.VertexAISearchOrBuilder> + vertexAiSearchBuilder_; + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return Whether the vertexAiSearch field is set. + */ + @java.lang.Override + public boolean hasVertexAiSearch() { + return sourceCase_ == 2; + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return The vertexAiSearch. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch getVertexAiSearch() { + if (vertexAiSearchBuilder_ == null) { + if (sourceCase_ == 2) { + return (com.google.cloud.vertexai.api.VertexAISearch) source_; + } + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } else { + if (sourceCase_ == 2) { + return vertexAiSearchBuilder_.getMessage(); + } + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + public Builder setVertexAiSearch(com.google.cloud.vertexai.api.VertexAISearch value) { + if (vertexAiSearchBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + vertexAiSearchBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + public Builder setVertexAiSearch( + com.google.cloud.vertexai.api.VertexAISearch.Builder builderForValue) { + if (vertexAiSearchBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + vertexAiSearchBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + public Builder mergeVertexAiSearch(com.google.cloud.vertexai.api.VertexAISearch value) { + if (vertexAiSearchBuilder_ == null) { + if (sourceCase_ == 2 + && source_ != com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance()) { + source_ = + com.google.cloud.vertexai.api.VertexAISearch.newBuilder( + (com.google.cloud.vertexai.api.VertexAISearch) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 2) { + vertexAiSearchBuilder_.mergeFrom(value); + } else { + vertexAiSearchBuilder_.setMessage(value); + } + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + public Builder clearVertexAiSearch() { + if (vertexAiSearchBuilder_ == null) { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + } + vertexAiSearchBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + public com.google.cloud.vertexai.api.VertexAISearch.Builder getVertexAiSearchBuilder() { + return getVertexAiSearchFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearchOrBuilder getVertexAiSearchOrBuilder() { + if ((sourceCase_ == 2) && (vertexAiSearchBuilder_ != null)) { + return vertexAiSearchBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 2) { + return (com.google.cloud.vertexai.api.VertexAISearch) source_; + } + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + } + /** + * + * + *
+     * Set to use data source powered by Vertex AI Search.
+     * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.VertexAISearch, + com.google.cloud.vertexai.api.VertexAISearch.Builder, + com.google.cloud.vertexai.api.VertexAISearchOrBuilder> + getVertexAiSearchFieldBuilder() { + if (vertexAiSearchBuilder_ == null) { + if (!(sourceCase_ == 2)) { + source_ = com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + vertexAiSearchBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.VertexAISearch, + com.google.cloud.vertexai.api.VertexAISearch.Builder, + com.google.cloud.vertexai.api.VertexAISearchOrBuilder>( + (com.google.cloud.vertexai.api.VertexAISearch) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 2; + onChanged(); + return vertexAiSearchBuilder_; + } + + private boolean disableAttribution_; + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + @java.lang.Override + public boolean getDisableAttribution() { + return disableAttribution_; + } + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The disableAttribution to set. + * @return This builder for chaining. + */ + public Builder setDisableAttribution(boolean value) { + + disableAttribution_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Disable using the result from this tool in detecting grounding
+     * attribution. This does not affect how the result is given to the model for
+     * generation.
+     * 
+ * + * bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDisableAttribution() { + bitField0_ = (bitField0_ & ~0x00000002); + disableAttribution_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.Retrieval) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.Retrieval) + private static final com.google.cloud.vertexai.api.Retrieval DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.Retrieval(); + } + + public static com.google.cloud.vertexai.api.Retrieval getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Retrieval parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Retrieval getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/RetrievalOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/RetrievalOrBuilder.java new file mode 100644 index 000000000000..870e53f95b39 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/RetrievalOrBuilder.java @@ -0,0 +1,78 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface RetrievalOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.Retrieval) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return Whether the vertexAiSearch field is set. + */ + boolean hasVertexAiSearch(); + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + * + * @return The vertexAiSearch. + */ + com.google.cloud.vertexai.api.VertexAISearch getVertexAiSearch(); + /** + * + * + *
+   * Set to use data source powered by Vertex AI Search.
+   * 
+ * + * .google.cloud.vertexai.v1.VertexAISearch vertex_ai_search = 2; + */ + com.google.cloud.vertexai.api.VertexAISearchOrBuilder getVertexAiSearchOrBuilder(); + + /** + * + * + *
+   * Optional. Disable using the result from this tool in detecting grounding
+   * attribution. This does not affect how the result is given to the model for
+   * generation.
+   * 
+ * + * bool disable_attribution = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableAttribution. + */ + boolean getDisableAttribution(); + + com.google.cloud.vertexai.api.Retrieval.SourceCase getSourceCase(); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Segment.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Segment.java new file mode 100644 index 000000000000..7b5f519f52a2 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Segment.java @@ -0,0 +1,726 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Segment of the content.
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.Segment} + */ +public final class Segment extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.Segment) + SegmentOrBuilder { + private static final long serialVersionUID = 0L; + // Use Segment.newBuilder() to construct. + private Segment(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Segment() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Segment(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_Segment_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_Segment_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.Segment.class, + com.google.cloud.vertexai.api.Segment.Builder.class); + } + + public static final int PART_INDEX_FIELD_NUMBER = 1; + private int partIndex_ = 0; + /** + * + * + *
+   * Output only. The index of a Part object within its parent Content object.
+   * 
+ * + * int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The partIndex. + */ + @java.lang.Override + public int getPartIndex() { + return partIndex_; + } + + public static final int START_INDEX_FIELD_NUMBER = 2; + private int startIndex_ = 0; + /** + * + * + *
+   * Output only. Start index in the given Part, measured in bytes. Offset from
+   * the start of the Part, inclusive, starting at zero.
+   * 
+ * + * int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startIndex. + */ + @java.lang.Override + public int getStartIndex() { + return startIndex_; + } + + public static final int END_INDEX_FIELD_NUMBER = 3; + private int endIndex_ = 0; + /** + * + * + *
+   * Output only. End index in the given Part, measured in bytes. Offset from
+   * the start of the Part, exclusive, starting at zero.
+   * 
+ * + * int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The endIndex. + */ + @java.lang.Override + public int getEndIndex() { + return endIndex_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (partIndex_ != 0) { + output.writeInt32(1, partIndex_); + } + if (startIndex_ != 0) { + output.writeInt32(2, startIndex_); + } + if (endIndex_ != 0) { + output.writeInt32(3, endIndex_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (partIndex_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, partIndex_); + } + if (startIndex_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, startIndex_); + } + if (endIndex_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, endIndex_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.Segment)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.Segment other = (com.google.cloud.vertexai.api.Segment) obj; + + if (getPartIndex() != other.getPartIndex()) return false; + if (getStartIndex() != other.getStartIndex()) return false; + if (getEndIndex() != other.getEndIndex()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PART_INDEX_FIELD_NUMBER; + hash = (53 * hash) + getPartIndex(); + hash = (37 * hash) + START_INDEX_FIELD_NUMBER; + hash = (53 * hash) + getStartIndex(); + hash = (37 * hash) + END_INDEX_FIELD_NUMBER; + hash = (53 * hash) + getEndIndex(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.Segment parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Segment parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Segment parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.Segment parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.Segment prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Segment of the content.
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.Segment} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.Segment) + com.google.cloud.vertexai.api.SegmentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_Segment_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_Segment_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.Segment.class, + com.google.cloud.vertexai.api.Segment.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.Segment.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + partIndex_ = 0; + startIndex_ = 0; + endIndex_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ContentProto + .internal_static_google_cloud_vertexai_v1_Segment_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Segment getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.Segment.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Segment build() { + com.google.cloud.vertexai.api.Segment result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Segment buildPartial() { + com.google.cloud.vertexai.api.Segment result = + new com.google.cloud.vertexai.api.Segment(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.Segment result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.partIndex_ = partIndex_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.startIndex_ = startIndex_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.endIndex_ = endIndex_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.Segment) { + return mergeFrom((com.google.cloud.vertexai.api.Segment) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.Segment other) { + if (other == com.google.cloud.vertexai.api.Segment.getDefaultInstance()) return this; + if (other.getPartIndex() != 0) { + setPartIndex(other.getPartIndex()); + } + if (other.getStartIndex() != 0) { + setStartIndex(other.getStartIndex()); + } + if (other.getEndIndex() != 0) { + setEndIndex(other.getEndIndex()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + partIndex_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + startIndex_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + endIndex_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int partIndex_; + /** + * + * + *
+     * Output only. The index of a Part object within its parent Content object.
+     * 
+ * + * int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The partIndex. + */ + @java.lang.Override + public int getPartIndex() { + return partIndex_; + } + /** + * + * + *
+     * Output only. The index of a Part object within its parent Content object.
+     * 
+ * + * int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The partIndex to set. + * @return This builder for chaining. + */ + public Builder setPartIndex(int value) { + + partIndex_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The index of a Part object within its parent Content object.
+     * 
+ * + * int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearPartIndex() { + bitField0_ = (bitField0_ & ~0x00000001); + partIndex_ = 0; + onChanged(); + return this; + } + + private int startIndex_; + /** + * + * + *
+     * Output only. Start index in the given Part, measured in bytes. Offset from
+     * the start of the Part, inclusive, starting at zero.
+     * 
+ * + * int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startIndex. + */ + @java.lang.Override + public int getStartIndex() { + return startIndex_; + } + /** + * + * + *
+     * Output only. Start index in the given Part, measured in bytes. Offset from
+     * the start of the Part, inclusive, starting at zero.
+     * 
+ * + * int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The startIndex to set. + * @return This builder for chaining. + */ + public Builder setStartIndex(int value) { + + startIndex_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Start index in the given Part, measured in bytes. Offset from
+     * the start of the Part, inclusive, starting at zero.
+     * 
+ * + * int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearStartIndex() { + bitField0_ = (bitField0_ & ~0x00000002); + startIndex_ = 0; + onChanged(); + return this; + } + + private int endIndex_; + /** + * + * + *
+     * Output only. End index in the given Part, measured in bytes. Offset from
+     * the start of the Part, exclusive, starting at zero.
+     * 
+ * + * int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The endIndex. + */ + @java.lang.Override + public int getEndIndex() { + return endIndex_; + } + /** + * + * + *
+     * Output only. End index in the given Part, measured in bytes. Offset from
+     * the start of the Part, exclusive, starting at zero.
+     * 
+ * + * int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The endIndex to set. + * @return This builder for chaining. + */ + public Builder setEndIndex(int value) { + + endIndex_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. End index in the given Part, measured in bytes. Offset from
+     * the start of the Part, exclusive, starting at zero.
+     * 
+ * + * int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEndIndex() { + bitField0_ = (bitField0_ & ~0x00000004); + endIndex_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.Segment) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.Segment) + private static final com.google.cloud.vertexai.api.Segment DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.Segment(); + } + + public static com.google.cloud.vertexai.api.Segment getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Segment parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.Segment getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/SegmentOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/SegmentOrBuilder.java new file mode 100644 index 000000000000..0ce03d1b4b8f --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/SegmentOrBuilder.java @@ -0,0 +1,67 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/content.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface SegmentOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.Segment) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The index of a Part object within its parent Content object.
+   * 
+ * + * int32 part_index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The partIndex. + */ + int getPartIndex(); + + /** + * + * + *
+   * Output only. Start index in the given Part, measured in bytes. Offset from
+   * the start of the Part, inclusive, starting at zero.
+   * 
+ * + * int32 start_index = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The startIndex. + */ + int getStartIndex(); + + /** + * + * + *
+   * Output only. End index in the given Part, measured in bytes. Offset from
+   * the start of the Part, exclusive, starting at zero.
+   * 
+ * + * int32 end_index = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The endIndex. + */ + int getEndIndex(); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Tool.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Tool.java index 7a48f61b8a09..7ea8a844461e 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Tool.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/Tool.java @@ -27,7 +27,8 @@ * * A `Tool` is a piece of code that enables the system to interact with * external systems to perform an action, or set of actions, outside of - * knowledge and scope of the model. + * knowledge and scope of the model. A Tool object should contain exactly + * one type of Tool. * * * Protobuf type {@code google.cloud.vertexai.v1.Tool} @@ -67,6 +68,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.cloud.vertexai.api.Tool.Builder.class); } + private int bitField0_; public static final int FUNCTION_DECLARATIONS_FIELD_NUMBER = 1; @SuppressWarnings("serial") @@ -185,6 +187,125 @@ public com.google.cloud.vertexai.api.FunctionDeclaration getFunctionDeclarations return functionDeclarations_.get(index); } + public static final int RETRIEVAL_FIELD_NUMBER = 2; + private com.google.cloud.vertexai.api.Retrieval retrieval_; + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the retrieval field is set. + */ + @java.lang.Override + public boolean hasRetrieval() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The retrieval. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.Retrieval getRetrieval() { + return retrieval_ == null + ? com.google.cloud.vertexai.api.Retrieval.getDefaultInstance() + : retrieval_; + } + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.RetrievalOrBuilder getRetrievalOrBuilder() { + return retrieval_ == null + ? com.google.cloud.vertexai.api.Retrieval.getDefaultInstance() + : retrieval_; + } + + public static final int GOOGLE_SEARCH_RETRIEVAL_FIELD_NUMBER = 3; + private com.google.cloud.vertexai.api.GoogleSearchRetrieval googleSearchRetrieval_; + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the googleSearchRetrieval field is set. + */ + @java.lang.Override + public boolean hasGoogleSearchRetrieval() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The googleSearchRetrieval. + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrieval getGoogleSearchRetrieval() { + return googleSearchRetrieval_ == null + ? com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance() + : googleSearchRetrieval_; + } + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder + getGoogleSearchRetrievalOrBuilder() { + return googleSearchRetrieval_ == null + ? com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance() + : googleSearchRetrieval_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -202,6 +323,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < functionDeclarations_.size(); i++) { output.writeMessage(1, functionDeclarations_.get(i)); } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getRetrieval()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getGoogleSearchRetrieval()); + } getUnknownFields().writeTo(output); } @@ -215,6 +342,13 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, functionDeclarations_.get(i)); } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getRetrieval()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(3, getGoogleSearchRetrieval()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -231,6 +365,14 @@ public boolean equals(final java.lang.Object obj) { com.google.cloud.vertexai.api.Tool other = (com.google.cloud.vertexai.api.Tool) obj; if (!getFunctionDeclarationsList().equals(other.getFunctionDeclarationsList())) return false; + if (hasRetrieval() != other.hasRetrieval()) return false; + if (hasRetrieval()) { + if (!getRetrieval().equals(other.getRetrieval())) return false; + } + if (hasGoogleSearchRetrieval() != other.hasGoogleSearchRetrieval()) return false; + if (hasGoogleSearchRetrieval()) { + if (!getGoogleSearchRetrieval().equals(other.getGoogleSearchRetrieval())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -246,6 +388,14 @@ public int hashCode() { hash = (37 * hash) + FUNCTION_DECLARATIONS_FIELD_NUMBER; hash = (53 * hash) + getFunctionDeclarationsList().hashCode(); } + if (hasRetrieval()) { + hash = (37 * hash) + RETRIEVAL_FIELD_NUMBER; + hash = (53 * hash) + getRetrieval().hashCode(); + } + if (hasGoogleSearchRetrieval()) { + hash = (37 * hash) + GOOGLE_SEARCH_RETRIEVAL_FIELD_NUMBER; + hash = (53 * hash) + getGoogleSearchRetrieval().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -353,7 +503,8 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * A `Tool` is a piece of code that enables the system to interact with * external systems to perform an action, or set of actions, outside of - * knowledge and scope of the model. + * knowledge and scope of the model. A Tool object should contain exactly + * one type of Tool. * * * Protobuf type {@code google.cloud.vertexai.v1.Tool} @@ -378,10 +529,21 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.cloud.vertexai.api.Tool.newBuilder() - private Builder() {} + private Builder() { + maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getFunctionDeclarationsFieldBuilder(); + getRetrievalFieldBuilder(); + getGoogleSearchRetrievalFieldBuilder(); + } } @java.lang.Override @@ -395,6 +557,16 @@ public Builder clear() { functionDeclarationsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); + retrieval_ = null; + if (retrievalBuilder_ != null) { + retrievalBuilder_.dispose(); + retrievalBuilder_ = null; + } + googleSearchRetrieval_ = null; + if (googleSearchRetrievalBuilder_ != null) { + googleSearchRetrievalBuilder_.dispose(); + googleSearchRetrievalBuilder_ = null; + } return this; } @@ -443,6 +615,19 @@ private void buildPartialRepeatedFields(com.google.cloud.vertexai.api.Tool resul private void buildPartial0(com.google.cloud.vertexai.api.Tool result) { int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.retrieval_ = retrievalBuilder_ == null ? retrieval_ : retrievalBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.googleSearchRetrieval_ = + googleSearchRetrievalBuilder_ == null + ? googleSearchRetrieval_ + : googleSearchRetrievalBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -517,6 +702,12 @@ public Builder mergeFrom(com.google.cloud.vertexai.api.Tool other) { } } } + if (other.hasRetrieval()) { + mergeRetrieval(other.getRetrieval()); + } + if (other.hasGoogleSearchRetrieval()) { + mergeGoogleSearchRetrieval(other.getGoogleSearchRetrieval()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -557,6 +748,19 @@ public Builder mergeFrom( } break; } // case 10 + case 18: + { + input.readMessage(getRetrievalFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + getGoogleSearchRetrievalFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1102,6 +1306,436 @@ public com.google.cloud.vertexai.api.FunctionDeclaration.Builder addFunctionDecl return functionDeclarationsBuilder_; } + private com.google.cloud.vertexai.api.Retrieval retrieval_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Retrieval, + com.google.cloud.vertexai.api.Retrieval.Builder, + com.google.cloud.vertexai.api.RetrievalOrBuilder> + retrievalBuilder_; + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the retrieval field is set. + */ + public boolean hasRetrieval() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The retrieval. + */ + public com.google.cloud.vertexai.api.Retrieval getRetrieval() { + if (retrievalBuilder_ == null) { + return retrieval_ == null + ? com.google.cloud.vertexai.api.Retrieval.getDefaultInstance() + : retrieval_; + } else { + return retrievalBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setRetrieval(com.google.cloud.vertexai.api.Retrieval value) { + if (retrievalBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + retrieval_ = value; + } else { + retrievalBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setRetrieval(com.google.cloud.vertexai.api.Retrieval.Builder builderForValue) { + if (retrievalBuilder_ == null) { + retrieval_ = builderForValue.build(); + } else { + retrievalBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeRetrieval(com.google.cloud.vertexai.api.Retrieval value) { + if (retrievalBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && retrieval_ != null + && retrieval_ != com.google.cloud.vertexai.api.Retrieval.getDefaultInstance()) { + getRetrievalBuilder().mergeFrom(value); + } else { + retrieval_ = value; + } + } else { + retrievalBuilder_.mergeFrom(value); + } + if (retrieval_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearRetrieval() { + bitField0_ = (bitField0_ & ~0x00000002); + retrieval_ = null; + if (retrievalBuilder_ != null) { + retrievalBuilder_.dispose(); + retrievalBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.Retrieval.Builder getRetrievalBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getRetrievalFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.RetrievalOrBuilder getRetrievalOrBuilder() { + if (retrievalBuilder_ != null) { + return retrievalBuilder_.getMessageOrBuilder(); + } else { + return retrieval_ == null + ? com.google.cloud.vertexai.api.Retrieval.getDefaultInstance() + : retrieval_; + } + } + /** + * + * + *
+     * Optional. System will always execute the provided retrieval tool(s) to get
+     * external knowledge to answer the prompt. Retrieval results are presented to
+     * the model for generation.
+     * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Retrieval, + com.google.cloud.vertexai.api.Retrieval.Builder, + com.google.cloud.vertexai.api.RetrievalOrBuilder> + getRetrievalFieldBuilder() { + if (retrievalBuilder_ == null) { + retrievalBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.Retrieval, + com.google.cloud.vertexai.api.Retrieval.Builder, + com.google.cloud.vertexai.api.RetrievalOrBuilder>( + getRetrieval(), getParentForChildren(), isClean()); + retrieval_ = null; + } + return retrievalBuilder_; + } + + private com.google.cloud.vertexai.api.GoogleSearchRetrieval googleSearchRetrieval_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GoogleSearchRetrieval, + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder, + com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder> + googleSearchRetrievalBuilder_; + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the googleSearchRetrieval field is set. + */ + public boolean hasGoogleSearchRetrieval() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The googleSearchRetrieval. + */ + public com.google.cloud.vertexai.api.GoogleSearchRetrieval getGoogleSearchRetrieval() { + if (googleSearchRetrievalBuilder_ == null) { + return googleSearchRetrieval_ == null + ? com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance() + : googleSearchRetrieval_; + } else { + return googleSearchRetrievalBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGoogleSearchRetrieval( + com.google.cloud.vertexai.api.GoogleSearchRetrieval value) { + if (googleSearchRetrievalBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + googleSearchRetrieval_ = value; + } else { + googleSearchRetrievalBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGoogleSearchRetrieval( + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder builderForValue) { + if (googleSearchRetrievalBuilder_ == null) { + googleSearchRetrieval_ = builderForValue.build(); + } else { + googleSearchRetrievalBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeGoogleSearchRetrieval( + com.google.cloud.vertexai.api.GoogleSearchRetrieval value) { + if (googleSearchRetrievalBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && googleSearchRetrieval_ != null + && googleSearchRetrieval_ + != com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance()) { + getGoogleSearchRetrievalBuilder().mergeFrom(value); + } else { + googleSearchRetrieval_ = value; + } + } else { + googleSearchRetrievalBuilder_.mergeFrom(value); + } + if (googleSearchRetrieval_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearGoogleSearchRetrieval() { + bitField0_ = (bitField0_ & ~0x00000004); + googleSearchRetrieval_ = null; + if (googleSearchRetrievalBuilder_ != null) { + googleSearchRetrievalBuilder_.dispose(); + googleSearchRetrievalBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder + getGoogleSearchRetrievalBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getGoogleSearchRetrievalFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder + getGoogleSearchRetrievalOrBuilder() { + if (googleSearchRetrievalBuilder_ != null) { + return googleSearchRetrievalBuilder_.getMessageOrBuilder(); + } else { + return googleSearchRetrieval_ == null + ? com.google.cloud.vertexai.api.GoogleSearchRetrieval.getDefaultInstance() + : googleSearchRetrieval_; + } + } + /** + * + * + *
+     * Optional. Specialized retrieval tool that is powered by Google search.
+     * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GoogleSearchRetrieval, + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder, + com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder> + getGoogleSearchRetrievalFieldBuilder() { + if (googleSearchRetrievalBuilder_ == null) { + googleSearchRetrievalBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.vertexai.api.GoogleSearchRetrieval, + com.google.cloud.vertexai.api.GoogleSearchRetrieval.Builder, + com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder>( + getGoogleSearchRetrieval(), getParentForChildren(), isClean()); + googleSearchRetrieval_ = null; + } + return googleSearchRetrievalBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolOrBuilder.java index 6faf76400bda..be4c3bd56bfd 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolOrBuilder.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolOrBuilder.java @@ -121,4 +121,92 @@ public interface ToolOrBuilder */ com.google.cloud.vertexai.api.FunctionDeclarationOrBuilder getFunctionDeclarationsOrBuilder( int index); + + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the retrieval field is set. + */ + boolean hasRetrieval(); + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The retrieval. + */ + com.google.cloud.vertexai.api.Retrieval getRetrieval(); + /** + * + * + *
+   * Optional. System will always execute the provided retrieval tool(s) to get
+   * external knowledge to answer the prompt. Retrieval results are presented to
+   * the model for generation.
+   * 
+ * + * + * .google.cloud.vertexai.v1.Retrieval retrieval = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.vertexai.api.RetrievalOrBuilder getRetrievalOrBuilder(); + + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the googleSearchRetrieval field is set. + */ + boolean hasGoogleSearchRetrieval(); + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The googleSearchRetrieval. + */ + com.google.cloud.vertexai.api.GoogleSearchRetrieval getGoogleSearchRetrieval(); + /** + * + * + *
+   * Optional. Specialized retrieval tool that is powered by Google search.
+   * 
+ * + * + * .google.cloud.vertexai.v1.GoogleSearchRetrieval google_search_retrieval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.vertexai.api.GoogleSearchRetrievalOrBuilder getGoogleSearchRetrievalOrBuilder(); } diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolProto.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolProto.java index a97321f4b8eb..cebd5978d231 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolProto.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/ToolProto.java @@ -44,6 +44,18 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_vertexai_v1_FunctionResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_vertexai_v1_FunctionResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_Retrieval_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_Retrieval_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_VertexAISearch_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -53,25 +65,41 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { - "\n#google/cloud/vertexai/v1/tool.proto\022\030g" + "\n" + + "#google/cloud/vertexai/v1/tool.proto\022\030g" + "oogle.cloud.vertexai.v1\032\037google/api/fiel" + "d_behavior.proto\032&google/cloud/vertexai/" - + "v1/openapi.proto\032\034google/protobuf/struct" - + ".proto\"Y\n\004Tool\022Q\n\025function_declarations\030" - + "\001 \003(\0132-.google.cloud.vertexai.v1.Functio" - + "nDeclarationB\003\340A\001\"}\n\023FunctionDeclaration" - + "\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\030\n\013description\030\002 \001(\t" - + "B\003\340A\001\0229\n\nparameters\030\003 \001(\0132 .google.cloud" - + ".vertexai.v1.SchemaB\003\340A\001\"M\n\014FunctionCall" - + "\022\021\n\004name\030\001 \001(\tB\003\340A\002\022*\n\004args\030\002 \001(\0132\027.goog" - + "le.protobuf.StructB\003\340A\001\"U\n\020FunctionRespo" - + "nse\022\021\n\004name\030\001 \001(\tB\003\340A\002\022.\n\010response\030\002 \001(\013" - + "2\027.google.protobuf.StructB\003\340A\002B\306\001\n\035com.g" - + "oogle.cloud.vertexai.apiB\tToolProtoP\001Z>c" - + "loud.google.com/go/aiplatform/apiv1/aipl" - + "atformpb;aiplatformpb\252\002\032Google.Cloud.AIP" - + "latform.V1\312\002\032Google\\Cloud\\AIPlatform\\V1\352" - + "\002\035Google::Cloud::AIPlatform::V1b\006proto3" + + "v1/openapi.proto\032\034google/protobuf/struct.proto\"\355\001\n" + + "\004Tool\022Q\n" + + "\025function_declarations\030\001" + + " \003(\0132-.google.cloud.vertexai.v1.FunctionDeclarationB\003\340A\001\022;\n" + + "\tretrieval\030\002 \001(\0132#." + + "google.cloud.vertexai.v1.RetrievalB\003\340A\001\022U\n" + + "\027google_search_retrieval\030\003 \001(\0132/.googl" + + "e.cloud.vertexai.v1.GoogleSearchRetrievalB\003\340A\001\"}\n" + + "\023FunctionDeclaration\022\021\n" + + "\004name\030\001 \001(\tB\003\340A\002\022\030\n" + + "\013description\030\002 \001(\tB\003\340A\001\0229\n\n" + + "parameters\030\003 \001(\0132 .google.cloud.vertexai.v1.SchemaB\003\340A\001\"M\n" + + "\014FunctionCall\022\021\n" + + "\004name\030\001 \001(\tB\003\340A\002\022*\n" + + "\004args\030\002 \001(\0132\027.google.protobuf.StructB\003\340A\001\"U\n" + + "\020FunctionResponse\022\021\n" + + "\004name\030\001 \001(\tB\003\340A\002\022.\n" + + "\010response\030\002 \001(\0132\027.google.protobuf.StructB\003\340A\002\"}\n" + + "\tRetrieval\022D\n" + + "\020vertex_ai_search\030\002" + + " \001(\0132(.google.cloud.vertexai.v1.VertexAISearchH\000\022 \n" + + "\023disable_attribution\030\003 \001(\010B\003\340A\001B\010\n" + + "\006source\"(\n" + + "\016VertexAISearch\022\026\n" + + "\tdatastore\030\001 \001(\tB\003\340A\002\"9\n" + + "\025GoogleSearchRetrieval\022 \n" + + "\023disable_attribution\030\001 \001(\010B\003\340A\001B\306\001\n" + + "\035com.google.cloud.vertexai.apiB\tToolProtoP\001Z>cloud.google.com/go/aipl" + + "atform/apiv1/aiplatformpb;aiplatformpb\252\002" + + "\032Google.Cloud.AIPlatform.V1\312\002\032Google\\Clo" + + "ud\\AIPlatform\\V1\352\002\035Google::Cloud::AIPlatform::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -87,7 +115,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_vertexai_v1_Tool_descriptor, new java.lang.String[] { - "FunctionDeclarations", + "FunctionDeclarations", "Retrieval", "GoogleSearchRetrieval", }); internal_static_google_cloud_vertexai_v1_FunctionDeclaration_descriptor = getDescriptor().getMessageTypes().get(1); @@ -113,6 +141,30 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Name", "Response", }); + internal_static_google_cloud_vertexai_v1_Retrieval_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_vertexai_v1_Retrieval_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_Retrieval_descriptor, + new java.lang.String[] { + "VertexAiSearch", "DisableAttribution", "Source", + }); + internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_vertexai_v1_VertexAISearch_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor, + new java.lang.String[] { + "Datastore", + }); + internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_vertexai_v1_GoogleSearchRetrieval_descriptor, + new java.lang.String[] { + "DisableAttribution", + }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearch.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearch.java new file mode 100644 index 000000000000..def8d04e4551 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearch.java @@ -0,0 +1,633 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +/** + * + * + *
+ * Retrieve from Vertex AI Search datastore for grounding.
+ * See https://cloud.google.com/vertex-ai-search-and-conversation
+ * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.VertexAISearch} + */ +public final class VertexAISearch extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.vertexai.v1.VertexAISearch) + VertexAISearchOrBuilder { + private static final long serialVersionUID = 0L; + // Use VertexAISearch.newBuilder() to construct. + private VertexAISearch(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private VertexAISearch() { + datastore_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new VertexAISearch(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_VertexAISearch_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.VertexAISearch.class, + com.google.cloud.vertexai.api.VertexAISearch.Builder.class); + } + + public static final int DATASTORE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object datastore_ = ""; + /** + * + * + *
+   * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+   * projects/<>/locations/<>/collections/<>/dataStores/<>
+   * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datastore. + */ + @java.lang.Override + public java.lang.String getDatastore() { + java.lang.Object ref = datastore_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + datastore_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+   * projects/<>/locations/<>/collections/<>/dataStores/<>
+   * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datastore. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDatastoreBytes() { + java.lang.Object ref = datastore_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + datastore_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(datastore_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, datastore_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(datastore_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, datastore_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.vertexai.api.VertexAISearch)) { + return super.equals(obj); + } + com.google.cloud.vertexai.api.VertexAISearch other = + (com.google.cloud.vertexai.api.VertexAISearch) obj; + + if (!getDatastore().equals(other.getDatastore())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DATASTORE_FIELD_NUMBER; + hash = (53 * hash) + getDatastore().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.vertexai.api.VertexAISearch parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.vertexai.api.VertexAISearch prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Retrieve from Vertex AI Search datastore for grounding.
+   * See https://cloud.google.com/vertex-ai-search-and-conversation
+   * 
+ * + * Protobuf type {@code google.cloud.vertexai.v1.VertexAISearch} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.vertexai.v1.VertexAISearch) + com.google.cloud.vertexai.api.VertexAISearchOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_VertexAISearch_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.vertexai.api.VertexAISearch.class, + com.google.cloud.vertexai.api.VertexAISearch.Builder.class); + } + + // Construct using com.google.cloud.vertexai.api.VertexAISearch.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + datastore_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.vertexai.api.ToolProto + .internal_static_google_cloud_vertexai_v1_VertexAISearch_descriptor; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch getDefaultInstanceForType() { + return com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch build() { + com.google.cloud.vertexai.api.VertexAISearch result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch buildPartial() { + com.google.cloud.vertexai.api.VertexAISearch result = + new com.google.cloud.vertexai.api.VertexAISearch(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.vertexai.api.VertexAISearch result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.datastore_ = datastore_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.vertexai.api.VertexAISearch) { + return mergeFrom((com.google.cloud.vertexai.api.VertexAISearch) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.vertexai.api.VertexAISearch other) { + if (other == com.google.cloud.vertexai.api.VertexAISearch.getDefaultInstance()) return this; + if (!other.getDatastore().isEmpty()) { + datastore_ = other.datastore_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + datastore_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object datastore_ = ""; + /** + * + * + *
+     * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+     * projects/<>/locations/<>/collections/<>/dataStores/<>
+     * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datastore. + */ + public java.lang.String getDatastore() { + java.lang.Object ref = datastore_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + datastore_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+     * projects/<>/locations/<>/collections/<>/dataStores/<>
+     * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datastore. + */ + public com.google.protobuf.ByteString getDatastoreBytes() { + java.lang.Object ref = datastore_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + datastore_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+     * projects/<>/locations/<>/collections/<>/dataStores/<>
+     * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The datastore to set. + * @return This builder for chaining. + */ + public Builder setDatastore(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + datastore_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+     * projects/<>/locations/<>/collections/<>/dataStores/<>
+     * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDatastore() { + datastore_ = getDefaultInstance().getDatastore(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+     * projects/<>/locations/<>/collections/<>/dataStores/<>
+     * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for datastore to set. + * @return This builder for chaining. + */ + public Builder setDatastoreBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + datastore_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.vertexai.v1.VertexAISearch) + } + + // @@protoc_insertion_point(class_scope:google.cloud.vertexai.v1.VertexAISearch) + private static final com.google.cloud.vertexai.api.VertexAISearch DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.vertexai.api.VertexAISearch(); + } + + public static com.google.cloud.vertexai.api.VertexAISearch getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public VertexAISearch parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.vertexai.api.VertexAISearch getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearchOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearchOrBuilder.java new file mode 100644 index 000000000000..0966d74e9e57 --- /dev/null +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/VertexAISearchOrBuilder.java @@ -0,0 +1,53 @@ +/* + * Copyright 2024 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/vertexai/v1/tool.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.vertexai.api; + +public interface VertexAISearchOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.vertexai.v1.VertexAISearch) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+   * projects/<>/locations/<>/collections/<>/dataStores/<>
+   * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The datastore. + */ + java.lang.String getDatastore(); + /** + * + * + *
+   * Required. Fully-qualified Vertex AI Search's datastore resource ID.
+   * projects/<>/locations/<>/collections/<>/dataStores/<>
+   * 
+ * + * string datastore = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for datastore. + */ + com.google.protobuf.ByteString getDatastoreBytes(); +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/content.proto b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/content.proto index 58d7e2b0bfe9..fa61f0e57f7c 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/content.proto +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/content.proto @@ -291,4 +291,60 @@ message Candidate { // Output only. Source attribution of the generated content. CitationMetadata citation_metadata = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Metadata specifies sources used to ground generated content. + GroundingMetadata grounding_metadata = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Segment of the content. +message Segment { + // Output only. The index of a Part object within its parent Content object. + int32 part_index = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Start index in the given Part, measured in bytes. Offset from + // the start of the Part, inclusive, starting at zero. + int32 start_index = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. End index in the given Part, measured in bytes. Offset from + // the start of the Part, exclusive, starting at zero. + int32 end_index = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Grounding attribution. +message GroundingAttribution { + // Attribution from the web. + message Web { + // Output only. URI reference of the attribution. + string uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Title of the attribution. + string title = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + oneof reference { + // Optional. Attribution from the web. + Web web = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. Segment of the content this attribution belongs to. + Segment segment = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. Confidence score of the attribution. Ranges from 0 + // to 1. 1 is the most confident. + optional float confidence_score = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; +} + +// Metadata returned to client when grounding is enabled. +message GroundingMetadata { + // Optional. Web search queries for the following-up web search. + repeated string web_search_queries = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of grounding attributions. + repeated GroundingAttribution grounding_attributions = 2 + [(google.api.field_behavior) = OPTIONAL]; } diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/tool.proto b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/tool.proto index 942fa681d041..08b7dddb6c8d 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/tool.proto +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/tool.proto @@ -32,7 +32,8 @@ option ruby_package = "Google::Cloud::AIPlatform::V1"; // // A `Tool` is a piece of code that enables the system to interact with // external systems to perform an action, or set of actions, outside of -// knowledge and scope of the model. +// knowledge and scope of the model. A Tool object should contain exactly +// one type of Tool. message Tool { // Optional. One or more function declarations to be passed to the model along // with the current user query. Model may decide to call a subset of these @@ -44,6 +45,15 @@ message Tool { // provided. repeated FunctionDeclaration function_declarations = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. System will always execute the provided retrieval tool(s) to get + // external knowledge to answer the prompt. Retrieval results are presented to + // the model for generation. + Retrieval retrieval = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specialized retrieval tool that is powered by Google search. + GoogleSearchRetrieval google_search_retrieval = 3 + [(google.api.field_behavior) = OPTIONAL]; } // Structured representation of a function declaration as defined by the @@ -102,3 +112,32 @@ message FunctionResponse { // Required. The function response in JSON object format. google.protobuf.Struct response = 2 [(google.api.field_behavior) = REQUIRED]; } + +// Defines a retrieval tool that model can call to access external knowledge. +message Retrieval { + oneof source { + // Set to use data source powered by Vertex AI Search. + VertexAISearch vertex_ai_search = 2; + } + + // Optional. Disable using the result from this tool in detecting grounding + // attribution. This does not affect how the result is given to the model for + // generation. + bool disable_attribution = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Retrieve from Vertex AI Search datastore for grounding. +// See https://cloud.google.com/vertex-ai-search-and-conversation +message VertexAISearch { + // Required. Fully-qualified Vertex AI Search's datastore resource ID. + // projects/<>/locations/<>/collections/<>/dataStores/<> + string datastore = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Tool to retrieve public web data for grounding, powered by Google. +message GoogleSearchRetrieval { + // Optional. Disable using the result from this tool in detecting grounding + // attribution. This does not affect how the result is given to the model for + // generation. + bool disable_attribution = 1 [(google.api.field_behavior) = OPTIONAL]; +}