From 4767ab5a6822c43b54d8c70b4afc6f8b4b9488bd Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 20 Oct 2026 09:52:55 -0700 Subject: [PATCH] feat: update discovery doc PiperOrigin-RevId: 1003180656 --- .../cloud/agentplatform/types/Citation.java | 201 ++++++++ .../agentplatform/types/CitationMetadata.java | 108 +++++ .../agentplatform/types/EventMetadata.java | 10 + .../agentplatform/types/GoogleTypeDate.java | 138 ++++++ .../agentplatform/types/GroundingChunk.java | 202 ++++++++ .../types/GroundingChunkImage.java | 151 ++++++ .../types/GroundingChunkMaps.java | 228 +++++++++ .../GroundingChunkMapsPlaceAnswerSources.java | 119 +++++ ...nkMapsPlaceAnswerSourcesReviewSnippet.java | 129 +++++ .../types/GroundingChunkMapsRoute.java | 130 +++++ .../types/GroundingChunkRetrievedContext.java | 195 ++++++++ .../types/GroundingChunkWeb.java | 133 ++++++ .../types/GroundingMetadata.java | 450 ++++++++++++++++++ .../GroundingMetadataSourceFlaggingUri.java | 109 +++++ .../agentplatform/types/GroundingSupport.java | 221 +++++++++ .../cloud/agentplatform/types/RagChunk.java | 157 ++++++ .../agentplatform/types/RagChunkPageSpan.java | 103 ++++ .../types/RetrievalMetadata.java | 96 ++++ .../SchemaPromptSpecContentMetadata.java | 125 +++++ .../agentplatform/types/SearchEntryPoint.java | 117 +++++ .../cloud/agentplatform/types/Segment.java | 163 +++++++ 21 files changed, 3285 insertions(+) create mode 100644 src/main/java/com/google/cloud/agentplatform/types/Citation.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/CitationMetadata.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GoogleTypeDate.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunk.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkImage.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMaps.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSources.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsRoute.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkRetrievedContext.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingChunkWeb.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingMetadata.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingMetadataSourceFlaggingUri.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/GroundingSupport.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/RagChunk.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/RagChunkPageSpan.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/RetrievalMetadata.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/SchemaPromptSpecContentMetadata.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/SearchEntryPoint.java create mode 100644 src/main/java/com/google/cloud/agentplatform/types/Segment.java diff --git a/src/main/java/com/google/cloud/agentplatform/types/Citation.java b/src/main/java/com/google/cloud/agentplatform/types/Citation.java new file mode 100644 index 0000000..767bfb7 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/Citation.java @@ -0,0 +1,201 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A citation for a piece of generatedcontent. */ +@AutoValue +@JsonDeserialize(builder = Citation.Builder.class) +public abstract class Citation extends JsonSerializable { + /** Output only. The end index of the citation in the content. */ + @JsonProperty("endIndex") + public abstract Optional endIndex(); + + /** Output only. The license of the source of the citation. */ + @JsonProperty("license") + public abstract Optional license(); + + /** Output only. The publication date of the source of the citation. */ + @JsonProperty("publicationDate") + public abstract Optional publicationDate(); + + /** Output only. The start index of the citation in the content. */ + @JsonProperty("startIndex") + public abstract Optional startIndex(); + + /** Output only. The title of the source of the citation. */ + @JsonProperty("title") + public abstract Optional title(); + + /** Output only. The URI of the source of the citation. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for Citation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Citation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Citation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Citation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Citation.Builder(); + } + + /** + * Setter for endIndex. + * + *

endIndex: Output only. The end index of the citation in the content. + */ + @JsonProperty("endIndex") + public abstract Builder endIndex(Integer endIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endIndex(Optional endIndex); + + /** Clears the value of endIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndIndex() { + return endIndex(Optional.empty()); + } + + /** + * Setter for license. + * + *

license: Output only. The license of the source of the citation. + */ + @JsonProperty("license") + public abstract Builder license(String license); + + @ExcludeFromGeneratedCoverageReport + abstract Builder license(Optional license); + + /** Clears the value of license field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLicense() { + return license(Optional.empty()); + } + + /** + * Setter for publicationDate. + * + *

publicationDate: Output only. The publication date of the source of the citation. + */ + @JsonProperty("publicationDate") + public abstract Builder publicationDate(GoogleTypeDate publicationDate); + + /** + * Setter for publicationDate builder. + * + *

publicationDate: Output only. The publication date of the source of the citation. + */ + @CanIgnoreReturnValue + public Builder publicationDate(GoogleTypeDate.Builder publicationDateBuilder) { + return publicationDate(publicationDateBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder publicationDate(Optional publicationDate); + + /** Clears the value of publicationDate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPublicationDate() { + return publicationDate(Optional.empty()); + } + + /** + * Setter for startIndex. + * + *

startIndex: Output only. The start index of the citation in the content. + */ + @JsonProperty("startIndex") + public abstract Builder startIndex(Integer startIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startIndex(Optional startIndex); + + /** Clears the value of startIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartIndex() { + return startIndex(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: Output only. The title of the source of the citation. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + /** + * Setter for uri. + * + *

uri: Output only. The URI of the source of the citation. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + public abstract Citation build(); + } + + /** Deserializes a JSON string to a Citation object. */ + @ExcludeFromGeneratedCoverageReport + public static Citation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Citation.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/CitationMetadata.java b/src/main/java/com/google/cloud/agentplatform/types/CitationMetadata.java new file mode 100644 index 0000000..f9c845b --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/CitationMetadata.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A collection of citations that apply to a piece of generated content. */ +@AutoValue +@JsonDeserialize(builder = CitationMetadata.Builder.class) +public abstract class CitationMetadata extends JsonSerializable { + /** Output only. A list of citations for the content. */ + @JsonProperty("citations") + public abstract Optional> citations(); + + /** Instantiates a builder for CitationMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CitationMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CitationMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CitationMetadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CitationMetadata.Builder(); + } + + /** + * Setter for citations. + * + *

citations: Output only. A list of citations for the content. + */ + @JsonProperty("citations") + public abstract Builder citations(List citations); + + /** + * Setter for citations. + * + *

citations: Output only. A list of citations for the content. + */ + @CanIgnoreReturnValue + public Builder citations(Citation... citations) { + return citations(Arrays.asList(citations)); + } + + /** + * Setter for citations builder. + * + *

citations: Output only. A list of citations for the content. + */ + @CanIgnoreReturnValue + public Builder citations(Citation.Builder... citationsBuilders) { + return citations( + Arrays.asList(citationsBuilders).stream() + .map(Citation.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder citations(Optional> citations); + + /** Clears the value of citations field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCitations() { + return citations(Optional.empty()); + } + + public abstract CitationMetadata build(); + } + + /** Deserializes a JSON string to a CitationMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static CitationMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CitationMetadata.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/EventMetadata.java b/src/main/java/com/google/cloud/agentplatform/types/EventMetadata.java index 315465d..2565d45 100644 --- a/src/main/java/com/google/cloud/agentplatform/types/EventMetadata.java +++ b/src/main/java/com/google/cloud/agentplatform/types/EventMetadata.java @@ -113,6 +113,16 @@ private static Builder create() { @JsonProperty("groundingMetadata") public abstract Builder groundingMetadata(GroundingMetadata groundingMetadata); + /** + * Setter for groundingMetadata builder. + * + *

groundingMetadata: Optional. Metadata returned to client when grounding is enabled. + */ + @CanIgnoreReturnValue + public Builder groundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder) { + return groundingMetadata(groundingMetadataBuilder.build()); + } + @ExcludeFromGeneratedCoverageReport abstract Builder groundingMetadata(Optional groundingMetadata); diff --git a/src/main/java/com/google/cloud/agentplatform/types/GoogleTypeDate.java b/src/main/java/com/google/cloud/agentplatform/types/GoogleTypeDate.java new file mode 100644 index 0000000..0d412bc --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GoogleTypeDate.java @@ -0,0 +1,138 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone + * are either specified elsewhere or are insignificant. The date is relative to the Gregorian + * Calendar. This can represent one of the following: * A full date, with non-zero year, month, and + * day values. * A month and day, with a zero year (for example, an anniversary). * A year on its + * own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit + * card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * + * google.protobuf.Timestamp + */ +@AutoValue +@JsonDeserialize(builder = GoogleTypeDate.Builder.class) +public abstract class GoogleTypeDate extends JsonSerializable { + /** + * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year + * by itself or a year and month where the day isn't significant. + */ + @JsonProperty("day") + public abstract Optional day(); + + /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ + @JsonProperty("month") + public abstract Optional month(); + + /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ + @JsonProperty("year") + public abstract Optional year(); + + /** Instantiates a builder for GoogleTypeDate. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GoogleTypeDate.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GoogleTypeDate. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GoogleTypeDate.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GoogleTypeDate.Builder(); + } + + /** + * Setter for day. + * + *

day: Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to + * specify a year by itself or a year and month where the day isn't significant. + */ + @JsonProperty("day") + public abstract Builder day(Integer day); + + @ExcludeFromGeneratedCoverageReport + abstract Builder day(Optional day); + + /** Clears the value of day field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDay() { + return day(Optional.empty()); + } + + /** + * Setter for month. + * + *

month: Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and + * day. + */ + @JsonProperty("month") + public abstract Builder month(Integer month); + + @ExcludeFromGeneratedCoverageReport + abstract Builder month(Optional month); + + /** Clears the value of month field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMonth() { + return month(Optional.empty()); + } + + /** + * Setter for year. + * + *

year: Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. + */ + @JsonProperty("year") + public abstract Builder year(Integer year); + + @ExcludeFromGeneratedCoverageReport + abstract Builder year(Optional year); + + /** Clears the value of year field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearYear() { + return year(Optional.empty()); + } + + public abstract GoogleTypeDate build(); + } + + /** Deserializes a JSON string to a GoogleTypeDate object. */ + @ExcludeFromGeneratedCoverageReport + public static GoogleTypeDate fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GoogleTypeDate.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunk.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunk.java new file mode 100644 index 0000000..0ae7bc9 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunk.java @@ -0,0 +1,202 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * A piece of evidence that supports a claim made by the model. This is used to show a citation for + * a claim made by the model. When grounding is enabled, the model returns a `GroundingChunk` that + * contains a reference to the source of the information. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunk.Builder.class) +public abstract class GroundingChunk extends JsonSerializable { + /** A grounding chunk from an image search result. See the `Image` message for details. */ + @JsonProperty("image") + public abstract Optional image(); + + /** A grounding chunk from Google Maps. See the `Maps` message for details. */ + @JsonProperty("maps") + public abstract Optional maps(); + + /** + * A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. + * See the `RetrievedContext` message for details + */ + @JsonProperty("retrievedContext") + public abstract Optional retrievedContext(); + + /** + * A grounding chunk from a web page, typically from Google Search. See the `Web` message for + * details. + */ + @JsonProperty("web") + public abstract Optional web(); + + /** Instantiates a builder for GroundingChunk. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunk.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunk. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunk.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunk.Builder(); + } + + /** + * Setter for image. + * + *

image: A grounding chunk from an image search result. See the `Image` message for details. + */ + @JsonProperty("image") + public abstract Builder image(GroundingChunkImage image); + + /** + * Setter for image builder. + * + *

image: A grounding chunk from an image search result. See the `Image` message for details. + */ + @CanIgnoreReturnValue + public Builder image(GroundingChunkImage.Builder imageBuilder) { + return image(imageBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder image(Optional image); + + /** Clears the value of image field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImage() { + return image(Optional.empty()); + } + + /** + * Setter for maps. + * + *

maps: A grounding chunk from Google Maps. See the `Maps` message for details. + */ + @JsonProperty("maps") + public abstract Builder maps(GroundingChunkMaps maps); + + /** + * Setter for maps builder. + * + *

maps: A grounding chunk from Google Maps. See the `Maps` message for details. + */ + @CanIgnoreReturnValue + public Builder maps(GroundingChunkMaps.Builder mapsBuilder) { + return maps(mapsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder maps(Optional maps); + + /** Clears the value of maps field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaps() { + return maps(Optional.empty()); + } + + /** + * Setter for retrievedContext. + * + *

retrievedContext: A grounding chunk from a data source retrieved by a retrieval tool, such + * as Vertex AI Search. See the `RetrievedContext` message for details + */ + @JsonProperty("retrievedContext") + public abstract Builder retrievedContext(GroundingChunkRetrievedContext retrievedContext); + + /** + * Setter for retrievedContext builder. + * + *

retrievedContext: A grounding chunk from a data source retrieved by a retrieval tool, such + * as Vertex AI Search. See the `RetrievedContext` message for details + */ + @CanIgnoreReturnValue + public Builder retrievedContext( + GroundingChunkRetrievedContext.Builder retrievedContextBuilder) { + return retrievedContext(retrievedContextBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievedContext(Optional retrievedContext); + + /** Clears the value of retrievedContext field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievedContext() { + return retrievedContext(Optional.empty()); + } + + /** + * Setter for web. + * + *

web: A grounding chunk from a web page, typically from Google Search. See the `Web` + * message for details. + */ + @JsonProperty("web") + public abstract Builder web(GroundingChunkWeb web); + + /** + * Setter for web builder. + * + *

web: A grounding chunk from a web page, typically from Google Search. See the `Web` + * message for details. + */ + @CanIgnoreReturnValue + public Builder web(GroundingChunkWeb.Builder webBuilder) { + return web(webBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder web(Optional web); + + /** Clears the value of web field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWeb() { + return web(Optional.empty()); + } + + public abstract GroundingChunk build(); + } + + /** Deserializes a JSON string to a GroundingChunk object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunk fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunk.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkImage.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkImage.java new file mode 100644 index 0000000..158f9a2 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkImage.java @@ -0,0 +1,151 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * An `Image` chunk is a piece of evidence that comes from an image search result. It contains the + * URI of the image search result and the URI of the image. This is used to provide the user with a + * link to the source of the information. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkImage.Builder.class) +public abstract class GroundingChunkImage extends JsonSerializable { + /** The domain of the image search result page. */ + @JsonProperty("domain") + public abstract Optional domain(); + + /** The URI of the image. */ + @JsonProperty("imageUri") + public abstract Optional imageUri(); + + /** The URI of the image search result page. */ + @JsonProperty("sourceUri") + public abstract Optional sourceUri(); + + /** The title of the image search result page. */ + @JsonProperty("title") + public abstract Optional title(); + + /** Instantiates a builder for GroundingChunkImage. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkImage.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkImage. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunkImage.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkImage.Builder(); + } + + /** + * Setter for domain. + * + *

domain: The domain of the image search result page. + */ + @JsonProperty("domain") + public abstract Builder domain(String domain); + + @ExcludeFromGeneratedCoverageReport + abstract Builder domain(Optional domain); + + /** Clears the value of domain field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDomain() { + return domain(Optional.empty()); + } + + /** + * Setter for imageUri. + * + *

imageUri: The URI of the image. + */ + @JsonProperty("imageUri") + public abstract Builder imageUri(String imageUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder imageUri(Optional imageUri); + + /** Clears the value of imageUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImageUri() { + return imageUri(Optional.empty()); + } + + /** + * Setter for sourceUri. + * + *

sourceUri: The URI of the image search result page. + */ + @JsonProperty("sourceUri") + public abstract Builder sourceUri(String sourceUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceUri(Optional sourceUri); + + /** Clears the value of sourceUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceUri() { + return sourceUri(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: The title of the image search result page. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + public abstract GroundingChunkImage build(); + } + + /** Deserializes a JSON string to a GroundingChunkImage object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkImage fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkImage.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMaps.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMaps.java new file mode 100644 index 0000000..df4efc4 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMaps.java @@ -0,0 +1,228 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * A `Maps` chunk is a piece of evidence that comes from Google Maps, containing information about + * places or routes. This is used to provide the user with rich, location-based information. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMaps.Builder.class) +public abstract class GroundingChunkMaps extends JsonSerializable { + /** + * The sources that were used to generate the place answer. This includes review snippets and + * photos that were used to generate the answer, as well as URIs to flag content. + */ + @JsonProperty("placeAnswerSources") + public abstract Optional placeAnswerSources(); + + /** + * This Place's resource name, in `places/{place_id}` format. This can be used to look up the + * place in the Google Maps API. + */ + @JsonProperty("placeId") + public abstract Optional placeId(); + + /** Output only. Route information. */ + @JsonProperty("route") + public abstract Optional route(); + + /** The text of the place answer. */ + @JsonProperty("text") + public abstract Optional text(); + + /** The title of the place. */ + @JsonProperty("title") + public abstract Optional title(); + + /** The URI of the place. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for GroundingChunkMaps. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkMaps.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMaps. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunkMaps.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMaps.Builder(); + } + + /** + * Setter for placeAnswerSources. + * + *

placeAnswerSources: The sources that were used to generate the place answer. This includes + * review snippets and photos that were used to generate the answer, as well as URIs to flag + * content. + */ + @JsonProperty("placeAnswerSources") + public abstract Builder placeAnswerSources( + GroundingChunkMapsPlaceAnswerSources placeAnswerSources); + + /** + * Setter for placeAnswerSources builder. + * + *

placeAnswerSources: The sources that were used to generate the place answer. This includes + * review snippets and photos that were used to generate the answer, as well as URIs to flag + * content. + */ + @CanIgnoreReturnValue + public Builder placeAnswerSources( + GroundingChunkMapsPlaceAnswerSources.Builder placeAnswerSourcesBuilder) { + return placeAnswerSources(placeAnswerSourcesBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder placeAnswerSources( + Optional placeAnswerSources); + + /** Clears the value of placeAnswerSources field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPlaceAnswerSources() { + return placeAnswerSources(Optional.empty()); + } + + /** + * Setter for placeId. + * + *

placeId: This Place's resource name, in `places/{place_id}` format. This can be used to + * look up the place in the Google Maps API. + */ + @JsonProperty("placeId") + public abstract Builder placeId(String placeId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder placeId(Optional placeId); + + /** Clears the value of placeId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPlaceId() { + return placeId(Optional.empty()); + } + + /** + * Setter for route. + * + *

route: Output only. Route information. + */ + @JsonProperty("route") + public abstract Builder route(GroundingChunkMapsRoute route); + + /** + * Setter for route builder. + * + *

route: Output only. Route information. + */ + @CanIgnoreReturnValue + public Builder route(GroundingChunkMapsRoute.Builder routeBuilder) { + return route(routeBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder route(Optional route); + + /** Clears the value of route field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRoute() { + return route(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: The text of the place answer. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: The title of the place. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + /** + * Setter for uri. + * + *

uri: The URI of the place. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + public abstract GroundingChunkMaps build(); + } + + /** Deserializes a JSON string to a GroundingChunkMaps object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkMaps fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkMaps.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSources.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSources.java new file mode 100644 index 0000000..02fbff9 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSources.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * The sources that were used to generate the place answer. This includes review snippets and photos + * that were used to generate the answer, as well as URIs to flag content. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSources.Builder.class) +public abstract class GroundingChunkMapsPlaceAnswerSources extends JsonSerializable { + /** Snippets of reviews that were used to generate the answer. */ + @JsonProperty("reviewSnippets") + public abstract Optional> + reviewSnippets(); + + /** Instantiates a builder for GroundingChunkMapsPlaceAnswerSources. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSources.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsPlaceAnswerSources. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingChunkMapsPlaceAnswerSources.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSources.Builder(); + } + + /** + * Setter for reviewSnippets. + * + *

reviewSnippets: Snippets of reviews that were used to generate the answer. + */ + @JsonProperty("reviewSnippets") + public abstract Builder reviewSnippets( + List reviewSnippets); + + /** + * Setter for reviewSnippets. + * + *

reviewSnippets: Snippets of reviews that were used to generate the answer. + */ + @CanIgnoreReturnValue + public Builder reviewSnippets( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet... reviewSnippets) { + return reviewSnippets(Arrays.asList(reviewSnippets)); + } + + /** + * Setter for reviewSnippets builder. + * + *

reviewSnippets: Snippets of reviews that were used to generate the answer. + */ + @CanIgnoreReturnValue + public Builder reviewSnippets( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder... reviewSnippetsBuilders) { + return reviewSnippets( + Arrays.asList(reviewSnippetsBuilders).stream() + .map(GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reviewSnippets( + Optional> reviewSnippets); + + /** Clears the value of reviewSnippets field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReviewSnippets() { + return reviewSnippets(Optional.empty()); + } + + public abstract GroundingChunkMapsPlaceAnswerSources build(); + } + + /** Deserializes a JSON string to a GroundingChunkMapsPlaceAnswerSources object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkMapsPlaceAnswerSources fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkMapsPlaceAnswerSources.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java new file mode 100644 index 0000000..8080878 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java @@ -0,0 +1,129 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A review snippet that is used to generate the answer. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder.class) +public abstract class GroundingChunkMapsPlaceAnswerSourcesReviewSnippet extends JsonSerializable { + /** A link to show the review on Google Maps. */ + @JsonProperty("googleMapsUri") + public abstract Optional googleMapsUri(); + + /** The ID of the review that is being referenced. */ + @JsonProperty("reviewId") + public abstract Optional reviewId(); + + /** The title of the review. */ + @JsonProperty("title") + public abstract Optional title(); + + /** Instantiates a builder for GroundingChunkMapsPlaceAnswerSourcesReviewSnippet. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsPlaceAnswerSourcesReviewSnippet. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder(); + } + + /** + * Setter for googleMapsUri. + * + *

googleMapsUri: A link to show the review on Google Maps. + */ + @JsonProperty("googleMapsUri") + public abstract Builder googleMapsUri(String googleMapsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleMapsUri(Optional googleMapsUri); + + /** Clears the value of googleMapsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleMapsUri() { + return googleMapsUri(Optional.empty()); + } + + /** + * Setter for reviewId. + * + *

reviewId: The ID of the review that is being referenced. + */ + @JsonProperty("reviewId") + public abstract Builder reviewId(String reviewId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reviewId(Optional reviewId); + + /** Clears the value of reviewId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReviewId() { + return reviewId(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: The title of the review. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + public abstract GroundingChunkMapsPlaceAnswerSourcesReviewSnippet build(); + } + + /** Deserializes a JSON string to a GroundingChunkMapsPlaceAnswerSourcesReviewSnippet object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkMapsPlaceAnswerSourcesReviewSnippet fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsRoute.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsRoute.java new file mode 100644 index 0000000..9a4c1a3 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkMapsRoute.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.util.Optional; + +/** Route information from Google Maps. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsRoute.Builder.class) +public abstract class GroundingChunkMapsRoute extends JsonSerializable { + /** The total distance of the route, in meters. */ + @JsonProperty("distanceMeters") + public abstract Optional distanceMeters(); + + /** The total duration of the route. */ + @JsonProperty("duration") + public abstract Optional duration(); + + /** + * An encoded polyline of the route. See + * https://developers.google.com/maps/documentation/utilities/polylinealgorithm + */ + @JsonProperty("encodedPolyline") + public abstract Optional encodedPolyline(); + + /** Instantiates a builder for GroundingChunkMapsRoute. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkMapsRoute.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsRoute. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunkMapsRoute.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsRoute.Builder(); + } + + /** + * Setter for distanceMeters. + * + *

distanceMeters: The total distance of the route, in meters. + */ + @JsonProperty("distanceMeters") + public abstract Builder distanceMeters(Integer distanceMeters); + + @ExcludeFromGeneratedCoverageReport + abstract Builder distanceMeters(Optional distanceMeters); + + /** Clears the value of distanceMeters field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDistanceMeters() { + return distanceMeters(Optional.empty()); + } + + /** + * Setter for duration. + * + *

duration: The total duration of the route. + */ + @JsonProperty("duration") + public abstract Builder duration(Duration duration); + + @ExcludeFromGeneratedCoverageReport + abstract Builder duration(Optional duration); + + /** Clears the value of duration field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDuration() { + return duration(Optional.empty()); + } + + /** + * Setter for encodedPolyline. + * + *

encodedPolyline: An encoded polyline of the route. See + * https://developers.google.com/maps/documentation/utilities/polylinealgorithm + */ + @JsonProperty("encodedPolyline") + public abstract Builder encodedPolyline(String encodedPolyline); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encodedPolyline(Optional encodedPolyline); + + /** Clears the value of encodedPolyline field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncodedPolyline() { + return encodedPolyline(Optional.empty()); + } + + public abstract GroundingChunkMapsRoute build(); + } + + /** Deserializes a JSON string to a GroundingChunkMapsRoute object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkMapsRoute fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkMapsRoute.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkRetrievedContext.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkRetrievedContext.java new file mode 100644 index 0000000..4fb1dba --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkRetrievedContext.java @@ -0,0 +1,195 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Context retrieved from a data source to ground the model's response. This is used when a + * retrieval tool fetches information from a user-provided corpus or a public dataset. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkRetrievedContext.Builder.class) +public abstract class GroundingChunkRetrievedContext extends JsonSerializable { + /** + * Output only. The full resource name of the referenced Vertex AI Search document. This is used + * to identify the specific document that was retrieved. The format is + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. + */ + @JsonProperty("documentName") + public abstract Optional documentName(); + + /** + * Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is + * populated only when the RAG retrieval tool is used. + */ + @JsonProperty("ragChunk") + public abstract Optional ragChunk(); + + /** The content of the retrieved data source. */ + @JsonProperty("text") + public abstract Optional text(); + + /** The title of the retrieved data source. */ + @JsonProperty("title") + public abstract Optional title(); + + /** The URI of the retrieved data source. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for GroundingChunkRetrievedContext. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkRetrievedContext.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkRetrievedContext. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingChunkRetrievedContext.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkRetrievedContext.Builder(); + } + + /** + * Setter for documentName. + * + *

documentName: Output only. The full resource name of the referenced Vertex AI Search + * document. This is used to identify the specific document that was retrieved. The format is + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. + */ + @JsonProperty("documentName") + public abstract Builder documentName(String documentName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder documentName(Optional documentName); + + /** Clears the value of documentName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDocumentName() { + return documentName(Optional.empty()); + } + + /** + * Setter for ragChunk. + * + *

ragChunk: Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. + * This is populated only when the RAG retrieval tool is used. + */ + @JsonProperty("ragChunk") + public abstract Builder ragChunk(RagChunk ragChunk); + + /** + * Setter for ragChunk builder. + * + *

ragChunk: Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. + * This is populated only when the RAG retrieval tool is used. + */ + @CanIgnoreReturnValue + public Builder ragChunk(RagChunk.Builder ragChunkBuilder) { + return ragChunk(ragChunkBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder ragChunk(Optional ragChunk); + + /** Clears the value of ragChunk field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRagChunk() { + return ragChunk(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: The content of the retrieved data source. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: The title of the retrieved data source. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + /** + * Setter for uri. + * + *

uri: The URI of the retrieved data source. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + public abstract GroundingChunkRetrievedContext build(); + } + + /** Deserializes a JSON string to a GroundingChunkRetrievedContext object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkRetrievedContext fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkRetrievedContext.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkWeb.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkWeb.java new file mode 100644 index 0000000..61294e2 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingChunkWeb.java @@ -0,0 +1,133 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * A `Web` chunk is a piece of evidence that comes from a web page. It contains the URI of the web + * page, the title of the page, and the domain of the page. This is used to provide the user with a + * link to the source of the information. + */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkWeb.Builder.class) +public abstract class GroundingChunkWeb extends JsonSerializable { + /** + * The domain of the web page that contains the evidence. This can be used to filter out + * low-quality sources. + */ + @JsonProperty("domain") + public abstract Optional domain(); + + /** The title of the web page that contains the evidence. */ + @JsonProperty("title") + public abstract Optional title(); + + /** The URI of the web page that contains the evidence. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for GroundingChunkWeb. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingChunkWeb.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkWeb. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunkWeb.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkWeb.Builder(); + } + + /** + * Setter for domain. + * + *

domain: The domain of the web page that contains the evidence. This can be used to filter + * out low-quality sources. + */ + @JsonProperty("domain") + public abstract Builder domain(String domain); + + @ExcludeFromGeneratedCoverageReport + abstract Builder domain(Optional domain); + + /** Clears the value of domain field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDomain() { + return domain(Optional.empty()); + } + + /** + * Setter for title. + * + *

title: The title of the web page that contains the evidence. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + @ExcludeFromGeneratedCoverageReport + abstract Builder title(Optional title); + + /** Clears the value of title field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTitle() { + return title(Optional.empty()); + } + + /** + * Setter for uri. + * + *

uri: The URI of the web page that contains the evidence. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + public abstract GroundingChunkWeb build(); + } + + /** Deserializes a JSON string to a GroundingChunkWeb object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingChunkWeb fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkWeb.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadata.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadata.java new file mode 100644 index 0000000..8e6ac6f --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadata.java @@ -0,0 +1,450 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * Information about the sources that support the content of a response. When grounding is enabled, + * the model returns citations for claims in the response. This object contains the retrieved + * sources. + */ +@AutoValue +@JsonDeserialize(builder = GroundingMetadata.Builder.class) +public abstract class GroundingMetadata extends JsonSerializable { + /** + * Optional. Output only. Deprecated: The Google Maps contextual widget behavior in Grounding with + * Google Maps is being deprecated; this field is planned for removal and will no longer be + * populated once removed. A token that can be used to render a Google Maps widget with the + * contextual data. This field is populated only when the grounding source is Google Maps. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Optional googleMapsWidgetContextToken(); + + /** + * A list of supporting references retrieved from the grounding source. This field is populated + * when the grounding source is Google Search, Vertex AI Search, or Google Maps. + */ + @JsonProperty("groundingChunks") + public abstract Optional> groundingChunks(); + + /** + * Optional. A list of grounding supports that connect the generated content to the grounding + * chunks. This field is populated when the grounding source is Google Search or Vertex AI Search. + */ + @JsonProperty("groundingSupports") + public abstract Optional> groundingSupports(); + + /** + * Optional. The image search queries that were used to generate the content. This field is + * populated only when the grounding source is Google Search with the Image Search search_type + * enabled. + */ + @JsonProperty("imageSearchQueries") + public abstract Optional> imageSearchQueries(); + + /** Optional. Output only. Metadata related to the retrieval grounding source. */ + @JsonProperty("retrievalMetadata") + public abstract Optional retrievalMetadata(); + + /** + * Optional. The queries that were executed by the retrieval tools. This field is populated only + * when the grounding source is a retrieval tool, such as Vertex AI Search. + */ + @JsonProperty("retrievalQueries") + public abstract Optional> retrievalQueries(); + + /** + * Optional. A web search entry point that can be used to display search results. This field is + * populated only when the grounding source is Google Search. + */ + @JsonProperty("searchEntryPoint") + public abstract Optional searchEntryPoint(); + + /** + * Optional. Output only. A list of URIs that can be used to flag a place or review for + * inappropriate content. This field is populated only when the grounding source is Google Maps. + */ + @JsonProperty("sourceFlaggingUris") + public abstract Optional> sourceFlaggingUris(); + + /** + * Optional. The web search queries that were used to generate the content. This field is + * populated only when the grounding source is Google Search. + */ + @JsonProperty("webSearchQueries") + public abstract Optional> webSearchQueries(); + + /** Instantiates a builder for GroundingMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingMetadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingMetadata.Builder(); + } + + /** + * Setter for googleMapsWidgetContextToken. + * + *

googleMapsWidgetContextToken: Optional. Output only. Deprecated: The Google Maps + * contextual widget behavior in Grounding with Google Maps is being deprecated; this field is + * planned for removal and will no longer be populated once removed. A token that can be used to + * render a Google Maps widget with the contextual data. This field is populated only when the + * grounding source is Google Maps. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Builder googleMapsWidgetContextToken(String googleMapsWidgetContextToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleMapsWidgetContextToken(Optional googleMapsWidgetContextToken); + + /** Clears the value of googleMapsWidgetContextToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleMapsWidgetContextToken() { + return googleMapsWidgetContextToken(Optional.empty()); + } + + /** + * Setter for groundingChunks. + * + *

groundingChunks: A list of supporting references retrieved from the grounding source. This + * field is populated when the grounding source is Google Search, Vertex AI Search, or Google + * Maps. + */ + @JsonProperty("groundingChunks") + public abstract Builder groundingChunks(List groundingChunks); + + /** + * Setter for groundingChunks. + * + *

groundingChunks: A list of supporting references retrieved from the grounding source. This + * field is populated when the grounding source is Google Search, Vertex AI Search, or Google + * Maps. + */ + @CanIgnoreReturnValue + public Builder groundingChunks(GroundingChunk... groundingChunks) { + return groundingChunks(Arrays.asList(groundingChunks)); + } + + /** + * Setter for groundingChunks builder. + * + *

groundingChunks: A list of supporting references retrieved from the grounding source. This + * field is populated when the grounding source is Google Search, Vertex AI Search, or Google + * Maps. + */ + @CanIgnoreReturnValue + public Builder groundingChunks(GroundingChunk.Builder... groundingChunksBuilders) { + return groundingChunks( + Arrays.asList(groundingChunksBuilders).stream() + .map(GroundingChunk.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder groundingChunks(Optional> groundingChunks); + + /** Clears the value of groundingChunks field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroundingChunks() { + return groundingChunks(Optional.empty()); + } + + /** + * Setter for groundingSupports. + * + *

groundingSupports: Optional. A list of grounding supports that connect the generated + * content to the grounding chunks. This field is populated when the grounding source is Google + * Search or Vertex AI Search. + */ + @JsonProperty("groundingSupports") + public abstract Builder groundingSupports(List groundingSupports); + + /** + * Setter for groundingSupports. + * + *

groundingSupports: Optional. A list of grounding supports that connect the generated + * content to the grounding chunks. This field is populated when the grounding source is Google + * Search or Vertex AI Search. + */ + @CanIgnoreReturnValue + public Builder groundingSupports(GroundingSupport... groundingSupports) { + return groundingSupports(Arrays.asList(groundingSupports)); + } + + /** + * Setter for groundingSupports builder. + * + *

groundingSupports: Optional. A list of grounding supports that connect the generated + * content to the grounding chunks. This field is populated when the grounding source is Google + * Search or Vertex AI Search. + */ + @CanIgnoreReturnValue + public Builder groundingSupports(GroundingSupport.Builder... groundingSupportsBuilders) { + return groundingSupports( + Arrays.asList(groundingSupportsBuilders).stream() + .map(GroundingSupport.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder groundingSupports(Optional> groundingSupports); + + /** Clears the value of groundingSupports field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroundingSupports() { + return groundingSupports(Optional.empty()); + } + + /** + * Setter for imageSearchQueries. + * + *

imageSearchQueries: Optional. The image search queries that were used to generate the + * content. This field is populated only when the grounding source is Google Search with the + * Image Search search_type enabled. + */ + @JsonProperty("imageSearchQueries") + public abstract Builder imageSearchQueries(List imageSearchQueries); + + /** + * Setter for imageSearchQueries. + * + *

imageSearchQueries: Optional. The image search queries that were used to generate the + * content. This field is populated only when the grounding source is Google Search with the + * Image Search search_type enabled. + */ + @CanIgnoreReturnValue + public Builder imageSearchQueries(String... imageSearchQueries) { + return imageSearchQueries(Arrays.asList(imageSearchQueries)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder imageSearchQueries(Optional> imageSearchQueries); + + /** Clears the value of imageSearchQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImageSearchQueries() { + return imageSearchQueries(Optional.empty()); + } + + /** + * Setter for retrievalMetadata. + * + *

retrievalMetadata: Optional. Output only. Metadata related to the retrieval grounding + * source. + */ + @JsonProperty("retrievalMetadata") + public abstract Builder retrievalMetadata(RetrievalMetadata retrievalMetadata); + + /** + * Setter for retrievalMetadata builder. + * + *

retrievalMetadata: Optional. Output only. Metadata related to the retrieval grounding + * source. + */ + @CanIgnoreReturnValue + public Builder retrievalMetadata(RetrievalMetadata.Builder retrievalMetadataBuilder) { + return retrievalMetadata(retrievalMetadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievalMetadata(Optional retrievalMetadata); + + /** Clears the value of retrievalMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievalMetadata() { + return retrievalMetadata(Optional.empty()); + } + + /** + * Setter for retrievalQueries. + * + *

retrievalQueries: Optional. The queries that were executed by the retrieval tools. This + * field is populated only when the grounding source is a retrieval tool, such as Vertex AI + * Search. + */ + @JsonProperty("retrievalQueries") + public abstract Builder retrievalQueries(List retrievalQueries); + + /** + * Setter for retrievalQueries. + * + *

retrievalQueries: Optional. The queries that were executed by the retrieval tools. This + * field is populated only when the grounding source is a retrieval tool, such as Vertex AI + * Search. + */ + @CanIgnoreReturnValue + public Builder retrievalQueries(String... retrievalQueries) { + return retrievalQueries(Arrays.asList(retrievalQueries)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievalQueries(Optional> retrievalQueries); + + /** Clears the value of retrievalQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievalQueries() { + return retrievalQueries(Optional.empty()); + } + + /** + * Setter for searchEntryPoint. + * + *

searchEntryPoint: Optional. A web search entry point that can be used to display search + * results. This field is populated only when the grounding source is Google Search. + */ + @JsonProperty("searchEntryPoint") + public abstract Builder searchEntryPoint(SearchEntryPoint searchEntryPoint); + + /** + * Setter for searchEntryPoint builder. + * + *

searchEntryPoint: Optional. A web search entry point that can be used to display search + * results. This field is populated only when the grounding source is Google Search. + */ + @CanIgnoreReturnValue + public Builder searchEntryPoint(SearchEntryPoint.Builder searchEntryPointBuilder) { + return searchEntryPoint(searchEntryPointBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder searchEntryPoint(Optional searchEntryPoint); + + /** Clears the value of searchEntryPoint field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSearchEntryPoint() { + return searchEntryPoint(Optional.empty()); + } + + /** + * Setter for sourceFlaggingUris. + * + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. + */ + @JsonProperty("sourceFlaggingUris") + public abstract Builder sourceFlaggingUris( + List sourceFlaggingUris); + + /** + * Setter for sourceFlaggingUris. + * + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. + */ + @CanIgnoreReturnValue + public Builder sourceFlaggingUris(GroundingMetadataSourceFlaggingUri... sourceFlaggingUris) { + return sourceFlaggingUris(Arrays.asList(sourceFlaggingUris)); + } + + /** + * Setter for sourceFlaggingUris builder. + * + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. + */ + @CanIgnoreReturnValue + public Builder sourceFlaggingUris( + GroundingMetadataSourceFlaggingUri.Builder... sourceFlaggingUrisBuilders) { + return sourceFlaggingUris( + Arrays.asList(sourceFlaggingUrisBuilders).stream() + .map(GroundingMetadataSourceFlaggingUri.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceFlaggingUris( + Optional> sourceFlaggingUris); + + /** Clears the value of sourceFlaggingUris field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceFlaggingUris() { + return sourceFlaggingUris(Optional.empty()); + } + + /** + * Setter for webSearchQueries. + * + *

webSearchQueries: Optional. The web search queries that were used to generate the content. + * This field is populated only when the grounding source is Google Search. + */ + @JsonProperty("webSearchQueries") + public abstract Builder webSearchQueries(List webSearchQueries); + + /** + * Setter for webSearchQueries. + * + *

webSearchQueries: Optional. The web search queries that were used to generate the content. + * This field is populated only when the grounding source is Google Search. + */ + @CanIgnoreReturnValue + public Builder webSearchQueries(String... webSearchQueries) { + return webSearchQueries(Arrays.asList(webSearchQueries)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder webSearchQueries(Optional> webSearchQueries); + + /** Clears the value of webSearchQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWebSearchQueries() { + return webSearchQueries(Optional.empty()); + } + + public abstract GroundingMetadata build(); + } + + /** Deserializes a JSON string to a GroundingMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingMetadata.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadataSourceFlaggingUri.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadataSourceFlaggingUri.java new file mode 100644 index 0000000..4bc4977 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingMetadataSourceFlaggingUri.java @@ -0,0 +1,109 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * A URI that can be used to flag a place or review for inappropriate content. This is populated + * only when the grounding source is Google Maps. + */ +@AutoValue +@JsonDeserialize(builder = GroundingMetadataSourceFlaggingUri.Builder.class) +public abstract class GroundingMetadataSourceFlaggingUri extends JsonSerializable { + /** The URI that can be used to flag the content. */ + @JsonProperty("flagContentUri") + public abstract Optional flagContentUri(); + + /** The ID of the place or review. */ + @JsonProperty("sourceId") + public abstract Optional sourceId(); + + /** Instantiates a builder for GroundingMetadataSourceFlaggingUri. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingMetadataSourceFlaggingUri.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingMetadataSourceFlaggingUri. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingMetadataSourceFlaggingUri.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingMetadataSourceFlaggingUri.Builder(); + } + + /** + * Setter for flagContentUri. + * + *

flagContentUri: The URI that can be used to flag the content. + */ + @JsonProperty("flagContentUri") + public abstract Builder flagContentUri(String flagContentUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder flagContentUri(Optional flagContentUri); + + /** Clears the value of flagContentUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFlagContentUri() { + return flagContentUri(Optional.empty()); + } + + /** + * Setter for sourceId. + * + *

sourceId: The ID of the place or review. + */ + @JsonProperty("sourceId") + public abstract Builder sourceId(String sourceId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceId(Optional sourceId); + + /** Clears the value of sourceId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceId() { + return sourceId(Optional.empty()); + } + + public abstract GroundingMetadataSourceFlaggingUri build(); + } + + /** Deserializes a JSON string to a GroundingMetadataSourceFlaggingUri object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingMetadataSourceFlaggingUri fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingMetadataSourceFlaggingUri.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/GroundingSupport.java b/src/main/java/com/google/cloud/agentplatform/types/GroundingSupport.java new file mode 100644 index 0000000..a7dfd04 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/GroundingSupport.java @@ -0,0 +1,221 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A collection of supporting references for a segment or part of the model's response. */ +@AutoValue +@JsonDeserialize(builder = GroundingSupport.Builder.class) +public abstract class GroundingSupport extends JsonSerializable { + /** + * The confidence scores for the support references. This list is parallel to the + * `grounding_chunk_indices` list. A score is a value between 0.0 and 1.0, with a higher score + * indicating a higher confidence that the reference supports the claim. For Gemini 2.0 and + * before, this list has the same size as `grounding_chunk_indices`. For Gemini 2.5 and later, + * this list is empty and should be ignored. + */ + @JsonProperty("confidenceScores") + public abstract Optional> confidenceScores(); + + /** + * A list of indices into the `grounding_chunks` field of the `GroundingMetadata` message. These + * indices specify which grounding chunks support the claim made in the content segment. For + * example, if this field has the values `[1, 3]`, it means that `grounding_chunks[1]` and + * `grounding_chunks[3]` are the sources for the claim in the content segment. + */ + @JsonProperty("groundingChunkIndices") + public abstract Optional> groundingChunkIndices(); + + /** + * Indices into the `rendered_parts` field of the `GroundingMetadata` message. These indices + * specify which rendered parts are associated with this support message. + */ + @JsonProperty("renderedParts") + public abstract Optional> renderedParts(); + + /** The content segment that this support message applies to. */ + @JsonProperty("segment") + public abstract Optional segment(); + + /** Instantiates a builder for GroundingSupport. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GroundingSupport.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingSupport. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingSupport.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingSupport.Builder(); + } + + /** + * Setter for confidenceScores. + * + *

confidenceScores: The confidence scores for the support references. This list is parallel + * to the `grounding_chunk_indices` list. A score is a value between 0.0 and 1.0, with a higher + * score indicating a higher confidence that the reference supports the claim. For Gemini 2.0 + * and before, this list has the same size as `grounding_chunk_indices`. For Gemini 2.5 and + * later, this list is empty and should be ignored. + */ + @JsonProperty("confidenceScores") + public abstract Builder confidenceScores(List confidenceScores); + + /** + * Setter for confidenceScores. + * + *

confidenceScores: The confidence scores for the support references. This list is parallel + * to the `grounding_chunk_indices` list. A score is a value between 0.0 and 1.0, with a higher + * score indicating a higher confidence that the reference supports the claim. For Gemini 2.0 + * and before, this list has the same size as `grounding_chunk_indices`. For Gemini 2.5 and + * later, this list is empty and should be ignored. + */ + @CanIgnoreReturnValue + public Builder confidenceScores(Float... confidenceScores) { + return confidenceScores(Arrays.asList(confidenceScores)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder confidenceScores(Optional> confidenceScores); + + /** Clears the value of confidenceScores field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfidenceScores() { + return confidenceScores(Optional.empty()); + } + + /** + * Setter for groundingChunkIndices. + * + *

groundingChunkIndices: A list of indices into the `grounding_chunks` field of the + * `GroundingMetadata` message. These indices specify which grounding chunks support the claim + * made in the content segment. For example, if this field has the values `[1, 3]`, it means + * that `grounding_chunks[1]` and `grounding_chunks[3]` are the sources for the claim in the + * content segment. + */ + @JsonProperty("groundingChunkIndices") + public abstract Builder groundingChunkIndices(List groundingChunkIndices); + + /** + * Setter for groundingChunkIndices. + * + *

groundingChunkIndices: A list of indices into the `grounding_chunks` field of the + * `GroundingMetadata` message. These indices specify which grounding chunks support the claim + * made in the content segment. For example, if this field has the values `[1, 3]`, it means + * that `grounding_chunks[1]` and `grounding_chunks[3]` are the sources for the claim in the + * content segment. + */ + @CanIgnoreReturnValue + public Builder groundingChunkIndices(Integer... groundingChunkIndices) { + return groundingChunkIndices(Arrays.asList(groundingChunkIndices)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder groundingChunkIndices(Optional> groundingChunkIndices); + + /** Clears the value of groundingChunkIndices field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroundingChunkIndices() { + return groundingChunkIndices(Optional.empty()); + } + + /** + * Setter for renderedParts. + * + *

renderedParts: Indices into the `rendered_parts` field of the `GroundingMetadata` message. + * These indices specify which rendered parts are associated with this support message. + */ + @JsonProperty("renderedParts") + public abstract Builder renderedParts(List renderedParts); + + /** + * Setter for renderedParts. + * + *

renderedParts: Indices into the `rendered_parts` field of the `GroundingMetadata` message. + * These indices specify which rendered parts are associated with this support message. + */ + @CanIgnoreReturnValue + public Builder renderedParts(Integer... renderedParts) { + return renderedParts(Arrays.asList(renderedParts)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder renderedParts(Optional> renderedParts); + + /** Clears the value of renderedParts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRenderedParts() { + return renderedParts(Optional.empty()); + } + + /** + * Setter for segment. + * + *

segment: The content segment that this support message applies to. + */ + @JsonProperty("segment") + public abstract Builder segment(Segment segment); + + /** + * Setter for segment builder. + * + *

segment: The content segment that this support message applies to. + */ + @CanIgnoreReturnValue + public Builder segment(Segment.Builder segmentBuilder) { + return segment(segmentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder segment(Optional segment); + + /** Clears the value of segment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSegment() { + return segment(Optional.empty()); + } + + public abstract GroundingSupport build(); + } + + /** Deserializes a JSON string to a GroundingSupport object. */ + @ExcludeFromGeneratedCoverageReport + public static GroundingSupport fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingSupport.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/RagChunk.java b/src/main/java/com/google/cloud/agentplatform/types/RagChunk.java new file mode 100644 index 0000000..37cbd18 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/RagChunk.java @@ -0,0 +1,157 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */ +@AutoValue +@JsonDeserialize(builder = RagChunk.Builder.class) +public abstract class RagChunk extends JsonSerializable { + /** The ID of the chunk. */ + @JsonProperty("chunkId") + public abstract Optional chunkId(); + + /** The ID of the file that the chunk belongs to. */ + @JsonProperty("fileId") + public abstract Optional fileId(); + + /** If populated, represents where the chunk starts and ends in the document. */ + @JsonProperty("pageSpan") + public abstract Optional pageSpan(); + + /** The content of the chunk. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Instantiates a builder for RagChunk. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RagChunk.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RagChunk. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RagChunk.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RagChunk.Builder(); + } + + /** + * Setter for chunkId. + * + *

chunkId: The ID of the chunk. + */ + @JsonProperty("chunkId") + public abstract Builder chunkId(String chunkId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder chunkId(Optional chunkId); + + /** Clears the value of chunkId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearChunkId() { + return chunkId(Optional.empty()); + } + + /** + * Setter for fileId. + * + *

fileId: The ID of the file that the chunk belongs to. + */ + @JsonProperty("fileId") + public abstract Builder fileId(String fileId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fileId(Optional fileId); + + /** Clears the value of fileId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFileId() { + return fileId(Optional.empty()); + } + + /** + * Setter for pageSpan. + * + *

pageSpan: If populated, represents where the chunk starts and ends in the document. + */ + @JsonProperty("pageSpan") + public abstract Builder pageSpan(RagChunkPageSpan pageSpan); + + /** + * Setter for pageSpan builder. + * + *

pageSpan: If populated, represents where the chunk starts and ends in the document. + */ + @CanIgnoreReturnValue + public Builder pageSpan(RagChunkPageSpan.Builder pageSpanBuilder) { + return pageSpan(pageSpanBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSpan(Optional pageSpan); + + /** Clears the value of pageSpan field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSpan() { + return pageSpan(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: The content of the chunk. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + public abstract RagChunk build(); + } + + /** Deserializes a JSON string to a RagChunk object. */ + @ExcludeFromGeneratedCoverageReport + public static RagChunk fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RagChunk.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/RagChunkPageSpan.java b/src/main/java/com/google/cloud/agentplatform/types/RagChunkPageSpan.java new file mode 100644 index 0000000..88aa7b9 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/RagChunkPageSpan.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents where the chunk starts and ends in the document. */ +@AutoValue +@JsonDeserialize(builder = RagChunkPageSpan.Builder.class) +public abstract class RagChunkPageSpan extends JsonSerializable { + /** Page where chunk starts in the document. Inclusive. 1-indexed. */ + @JsonProperty("firstPage") + public abstract Optional firstPage(); + + /** Page where chunk ends in the document. Inclusive. 1-indexed. */ + @JsonProperty("lastPage") + public abstract Optional lastPage(); + + /** Instantiates a builder for RagChunkPageSpan. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RagChunkPageSpan.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RagChunkPageSpan. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RagChunkPageSpan.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RagChunkPageSpan.Builder(); + } + + /** + * Setter for firstPage. + * + *

firstPage: Page where chunk starts in the document. Inclusive. 1-indexed. + */ + @JsonProperty("firstPage") + public abstract Builder firstPage(Integer firstPage); + + @ExcludeFromGeneratedCoverageReport + abstract Builder firstPage(Optional firstPage); + + /** Clears the value of firstPage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFirstPage() { + return firstPage(Optional.empty()); + } + + /** + * Setter for lastPage. + * + *

lastPage: Page where chunk ends in the document. Inclusive. 1-indexed. + */ + @JsonProperty("lastPage") + public abstract Builder lastPage(Integer lastPage); + + @ExcludeFromGeneratedCoverageReport + abstract Builder lastPage(Optional lastPage); + + /** Clears the value of lastPage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLastPage() { + return lastPage(Optional.empty()); + } + + public abstract RagChunkPageSpan build(); + } + + /** Deserializes a JSON string to a RagChunkPageSpan object. */ + @ExcludeFromGeneratedCoverageReport + public static RagChunkPageSpan fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RagChunkPageSpan.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/RetrievalMetadata.java b/src/main/java/com/google/cloud/agentplatform/types/RetrievalMetadata.java new file mode 100644 index 0000000..769e116 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/RetrievalMetadata.java @@ -0,0 +1,96 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Metadata related to the retrieval grounding source. This is part of the `GroundingMetadata` + * returned when grounding is enabled. + */ +@AutoValue +@JsonDeserialize(builder = RetrievalMetadata.Builder.class) +public abstract class RetrievalMetadata extends JsonSerializable { + /** + * Optional. A score indicating how likely it is that a Google Search query could help answer the + * prompt. The score is in the range of `[0, 1]`. A score of 1 means the model is confident that a + * search will be helpful, and 0 means it is not. This score is populated only when Google Search + * grounding and dynamic retrieval are enabled. The score is used to determine whether to trigger + * a search. + */ + @JsonProperty("googleSearchDynamicRetrievalScore") + public abstract Optional googleSearchDynamicRetrievalScore(); + + /** Instantiates a builder for RetrievalMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrievalMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrievalMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RetrievalMetadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrievalMetadata.Builder(); + } + + /** + * Setter for googleSearchDynamicRetrievalScore. + * + *

googleSearchDynamicRetrievalScore: Optional. A score indicating how likely it is that a + * Google Search query could help answer the prompt. The score is in the range of `[0, 1]`. A + * score of 1 means the model is confident that a search will be helpful, and 0 means it is not. + * This score is populated only when Google Search grounding and dynamic retrieval are enabled. + * The score is used to determine whether to trigger a search. + */ + @JsonProperty("googleSearchDynamicRetrievalScore") + public abstract Builder googleSearchDynamicRetrievalScore( + Float googleSearchDynamicRetrievalScore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleSearchDynamicRetrievalScore( + Optional googleSearchDynamicRetrievalScore); + + /** Clears the value of googleSearchDynamicRetrievalScore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleSearchDynamicRetrievalScore() { + return googleSearchDynamicRetrievalScore(Optional.empty()); + } + + public abstract RetrievalMetadata build(); + } + + /** Deserializes a JSON string to a RetrievalMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrievalMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RetrievalMetadata.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/SchemaPromptSpecContentMetadata.java b/src/main/java/com/google/cloud/agentplatform/types/SchemaPromptSpecContentMetadata.java new file mode 100644 index 0000000..3ce43f8 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/SchemaPromptSpecContentMetadata.java @@ -0,0 +1,125 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Metadata the model returned alongside the content it generated. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecContentMetadata.Builder.class) +public abstract class SchemaPromptSpecContentMetadata extends JsonSerializable { + /** Optional. Citations that apply to the content. */ + @JsonProperty("citationMetadata") + public abstract Optional citationMetadata(); + + /** Optional. Sources used to ground the content. */ + @JsonProperty("groundingMetadata") + public abstract Optional groundingMetadata(); + + /** Instantiates a builder for SchemaPromptSpecContentMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecContentMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecContentMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecContentMetadata.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecContentMetadata.Builder(); + } + + /** + * Setter for citationMetadata. + * + *

citationMetadata: Optional. Citations that apply to the content. + */ + @JsonProperty("citationMetadata") + public abstract Builder citationMetadata(CitationMetadata citationMetadata); + + /** + * Setter for citationMetadata builder. + * + *

citationMetadata: Optional. Citations that apply to the content. + */ + @CanIgnoreReturnValue + public Builder citationMetadata(CitationMetadata.Builder citationMetadataBuilder) { + return citationMetadata(citationMetadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder citationMetadata(Optional citationMetadata); + + /** Clears the value of citationMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCitationMetadata() { + return citationMetadata(Optional.empty()); + } + + /** + * Setter for groundingMetadata. + * + *

groundingMetadata: Optional. Sources used to ground the content. + */ + @JsonProperty("groundingMetadata") + public abstract Builder groundingMetadata(GroundingMetadata groundingMetadata); + + /** + * Setter for groundingMetadata builder. + * + *

groundingMetadata: Optional. Sources used to ground the content. + */ + @CanIgnoreReturnValue + public Builder groundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder) { + return groundingMetadata(groundingMetadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder groundingMetadata(Optional groundingMetadata); + + /** Clears the value of groundingMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroundingMetadata() { + return groundingMetadata(Optional.empty()); + } + + public abstract SchemaPromptSpecContentMetadata build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecContentMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecContentMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecContentMetadata.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/SearchEntryPoint.java b/src/main/java/com/google/cloud/agentplatform/types/SearchEntryPoint.java new file mode 100644 index 0000000..3c7c27b --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/SearchEntryPoint.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * An entry point for displaying Google Search results. A `SearchEntryPoint` is populated when the + * grounding source for a model's response is Google Search. It provides information that you can + * use to display the search results in your application. + */ +@AutoValue +@JsonDeserialize(builder = SearchEntryPoint.Builder.class) +public abstract class SearchEntryPoint extends JsonSerializable { + /** + * Optional. An HTML snippet that can be embedded in a web page or an application's webview. This + * snippet displays a search result, including the title, URL, and a brief description of the + * search result. + */ + @JsonProperty("renderedContent") + public abstract Optional renderedContent(); + + /** + * Optional. A base64-encoded JSON object that contains a list of search queries and their + * corresponding search URLs. This information can be used to build a custom search UI. + */ + @JsonProperty("sdkBlob") + public abstract Optional sdkBlob(); + + /** Instantiates a builder for SearchEntryPoint. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SearchEntryPoint.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SearchEntryPoint. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SearchEntryPoint.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SearchEntryPoint.Builder(); + } + + /** + * Setter for renderedContent. + * + *

renderedContent: Optional. An HTML snippet that can be embedded in a web page or an + * application's webview. This snippet displays a search result, including the title, URL, and a + * brief description of the search result. + */ + @JsonProperty("renderedContent") + public abstract Builder renderedContent(String renderedContent); + + @ExcludeFromGeneratedCoverageReport + abstract Builder renderedContent(Optional renderedContent); + + /** Clears the value of renderedContent field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRenderedContent() { + return renderedContent(Optional.empty()); + } + + /** + * Setter for sdkBlob. + * + *

sdkBlob: Optional. A base64-encoded JSON object that contains a list of search queries and + * their corresponding search URLs. This information can be used to build a custom search UI. + */ + @JsonProperty("sdkBlob") + public abstract Builder sdkBlob(byte[] sdkBlob); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkBlob(Optional sdkBlob); + + /** Clears the value of sdkBlob field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkBlob() { + return sdkBlob(Optional.empty()); + } + + public abstract SearchEntryPoint build(); + } + + /** Deserializes a JSON string to a SearchEntryPoint object. */ + @ExcludeFromGeneratedCoverageReport + public static SearchEntryPoint fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SearchEntryPoint.class); + } +} diff --git a/src/main/java/com/google/cloud/agentplatform/types/Segment.java b/src/main/java/com/google/cloud/agentplatform/types/Segment.java new file mode 100644 index 0000000..b0ceeb3 --- /dev/null +++ b/src/main/java/com/google/cloud/agentplatform/types/Segment.java @@ -0,0 +1,163 @@ +/* + * Copyright 2025 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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.agentplatform.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A segment of the content. */ +@AutoValue +@JsonDeserialize(builder = Segment.Builder.class) +public abstract class Segment extends JsonSerializable { + /** + * Output only. The end index of the segment in the `Part`, measured in bytes. This marks the end + * of the segment and is exclusive, meaning the segment includes content up to, but not including, + * the byte at this index. + */ + @JsonProperty("endIndex") + public abstract Optional endIndex(); + + /** + * Output only. The index of the `Part` object that this segment belongs to. This is useful for + * associating the segment with a specific part of the content. + */ + @JsonProperty("partIndex") + public abstract Optional partIndex(); + + /** + * Output only. The start index of the segment in the `Part`, measured in bytes. This marks the + * beginning of the segment and is inclusive, meaning the byte at this index is the first byte of + * the segment. + */ + @JsonProperty("startIndex") + public abstract Optional startIndex(); + + /** Output only. The text of the segment. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Instantiates a builder for Segment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Segment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Segment. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Segment.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Segment.Builder(); + } + + /** + * Setter for endIndex. + * + *

endIndex: Output only. The end index of the segment in the `Part`, measured in bytes. This + * marks the end of the segment and is exclusive, meaning the segment includes content up to, + * but not including, the byte at this index. + */ + @JsonProperty("endIndex") + public abstract Builder endIndex(Integer endIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endIndex(Optional endIndex); + + /** Clears the value of endIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndIndex() { + return endIndex(Optional.empty()); + } + + /** + * Setter for partIndex. + * + *

partIndex: Output only. The index of the `Part` object that this segment belongs to. This + * is useful for associating the segment with a specific part of the content. + */ + @JsonProperty("partIndex") + public abstract Builder partIndex(Integer partIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder partIndex(Optional partIndex); + + /** Clears the value of partIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPartIndex() { + return partIndex(Optional.empty()); + } + + /** + * Setter for startIndex. + * + *

startIndex: Output only. The start index of the segment in the `Part`, measured in bytes. + * This marks the beginning of the segment and is inclusive, meaning the byte at this index is + * the first byte of the segment. + */ + @JsonProperty("startIndex") + public abstract Builder startIndex(Integer startIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startIndex(Optional startIndex); + + /** Clears the value of startIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartIndex() { + return startIndex(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: Output only. The text of the segment. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + public abstract Segment build(); + } + + /** Deserializes a JSON string to a Segment object. */ + @ExcludeFromGeneratedCoverageReport + public static Segment fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Segment.class); + } +}