Skip to content

Commit e9c48d9

Browse files
feat: [aiplatform] add SearchNearestEntities rpc to FeatureOnlineStoreService in aiplatform v1 (#10347)
* feat: add SearchNearestEntities rpc to FeatureOnlineStoreService in aiplatform v1 PiperOrigin-RevId: 604763557 Source-Link: googleapis/googleapis@5acba7c Source-Link: https://github.com/googleapis/googleapis-gen/commit/0f0c9b140781bc3831a30eae944f0831e522dea3 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>
1 parent cf52714 commit e9c48d9

File tree

22 files changed

+10260
-18
lines changed

22 files changed

+10260
-18
lines changed

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/FeatureOnlineStoreServiceClient.java

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,20 @@
9595
* </td>
9696
* </tr>
9797
* <tr>
98+
* <td><p> SearchNearestEntities</td>
99+
* <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>
100+
* <td>
101+
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
102+
* <ul>
103+
* <li><p> searchNearestEntities(SearchNearestEntitiesRequest request)
104+
* </ul>
105+
* <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>
106+
* <ul>
107+
* <li><p> searchNearestEntitiesCallable()
108+
* </ul>
109+
* </td>
110+
* </tr>
111+
* <tr>
98112
* <td><p> ListLocations</td>
99113
* <td><p> Lists information about the supported locations for this service.</td>
100114
* <td>
@@ -407,6 +421,79 @@ public final FetchFeatureValuesResponse fetchFeatureValues(FetchFeatureValuesReq
407421
return stub.fetchFeatureValuesCallable();
408422
}
409423

424+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
425+
/**
426+
* Search the nearest entities under a FeatureView. Search only works for indexable feature view;
427+
* if a feature view isn't indexable, returns Invalid argument response.
428+
*
429+
* <p>Sample code:
430+
*
431+
* <pre>{@code
432+
* // This snippet has been automatically generated and should be regarded as a code template only.
433+
* // It will require modifications to work:
434+
* // - It may require correct/in-range values for request initialization.
435+
* // - It may require specifying regional endpoints when creating the service client as shown in
436+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
437+
* try (FeatureOnlineStoreServiceClient featureOnlineStoreServiceClient =
438+
* FeatureOnlineStoreServiceClient.create()) {
439+
* SearchNearestEntitiesRequest request =
440+
* SearchNearestEntitiesRequest.newBuilder()
441+
* .setFeatureView(
442+
* FeatureViewName.of(
443+
* "[PROJECT]", "[LOCATION]", "[FEATURE_ONLINE_STORE]", "[FEATURE_VIEW]")
444+
* .toString())
445+
* .setQuery(NearestNeighborQuery.newBuilder().build())
446+
* .setReturnFullEntity(true)
447+
* .build();
448+
* SearchNearestEntitiesResponse response =
449+
* featureOnlineStoreServiceClient.searchNearestEntities(request);
450+
* }
451+
* }</pre>
452+
*
453+
* @param request The request object containing all of the parameters for the API call.
454+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
455+
*/
456+
public final SearchNearestEntitiesResponse searchNearestEntities(
457+
SearchNearestEntitiesRequest request) {
458+
return searchNearestEntitiesCallable().call(request);
459+
}
460+
461+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
462+
/**
463+
* Search the nearest entities under a FeatureView. Search only works for indexable feature view;
464+
* if a feature view isn't indexable, returns Invalid argument response.
465+
*
466+
* <p>Sample code:
467+
*
468+
* <pre>{@code
469+
* // This snippet has been automatically generated and should be regarded as a code template only.
470+
* // It will require modifications to work:
471+
* // - It may require correct/in-range values for request initialization.
472+
* // - It may require specifying regional endpoints when creating the service client as shown in
473+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
474+
* try (FeatureOnlineStoreServiceClient featureOnlineStoreServiceClient =
475+
* FeatureOnlineStoreServiceClient.create()) {
476+
* SearchNearestEntitiesRequest request =
477+
* SearchNearestEntitiesRequest.newBuilder()
478+
* .setFeatureView(
479+
* FeatureViewName.of(
480+
* "[PROJECT]", "[LOCATION]", "[FEATURE_ONLINE_STORE]", "[FEATURE_VIEW]")
481+
* .toString())
482+
* .setQuery(NearestNeighborQuery.newBuilder().build())
483+
* .setReturnFullEntity(true)
484+
* .build();
485+
* ApiFuture<SearchNearestEntitiesResponse> future =
486+
* featureOnlineStoreServiceClient.searchNearestEntitiesCallable().futureCall(request);
487+
* // Do something.
488+
* SearchNearestEntitiesResponse response = future.get();
489+
* }
490+
* }</pre>
491+
*/
492+
public final UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
493+
searchNearestEntitiesCallable() {
494+
return stub.searchNearestEntitiesCallable();
495+
}
496+
410497
// AUTO-GENERATED DOCUMENTATION AND METHOD.
411498
/**
412499
* Lists information about the supported locations for this service.

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/FeatureOnlineStoreServiceSettings.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ public class FeatureOnlineStoreServiceSettings
9191
return ((FeatureOnlineStoreServiceStubSettings) getStubSettings()).fetchFeatureValuesSettings();
9292
}
9393

94+
/** Returns the object with the settings used for calls to searchNearestEntities. */
95+
public UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
96+
searchNearestEntitiesSettings() {
97+
return ((FeatureOnlineStoreServiceStubSettings) getStubSettings())
98+
.searchNearestEntitiesSettings();
99+
}
100+
94101
/** Returns the object with the settings used for calls to listLocations. */
95102
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
96103
listLocationsSettings() {
@@ -222,6 +229,12 @@ public Builder applyToAllUnaryMethods(
222229
return getStubSettingsBuilder().fetchFeatureValuesSettings();
223230
}
224231

232+
/** Returns the builder for the settings used for calls to searchNearestEntities. */
233+
public UnaryCallSettings.Builder<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
234+
searchNearestEntitiesSettings() {
235+
return getStubSettingsBuilder().searchNearestEntitiesSettings();
236+
}
237+
225238
/** Returns the builder for the settings used for calls to listLocations. */
226239
public PagedCallSettings.Builder<
227240
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@
250250
"ListLocations": {
251251
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
252252
},
253+
"SearchNearestEntities": {
254+
"methods": ["searchNearestEntities", "searchNearestEntitiesCallable"]
255+
},
253256
"SetIamPolicy": {
254257
"methods": ["setIamPolicy", "setIamPolicyCallable"]
255258
},

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/FeatureOnlineStoreServiceStub.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import com.google.api.gax.rpc.UnaryCallable;
2323
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
2424
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
25+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
26+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
2527
import com.google.cloud.location.GetLocationRequest;
2628
import com.google.cloud.location.ListLocationsRequest;
2729
import com.google.cloud.location.ListLocationsResponse;
@@ -47,6 +49,11 @@ public abstract class FeatureOnlineStoreServiceStub implements BackgroundResourc
4749
throw new UnsupportedOperationException("Not implemented: fetchFeatureValuesCallable()");
4850
}
4951

52+
public UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
53+
searchNearestEntitiesCallable() {
54+
throw new UnsupportedOperationException("Not implemented: searchNearestEntitiesCallable()");
55+
}
56+
5057
public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
5158
listLocationsPagedCallable() {
5259
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/FeatureOnlineStoreServiceStubSettings.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import com.google.api.gax.rpc.UnaryCallable;
4343
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
4444
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
45+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
46+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
4547
import com.google.cloud.location.GetLocationRequest;
4648
import com.google.cloud.location.ListLocationsRequest;
4749
import com.google.cloud.location.ListLocationsResponse;
@@ -106,6 +108,8 @@ public class FeatureOnlineStoreServiceStubSettings
106108

107109
private final UnaryCallSettings<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
108110
fetchFeatureValuesSettings;
111+
private final UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
112+
searchNearestEntitiesSettings;
109113
private final PagedCallSettings<
110114
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
111115
listLocationsSettings;
@@ -174,6 +178,12 @@ public ApiFuture<ListLocationsPagedResponse> getFuturePagedResponse(
174178
return fetchFeatureValuesSettings;
175179
}
176180

181+
/** Returns the object with the settings used for calls to searchNearestEntities. */
182+
public UnaryCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
183+
searchNearestEntitiesSettings() {
184+
return searchNearestEntitiesSettings;
185+
}
186+
177187
/** Returns the object with the settings used for calls to listLocations. */
178188
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
179189
listLocationsSettings() {
@@ -292,6 +302,7 @@ protected FeatureOnlineStoreServiceStubSettings(Builder settingsBuilder) throws
292302
super(settingsBuilder);
293303

294304
fetchFeatureValuesSettings = settingsBuilder.fetchFeatureValuesSettings().build();
305+
searchNearestEntitiesSettings = settingsBuilder.searchNearestEntitiesSettings().build();
295306
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
296307
getLocationSettings = settingsBuilder.getLocationSettings().build();
297308
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
@@ -305,6 +316,9 @@ public static class Builder
305316
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
306317
private final UnaryCallSettings.Builder<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
307318
fetchFeatureValuesSettings;
319+
private final UnaryCallSettings.Builder<
320+
SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
321+
searchNearestEntitiesSettings;
308322
private final PagedCallSettings.Builder<
309323
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
310324
listLocationsSettings;
@@ -341,6 +355,7 @@ protected Builder(ClientContext clientContext) {
341355
super(clientContext);
342356

343357
fetchFeatureValuesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
358+
searchNearestEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
344359
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
345360
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
346361
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -350,6 +365,7 @@ protected Builder(ClientContext clientContext) {
350365
unaryMethodSettingsBuilders =
351366
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
352367
fetchFeatureValuesSettings,
368+
searchNearestEntitiesSettings,
353369
listLocationsSettings,
354370
getLocationSettings,
355371
setIamPolicySettings,
@@ -362,6 +378,7 @@ protected Builder(FeatureOnlineStoreServiceStubSettings settings) {
362378
super(settings);
363379

364380
fetchFeatureValuesSettings = settings.fetchFeatureValuesSettings.toBuilder();
381+
searchNearestEntitiesSettings = settings.searchNearestEntitiesSettings.toBuilder();
365382
listLocationsSettings = settings.listLocationsSettings.toBuilder();
366383
getLocationSettings = settings.getLocationSettings.toBuilder();
367384
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
@@ -371,6 +388,7 @@ protected Builder(FeatureOnlineStoreServiceStubSettings settings) {
371388
unaryMethodSettingsBuilders =
372389
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
373390
fetchFeatureValuesSettings,
391+
searchNearestEntitiesSettings,
374392
listLocationsSettings,
375393
getLocationSettings,
376394
setIamPolicySettings,
@@ -396,6 +414,11 @@ private static Builder initDefaults(Builder builder) {
396414
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
397415
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
398416

417+
builder
418+
.searchNearestEntitiesSettings()
419+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
420+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
421+
399422
builder
400423
.listLocationsSettings()
401424
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
@@ -445,6 +468,12 @@ public Builder applyToAllUnaryMethods(
445468
return fetchFeatureValuesSettings;
446469
}
447470

471+
/** Returns the builder for the settings used for calls to searchNearestEntities. */
472+
public UnaryCallSettings.Builder<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
473+
searchNearestEntitiesSettings() {
474+
return searchNearestEntitiesSettings;
475+
}
476+
448477
/** Returns the builder for the settings used for calls to listLocations. */
449478
public PagedCallSettings.Builder<
450479
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcFeatureOnlineStoreServiceStub.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.google.api.gax.rpc.UnaryCallable;
2828
import com.google.cloud.aiplatform.v1.FetchFeatureValuesRequest;
2929
import com.google.cloud.aiplatform.v1.FetchFeatureValuesResponse;
30+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesRequest;
31+
import com.google.cloud.aiplatform.v1.SearchNearestEntitiesResponse;
3032
import com.google.cloud.location.GetLocationRequest;
3133
import com.google.cloud.location.ListLocationsRequest;
3234
import com.google.cloud.location.ListLocationsResponse;
@@ -63,6 +65,18 @@ public class GrpcFeatureOnlineStoreServiceStub extends FeatureOnlineStoreService
6365
ProtoUtils.marshaller(FetchFeatureValuesResponse.getDefaultInstance()))
6466
.build();
6567

68+
private static final MethodDescriptor<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
69+
searchNearestEntitiesMethodDescriptor =
70+
MethodDescriptor.<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>newBuilder()
71+
.setType(MethodDescriptor.MethodType.UNARY)
72+
.setFullMethodName(
73+
"google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities")
74+
.setRequestMarshaller(
75+
ProtoUtils.marshaller(SearchNearestEntitiesRequest.getDefaultInstance()))
76+
.setResponseMarshaller(
77+
ProtoUtils.marshaller(SearchNearestEntitiesResponse.getDefaultInstance()))
78+
.build();
79+
6680
private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse>
6781
listLocationsMethodDescriptor =
6882
MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder()
@@ -111,6 +125,8 @@ public class GrpcFeatureOnlineStoreServiceStub extends FeatureOnlineStoreService
111125

112126
private final UnaryCallable<FetchFeatureValuesRequest, FetchFeatureValuesResponse>
113127
fetchFeatureValuesCallable;
128+
private final UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
129+
searchNearestEntitiesCallable;
114130
private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable;
115131
private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
116132
listLocationsPagedCallable;
@@ -176,6 +192,18 @@ protected GrpcFeatureOnlineStoreServiceStub(
176192
return builder.build();
177193
})
178194
.build();
195+
GrpcCallSettings<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
196+
searchNearestEntitiesTransportSettings =
197+
GrpcCallSettings
198+
.<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>newBuilder()
199+
.setMethodDescriptor(searchNearestEntitiesMethodDescriptor)
200+
.setParamsExtractor(
201+
request -> {
202+
RequestParamsBuilder builder = RequestParamsBuilder.create();
203+
builder.add("feature_view", String.valueOf(request.getFeatureView()));
204+
return builder.build();
205+
})
206+
.build();
179207
GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings =
180208
GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder()
181209
.setMethodDescriptor(listLocationsMethodDescriptor)
@@ -233,6 +261,11 @@ protected GrpcFeatureOnlineStoreServiceStub(
233261
fetchFeatureValuesTransportSettings,
234262
settings.fetchFeatureValuesSettings(),
235263
clientContext);
264+
this.searchNearestEntitiesCallable =
265+
callableFactory.createUnaryCallable(
266+
searchNearestEntitiesTransportSettings,
267+
settings.searchNearestEntitiesSettings(),
268+
clientContext);
236269
this.listLocationsCallable =
237270
callableFactory.createUnaryCallable(
238271
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
@@ -268,6 +301,12 @@ public GrpcOperationsStub getOperationsStub() {
268301
return fetchFeatureValuesCallable;
269302
}
270303

304+
@Override
305+
public UnaryCallable<SearchNearestEntitiesRequest, SearchNearestEntitiesResponse>
306+
searchNearestEntitiesCallable() {
307+
return searchNearestEntitiesCallable;
308+
}
309+
271310
@Override
272311
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
273312
return listLocationsCallable;

0 commit comments

Comments
 (0)