Skip to content

Commit

Permalink
feat: [aiplatform] add SearchNearestEntities rpc to FeatureOnlineStor…
Browse files Browse the repository at this point in the history
…eService in aiplatform v1 (#10347)

* feat: add SearchNearestEntities rpc to FeatureOnlineStoreService in aiplatform v1

PiperOrigin-RevId: 604763557

Source-Link: googleapis/googleapis@5acba7c

Source-Link: googleapis/googleapis-gen@0f0c9b1
Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiIwZjBjOWIxNDA3ODFiYzM4MzFhMzBlYWU5NDRmMDgzMWU1MjJkZWEzIn0=

* 🦉 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 8, 2024
1 parent cf52714 commit e9c48d9
Show file tree
Hide file tree
Showing 22 changed files with 10,260 additions and 18 deletions.
Expand Up @@ -95,6 +95,20 @@
* </td>
* </tr>
* <tr>
* <td><p> SearchNearestEntities</td>
* <td><p> Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a feature view isn't indexable, returns Invalid argument response.</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> searchNearestEntities(SearchNearestEntitiesRequest request)
* </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> searchNearestEntitiesCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ListLocations</td>
* <td><p> Lists information about the supported locations for this service.</td>
* <td>
Expand Down Expand Up @@ -407,6 +421,79 @@ public final FetchFeatureValuesResponse fetchFeatureValues(FetchFeatureValuesReq
return stub.fetchFeatureValuesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Search the nearest entities under a FeatureView. Search only works for indexable feature view;
* if a feature view isn't indexable, returns Invalid argument response.
*
* <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 (FeatureOnlineStoreServiceClient featureOnlineStoreServiceClient =
* FeatureOnlineStoreServiceClient.create()) {
* SearchNearestEntitiesRequest request =
* SearchNearestEntitiesRequest.newBuilder()
* .setFeatureView(
* FeatureViewName.of(
* "[PROJECT]", "[LOCATION]", "[FEATURE_ONLINE_STORE]", "[FEATURE_VIEW]")
* .toString())
* .setQuery(NearestNeighborQuery.newBuilder().build())
* .setReturnFullEntity(true)
* .build();
* SearchNearestEntitiesResponse response =
* featureOnlineStoreServiceClient.searchNearestEntities(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 SearchNearestEntitiesResponse searchNearestEntities(
SearchNearestEntitiesRequest request) {
return searchNearestEntitiesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Search the nearest entities under a FeatureView. Search only works for indexable feature view;
* if a feature view isn't indexable, returns Invalid argument response.
*
* <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 (FeatureOnlineStoreServiceClient featureOnlineStoreServiceClient =
* FeatureOnlineStoreServiceClient.create()) {
* SearchNearestEntitiesRequest request =
* SearchNearestEntitiesRequest.newBuilder()
* .setFeatureView(
* FeatureViewName.of(
* "[PROJECT]", "[LOCATION]", "[FEATURE_ONLINE_STORE]", "[FEATURE_VIEW]")
* .toString())
* .setQuery(NearestNeighborQuery.newBuilder().build())
* .setReturnFullEntity(true)
* .build();
* ApiFuture<SearchNearestEntitiesResponse> future =
* featureOnlineStoreServiceClient.searchNearestEntitiesCallable().futureCall(request);
* // Do something.
* SearchNearestEntitiesResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesCallable() {
return stub.searchNearestEntitiesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Expand Up @@ -91,6 +91,13 @@ public class FeatureOnlineStoreServiceSettings
return ((FeatureOnlineStoreServiceStubSettings) getStubSettings()).fetchFeatureValuesSettings();
}

/** Returns the object with the settings used for calls to searchNearestEntities. */
public UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings() {
return ((FeatureOnlineStoreServiceStubSettings) getStubSettings())
.searchNearestEntitiesSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -222,6 +229,12 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().fetchFeatureValuesSettings();
}

/** Returns the builder for the settings used for calls to searchNearestEntities. */
public UnaryCallSettings.Builder<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings() {
return getStubSettingsBuilder().searchNearestEntitiesSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Expand Up @@ -250,6 +250,9 @@
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
"SearchNearestEntities": {
"methods": ["searchNearestEntities", "searchNearestEntitiesCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
Expand Down
Expand Up @@ -22,6 +22,8 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand All @@ -47,6 +49,11 @@ public abstract class FeatureOnlineStoreServiceStub implements BackgroundResourc
throw new UnsupportedOperationException("Not implemented: fetchFeatureValuesCallable()");
}

public UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesCallable() {
throw new UnsupportedOperationException("Not implemented: searchNearestEntitiesCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Expand Up @@ -42,6 +42,8 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -106,6 +108,8 @@ public class FeatureOnlineStoreServiceStubSettings

private final UnaryCallSettings<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
fetchFeatureValuesSettings;
private final UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -174,6 +178,12 @@ public ApiFuture<ListLocationsPagedResponse> getFuturePagedResponse(
return fetchFeatureValuesSettings;
}

/** Returns the object with the settings used for calls to searchNearestEntities. */
public UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings() {
return searchNearestEntitiesSettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -292,6 +302,7 @@ protected FeatureOnlineStoreServiceStubSettings(Builder settingsBuilder) throws
super(settingsBuilder);

fetchFeatureValuesSettings = settingsBuilder.fetchFeatureValuesSettings().build();
searchNearestEntitiesSettings = settingsBuilder.searchNearestEntitiesSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
Expand All @@ -305,6 +316,9 @@ public static class Builder
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
fetchFeatureValuesSettings;
private final UnaryCallSettings.Builder<
SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -341,6 +355,7 @@ protected Builder(ClientContext clientContext) {
super(clientContext);

fetchFeatureValuesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
searchNearestEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand All @@ -350,6 +365,7 @@ protected Builder(ClientContext clientContext) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
fetchFeatureValuesSettings,
searchNearestEntitiesSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand All @@ -362,6 +378,7 @@ protected Builder(FeatureOnlineStoreServiceStubSettings settings) {
super(settings);

fetchFeatureValuesSettings = settings.fetchFeatureValuesSettings.toBuilder();
searchNearestEntitiesSettings = settings.searchNearestEntitiesSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
Expand All @@ -371,6 +388,7 @@ protected Builder(FeatureOnlineStoreServiceStubSettings settings) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
fetchFeatureValuesSettings,
searchNearestEntitiesSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand All @@ -396,6 +414,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.searchNearestEntitiesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
Expand Down Expand Up @@ -445,6 +468,12 @@ public Builder applyToAllUnaryMethods(
return fetchFeatureValuesSettings;
}

/** Returns the builder for the settings used for calls to searchNearestEntities. */
public UnaryCallSettings.Builder<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesSettings() {
return searchNearestEntitiesSettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Expand Up @@ -27,6 +27,8 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -63,6 +65,18 @@ public class GrpcFeatureOnlineStoreServiceStub extends FeatureOnlineStoreService
ProtoUtils.marshaller(FetchFeatureValuesResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesMethodDescriptor =
MethodDescriptor.<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities")
.setRequestMarshaller(
ProtoUtils.marshaller(SearchNearestEntitiesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(SearchNearestEntitiesResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse>
listLocationsMethodDescriptor =
MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder()
Expand Down Expand Up @@ -111,6 +125,8 @@ public class GrpcFeatureOnlineStoreServiceStub extends FeatureOnlineStoreService

private final UnaryCallable<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
fetchFeatureValuesCallable;
private final UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable;
Expand Down Expand Up @@ -176,6 +192,18 @@ protected GrpcFeatureOnlineStoreServiceStub(
return builder.build();
})
.build();
GrpcCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesTransportSettings =
GrpcCallSettings
.<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>newBuilder()
.setMethodDescriptor(searchNearestEntitiesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("feature_view", String.valueOf(request.getFeatureView()));
return builder.build();
})
.build();
GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings =
GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
Expand Down Expand Up @@ -233,6 +261,11 @@ protected GrpcFeatureOnlineStoreServiceStub(
fetchFeatureValuesTransportSettings,
settings.fetchFeatureValuesSettings(),
clientContext);
this.searchNearestEntitiesCallable =
callableFactory.createUnaryCallable(
searchNearestEntitiesTransportSettings,
settings.searchNearestEntitiesSettings(),
clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
Expand Down Expand Up @@ -268,6 +301,12 @@ public GrpcOperationsStub getOperationsStub() {
return fetchFeatureValuesCallable;
}

@Override
public UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
searchNearestEntitiesCallable() {
return searchNearestEntitiesCallable;
}

@Override
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
return listLocationsCallable;
Expand Down

0 comments on commit e9c48d9

Please sign in to comment.