Skip to content

Commit

Permalink
feat: [aiplatform] Add Grounding feature to PredictionService.Generat…
Browse files Browse the repository at this point in the history
…eContent (#10358)

* feat: Add Grounding feature to PredictionService.GenerateContent
feat: Add Retrieval
feat: Add GoogleSearchRetrieval
feat: Add VertexAiSearch
feat: Add Tool.retrieval
feat: Add Tool.google_search_retrieval
feat: Add Candidate.grounding_metadata

docs: A comment for message `Tool` is changed
docs: A comment for field `tools` in message `.google.cloud.aiplatform.v1beta1.GenerateContentRequest` is changed
docs: A comment for field `tools` in message `.google.cloud.aiplatform.v1beta1.GenerateContentRequest` is changed
PiperOrigin-RevId: 605743031

Source-Link: googleapis/googleapis@e183baf

Source-Link: googleapis/googleapis-gen@1f35985
Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiIxZjM1OTg1YTg2NWJjZTE4OWJjM2RlMzllMDIwMDY4MTAyNWVlMjEzIn0=

fix!: remove field `max_wait_duration` from message Scheduling
fix!: remove method `CountTokens` from service LlmUtilityService
feat: add psc_automated_endpoints to IndexPrivateEndpoints
feat: add update_mask to UpsertDatapointsRequest
feat: add more RecordErrorType enum values
feat: add request_response_logging_schema_version to ModelDeploymentMonitoringBigQueryTable
feat: add resource_title, resource_use_case, resource_description to RegionalResourceReferences
docs: deprecate use_case and description in ResourceReference
feat: add deploy_gke, open_tine_tuning_pipelines, open_notebooks to CallToAction
docs: minor changes to comments

PiperOrigin-RevId: 605668103

Source-Link: googleapis/googleapis@f583398

Source-Link: googleapis/googleapis-gen@74cf405
Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiI3NGNmNDA1ODQxN2JkMmE2NDExMzk1ZDI4NmMzNGZiMjcwODhhNzZkIn0=

fix!: remove field `max_wait_duration` from message Scheduling
feat: add psc_automated_endpoints to IndexPrivateEndpoints
feat: add request_response_logging_schema_version to ModelDeploymentMonitoringBigQueryTable
feat: add resource_title, resource_use_case, resource_description to RegionalResourceReferences
feat: add deploy_gke, open_tine_tuning_pipelines, open_notebooks to CallToAction
docs: deprecate use_case and description in ResourceReference
docs: minor changes to comments

PiperOrigin-RevId: 605667976

Source-Link: googleapis/googleapis@3b25a48

Source-Link: googleapis/googleapis-gen@b8402de
Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiJiODQwMmRlMjI2MTFhM2I3YmZmYTU5YjA3NTg5MWU1YjI5YTBkNTU0In0=

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Feb 14, 2024
1 parent 15b3f90 commit 0ee1383
Show file tree
Hide file tree
Showing 159 changed files with 34,355 additions and 7,016 deletions.
2 changes: 1 addition & 1 deletion java-aiplatform/README.md
Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-aiplatform.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.35.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.36.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -1054,7 +1054,7 @@ public final ListFeatureOnlineStoresPagedResponse listFeatureOnlineStores(
* mask. If the user does not provide a mask then only the non-empty fields present in the
* request will be overwritten. Set the update_mask to `&#42;` to override all fields.
* <p>Updatable fields:
* <p>&#42; `big_query_source` &#42; `labels` &#42; `sync_config`
* <p>&#42; `big_query_source` &#42; `bigtable` &#42; `labels` &#42; `sync_config`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<FeatureOnlineStore, UpdateFeatureOnlineStoreOperationMetadata>
Expand Down Expand Up @@ -1894,7 +1894,7 @@ public final ListFeatureViewsPagedResponse listFeatureViews(ListFeatureViewsRequ
* user does not provide a mask then only the non-empty fields present in the request will be
* overwritten. Set the update_mask to `&#42;` to override all fields.
* <p>Updatable fields:
* <p>&#42; `labels`
* <p>&#42; `labels` &#42; `serviceAgentType`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<FeatureView, UpdateFeatureViewOperationMetadata>
Expand Down
Expand Up @@ -1089,6 +1089,7 @@ public final UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable()
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request);
* }
Expand Down Expand Up @@ -1118,6 +1119,7 @@ public final UpsertDatapointsResponse upsertDatapoints(UpsertDatapointsRequest r
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture<UpsertDatapointsResponse> future =
* indexServiceClient.upsertDatapointsCallable().futureCall(request);
Expand Down
Expand Up @@ -1056,7 +1056,7 @@ public final ListFeatureOnlineStoresPagedResponse listFeatureOnlineStores(
* mask. If the user does not provide a mask then only the non-empty fields present in the
* request will be overwritten. Set the update_mask to `&#42;` to override all fields.
* <p>Updatable fields:
* <p>&#42; `big_query_source` &#42; `labels` &#42; `sync_config`
* <p>&#42; `big_query_source` &#42; `bigtable` &#42; `labels` &#42; `sync_config`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<FeatureOnlineStore, UpdateFeatureOnlineStoreOperationMetadata>
Expand Down Expand Up @@ -1896,7 +1896,7 @@ public final ListFeatureViewsPagedResponse listFeatureViews(ListFeatureViewsRequ
* user does not provide a mask then only the non-empty fields present in the request will be
* overwritten. Set the update_mask to `&#42;` to override all fields.
* <p>Updatable fields:
* <p>&#42; `labels`
* <p>&#42; `labels` &#42; `serviceAgentType`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<FeatureView, UpdateFeatureViewOperationMetadata>
Expand Down
Expand Up @@ -1091,6 +1091,7 @@ public final UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable()
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request);
* }
Expand Down Expand Up @@ -1120,6 +1121,7 @@ public final UpsertDatapointsResponse upsertDatapoints(UpsertDatapointsRequest r
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture<UpsertDatapointsResponse> future =
* indexServiceClient.upsertDatapointsCallable().futureCall(request);
Expand Down
Expand Up @@ -60,7 +60,7 @@
* EndpointName endpoint =
* EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
* List<Value> instances = new ArrayList<>();
* CountTokensResponse response = llmUtilityServiceClient.countTokens(endpoint, instances);
* ComputeTokensResponse response = llmUtilityServiceClient.computeTokens(endpoint, instances);
* }
* }</pre>
*
Expand All @@ -76,25 +76,6 @@
* <th>Method Variants</th>
* </tr>
* <tr>
* <td><p> CountTokens</td>
* <td><p> Perform a token counting.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> countTokens(CountTokensRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> countTokens(EndpointName endpoint, List&lt;Value&gt; instances)
* <li><p> countTokens(String endpoint, List&lt;Value&gt; instances)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> countTokensCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ComputeTokens</td>
* <td><p> Return a list of tokens based on the input text.</td>
* <td>
Expand Down Expand Up @@ -280,142 +261,6 @@ public LlmUtilityServiceStub getStub() {
return stub;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a token counting.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (LlmUtilityServiceClient llmUtilityServiceClient = LlmUtilityServiceClient.create()) {
* EndpointName endpoint =
* EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
* List<Value> instances = new ArrayList<>();
* CountTokensResponse response = llmUtilityServiceClient.countTokens(endpoint, instances);
* }
* }</pre>
*
* @param endpoint Required. The name of the Endpoint requested to perform token counting. Format:
* `projects/{project}/locations/{location}/endpoints/{endpoint}`
* @param instances Required. The instances that are the input to token counting call. Schema is
* identical to the prediction schema of the underlying model.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CountTokensResponse countTokens(EndpointName endpoint, List<Value> instances) {
CountTokensRequest request =
CountTokensRequest.newBuilder()
.setEndpoint(endpoint == null ? null : endpoint.toString())
.addAllInstances(instances)
.build();
return countTokens(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a token counting.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (LlmUtilityServiceClient llmUtilityServiceClient = LlmUtilityServiceClient.create()) {
* String endpoint =
* EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString();
* List<Value> instances = new ArrayList<>();
* CountTokensResponse response = llmUtilityServiceClient.countTokens(endpoint, instances);
* }
* }</pre>
*
* @param endpoint Required. The name of the Endpoint requested to perform token counting. Format:
* `projects/{project}/locations/{location}/endpoints/{endpoint}`
* @param instances Required. The instances that are the input to token counting call. Schema is
* identical to the prediction schema of the underlying model.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CountTokensResponse countTokens(String endpoint, List<Value> instances) {
CountTokensRequest request =
CountTokensRequest.newBuilder().setEndpoint(endpoint).addAllInstances(instances).build();
return countTokens(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a token counting.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (LlmUtilityServiceClient llmUtilityServiceClient = LlmUtilityServiceClient.create()) {
* CountTokensRequest request =
* CountTokensRequest.newBuilder()
* .setEndpoint(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setModel("model104069929")
* .addAllInstances(new ArrayList<Value>())
* .addAllContents(new ArrayList<Content>())
* .build();
* CountTokensResponse response = llmUtilityServiceClient.countTokens(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CountTokensResponse countTokens(CountTokensRequest request) {
return countTokensCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a token counting.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (LlmUtilityServiceClient llmUtilityServiceClient = LlmUtilityServiceClient.create()) {
* CountTokensRequest request =
* CountTokensRequest.newBuilder()
* .setEndpoint(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setModel("model104069929")
* .addAllInstances(new ArrayList<Value>())
* .addAllContents(new ArrayList<Content>())
* .build();
* ApiFuture<CountTokensResponse> future =
* llmUtilityServiceClient.countTokensCallable().futureCall(request);
* // Do something.
* CountTokensResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CountTokensRequest, CountTokensResponse> countTokensCallable() {
return stub.countTokensCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Return a list of tokens based on the input text.
Expand Down
Expand Up @@ -58,7 +58,7 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of countTokens to 30 seconds:
* <p>For example, to set the total timeout of computeTokens to 30 seconds:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
Expand All @@ -69,10 +69,10 @@
* LlmUtilityServiceSettings.Builder llmUtilityServiceSettingsBuilder =
* LlmUtilityServiceSettings.newBuilder();
* llmUtilityServiceSettingsBuilder
* .countTokensSettings()
* .computeTokensSettings()
* .setRetrySettings(
* llmUtilityServiceSettingsBuilder
* .countTokensSettings()
* .computeTokensSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
Expand All @@ -84,11 +84,6 @@
@Generated("by gapic-generator-java")
public class LlmUtilityServiceSettings extends ClientSettings<LlmUtilityServiceSettings> {

/** Returns the object with the settings used for calls to countTokens. */
public UnaryCallSettings<CountTokensRequest, CountTokensResponse> countTokensSettings() {
return ((LlmUtilityServiceStubSettings) getStubSettings()).countTokensSettings();
}

/** Returns the object with the settings used for calls to computeTokens. */
public UnaryCallSettings<ComputeTokensRequest, ComputeTokensResponse> computeTokensSettings() {
return ((LlmUtilityServiceStubSettings) getStubSettings()).computeTokensSettings();
Expand Down Expand Up @@ -218,12 +213,6 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to countTokens. */
public UnaryCallSettings.Builder<CountTokensRequest, CountTokensResponse>
countTokensSettings() {
return getStubSettingsBuilder().countTokensSettings();
}

/** Returns the builder for the settings used for calls to computeTokens. */
public UnaryCallSettings.Builder<ComputeTokensRequest, ComputeTokensResponse>
computeTokensSettings() {
Expand Down

0 comments on commit 0ee1383

Please sign in to comment.