Skip to content

Commit 8bd832e

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
Copybara import of the project:
-- 60b6b75 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add v1beta1 StreamingFetchFeatureValues API PiperOrigin-RevId: 615281865 Source-Link: googleapis/googleapis@f9f3c04 Source-Link: googleapis/googleapis-gen@1351a69 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTM1MWE2OTgxYzkwMWMyOWM0NDZiYjNjOWQwODNjMGU3ZGI4NTEwOCJ9 -- 7bb47f4 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md COPYBARA_INTEGRATE_REVIEW=#3428 from googleapis:owl-bot-copy 7bb47f4 PiperOrigin-RevId: 617333658
1 parent d6cbd71 commit 8bd832e

15 files changed

+804
-2
lines changed

google/cloud/aiplatform_v1beta1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@
248248
from .types.feature_online_store_service import NearestNeighbors
249249
from .types.feature_online_store_service import SearchNearestEntitiesRequest
250250
from .types.feature_online_store_service import SearchNearestEntitiesResponse
251+
from .types.feature_online_store_service import StreamingFetchFeatureValuesRequest
252+
from .types.feature_online_store_service import StreamingFetchFeatureValuesResponse
251253
from .types.feature_online_store_service import FeatureViewDataFormat
252254
from .types.feature_registry_service import CreateFeatureGroupOperationMetadata
253255
from .types.feature_registry_service import CreateFeatureGroupRequest
@@ -1350,6 +1352,8 @@
13501352
"StreamDirectPredictResponse",
13511353
"StreamDirectRawPredictRequest",
13521354
"StreamDirectRawPredictResponse",
1355+
"StreamingFetchFeatureValuesRequest",
1356+
"StreamingFetchFeatureValuesResponse",
13531357
"StreamingPredictRequest",
13541358
"StreamingPredictResponse",
13551359
"StreamingRawPredictRequest",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,11 @@
755755
"methods": [
756756
"search_nearest_entities"
757757
]
758+
},
759+
"StreamingFetchFeatureValues": {
760+
"methods": [
761+
"streaming_fetch_feature_values"
762+
]
758763
}
759764
}
760765
},
@@ -770,6 +775,11 @@
770775
"methods": [
771776
"search_nearest_entities"
772777
]
778+
},
779+
"StreamingFetchFeatureValues": {
780+
"methods": [
781+
"streaming_fetch_feature_values"
782+
]
773783
}
774784
}
775785
},
@@ -785,6 +795,11 @@
785795
"methods": [
786796
"search_nearest_entities"
787797
]
798+
},
799+
"StreamingFetchFeatureValues": {
800+
"methods": [
801+
"streaming_fetch_feature_values"
802+
]
788803
}
789804
}
790805
}

google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
MutableMapping,
2323
MutableSequence,
2424
Optional,
25+
AsyncIterable,
26+
Awaitable,
27+
AsyncIterator,
2528
Sequence,
2629
Tuple,
2730
Type,
@@ -48,6 +51,7 @@
4851
from google.iam.v1 import policy_pb2 # type: ignore
4952
from google.longrunning import operations_pb2 # type: ignore
5053
from google.protobuf import struct_pb2 # type: ignore
54+
from google.rpc import status_pb2 # type: ignore
5155
from .transports.base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO
5256
from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport
5357
from .client import FeatureOnlineStoreServiceClient
@@ -391,6 +395,107 @@ async def sample_fetch_feature_values():
391395
# Done; return the response.
392396
return response
393397

398+
def streaming_fetch_feature_values(
399+
self,
400+
requests: Optional[
401+
AsyncIterator[
402+
feature_online_store_service.StreamingFetchFeatureValuesRequest
403+
]
404+
] = None,
405+
*,
406+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
407+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
408+
metadata: Sequence[Tuple[str, str]] = (),
409+
) -> Awaitable[
410+
AsyncIterable[feature_online_store_service.StreamingFetchFeatureValuesResponse]
411+
]:
412+
r"""Bidirectional streaming RPC to fetch feature values
413+
under a FeatureView. Requests may not have a one-to-one
414+
mapping to responses and responses may be returned
415+
out-of-order to reduce latency.
416+
417+
.. code-block:: python
418+
419+
# This snippet has been automatically generated and should be regarded as a
420+
# code template only.
421+
# It will require modifications to work:
422+
# - It may require correct/in-range values for request initialization.
423+
# - It may require specifying regional endpoints when creating the service
424+
# client as shown in:
425+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
426+
from google.cloud import aiplatform_v1beta1
427+
428+
async def sample_streaming_fetch_feature_values():
429+
# Create a client
430+
client = aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient()
431+
432+
# Initialize request argument(s)
433+
request = aiplatform_v1beta1.StreamingFetchFeatureValuesRequest(
434+
feature_view="feature_view_value",
435+
)
436+
437+
# This method expects an iterator which contains
438+
# 'aiplatform_v1beta1.StreamingFetchFeatureValuesRequest' objects
439+
# Here we create a generator that yields a single `request` for
440+
# demonstrative purposes.
441+
requests = [request]
442+
443+
def request_generator():
444+
for request in requests:
445+
yield request
446+
447+
# Make the request
448+
stream = await client.streaming_fetch_feature_values(requests=request_generator())
449+
450+
# Handle the response
451+
async for response in stream:
452+
print(response)
453+
454+
Args:
455+
requests (AsyncIterator[`google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesRequest`]):
456+
The request object AsyncIterator. Request message for
457+
[FeatureOnlineStoreService.StreamingFetchFeatureValues][google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService.StreamingFetchFeatureValues].
458+
For the entities requested, all features under the
459+
requested feature view will be returned.
460+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
461+
should be retried.
462+
timeout (float): The timeout for this request.
463+
metadata (Sequence[Tuple[str, str]]): Strings which should be
464+
sent along with the request as metadata.
465+
466+
Returns:
467+
AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]:
468+
Response message for
469+
[FeatureOnlineStoreService.StreamingFetchFeatureValues][google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService.StreamingFetchFeatureValues].
470+
471+
"""
472+
473+
# Wrap the RPC method; this adds retry and timeout information,
474+
# and friendly error handling.
475+
rpc = gapic_v1.method_async.wrap_method(
476+
self._client._transport.streaming_fetch_feature_values,
477+
default_timeout=None,
478+
client_info=DEFAULT_CLIENT_INFO,
479+
)
480+
481+
# Certain fields should be provided within the metadata header;
482+
# add these here.
483+
metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata(()),)
484+
485+
# Validate the universe domain.
486+
self._client._validate_universe_domain()
487+
488+
# Send the request.
489+
response = rpc(
490+
requests,
491+
retry=retry,
492+
timeout=timeout,
493+
metadata=metadata,
494+
)
495+
496+
# Done; return the response.
497+
return response
498+
394499
async def search_nearest_entities(
395500
self,
396501
request: Optional[

google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
MutableMapping,
2323
MutableSequence,
2424
Optional,
25+
Iterable,
26+
Iterator,
2527
Sequence,
2628
Tuple,
2729
Type,
@@ -53,6 +55,7 @@
5355
from google.iam.v1 import policy_pb2 # type: ignore
5456
from google.longrunning import operations_pb2 # type: ignore
5557
from google.protobuf import struct_pb2 # type: ignore
58+
from google.rpc import status_pb2 # type: ignore
5659
from .transports.base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO
5760
from .transports.grpc import FeatureOnlineStoreServiceGrpcTransport
5861
from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport
@@ -801,6 +804,101 @@ def sample_fetch_feature_values():
801804
# Done; return the response.
802805
return response
803806

807+
def streaming_fetch_feature_values(
808+
self,
809+
requests: Optional[
810+
Iterator[feature_online_store_service.StreamingFetchFeatureValuesRequest]
811+
] = None,
812+
*,
813+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
814+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
815+
metadata: Sequence[Tuple[str, str]] = (),
816+
) -> Iterable[feature_online_store_service.StreamingFetchFeatureValuesResponse]:
817+
r"""Bidirectional streaming RPC to fetch feature values
818+
under a FeatureView. Requests may not have a one-to-one
819+
mapping to responses and responses may be returned
820+
out-of-order to reduce latency.
821+
822+
.. code-block:: python
823+
824+
# This snippet has been automatically generated and should be regarded as a
825+
# code template only.
826+
# It will require modifications to work:
827+
# - It may require correct/in-range values for request initialization.
828+
# - It may require specifying regional endpoints when creating the service
829+
# client as shown in:
830+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
831+
from google.cloud import aiplatform_v1beta1
832+
833+
def sample_streaming_fetch_feature_values():
834+
# Create a client
835+
client = aiplatform_v1beta1.FeatureOnlineStoreServiceClient()
836+
837+
# Initialize request argument(s)
838+
request = aiplatform_v1beta1.StreamingFetchFeatureValuesRequest(
839+
feature_view="feature_view_value",
840+
)
841+
842+
# This method expects an iterator which contains
843+
# 'aiplatform_v1beta1.StreamingFetchFeatureValuesRequest' objects
844+
# Here we create a generator that yields a single `request` for
845+
# demonstrative purposes.
846+
requests = [request]
847+
848+
def request_generator():
849+
for request in requests:
850+
yield request
851+
852+
# Make the request
853+
stream = client.streaming_fetch_feature_values(requests=request_generator())
854+
855+
# Handle the response
856+
for response in stream:
857+
print(response)
858+
859+
Args:
860+
requests (Iterator[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesRequest]):
861+
The request object iterator. Request message for
862+
[FeatureOnlineStoreService.StreamingFetchFeatureValues][google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService.StreamingFetchFeatureValues].
863+
For the entities requested, all features under the
864+
requested feature view will be returned.
865+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
866+
should be retried.
867+
timeout (float): The timeout for this request.
868+
metadata (Sequence[Tuple[str, str]]): Strings which should be
869+
sent along with the request as metadata.
870+
871+
Returns:
872+
Iterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]:
873+
Response message for
874+
[FeatureOnlineStoreService.StreamingFetchFeatureValues][google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService.StreamingFetchFeatureValues].
875+
876+
"""
877+
878+
# Wrap the RPC method; this adds retry and timeout information,
879+
# and friendly error handling.
880+
rpc = self._transport._wrapped_methods[
881+
self._transport.streaming_fetch_feature_values
882+
]
883+
884+
# Certain fields should be provided within the metadata header;
885+
# add these here.
886+
metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata(()),)
887+
888+
# Validate the universe domain.
889+
self._validate_universe_domain()
890+
891+
# Send the request.
892+
response = rpc(
893+
requests,
894+
retry=retry,
895+
timeout=timeout,
896+
metadata=metadata,
897+
)
898+
899+
# Done; return the response.
900+
return response
901+
804902
def search_nearest_entities(
805903
self,
806904
request: Optional[

google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ def _prep_wrapped_messages(self, client_info):
136136
default_timeout=None,
137137
client_info=client_info,
138138
),
139+
self.streaming_fetch_feature_values: gapic_v1.method.wrap_method(
140+
self.streaming_fetch_feature_values,
141+
default_timeout=None,
142+
client_info=client_info,
143+
),
139144
self.search_nearest_entities: gapic_v1.method.wrap_method(
140145
self.search_nearest_entities,
141146
default_timeout=None,
@@ -164,6 +169,18 @@ def fetch_feature_values(
164169
]:
165170
raise NotImplementedError()
166171

172+
@property
173+
def streaming_fetch_feature_values(
174+
self,
175+
) -> Callable[
176+
[feature_online_store_service.StreamingFetchFeatureValuesRequest],
177+
Union[
178+
feature_online_store_service.StreamingFetchFeatureValuesResponse,
179+
Awaitable[feature_online_store_service.StreamingFetchFeatureValuesResponse],
180+
],
181+
]:
182+
raise NotImplementedError()
183+
167184
@property
168185
def search_nearest_entities(
169186
self,

google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,40 @@ def fetch_feature_values(
262262
)
263263
return self._stubs["fetch_feature_values"]
264264

265+
@property
266+
def streaming_fetch_feature_values(
267+
self,
268+
) -> Callable[
269+
[feature_online_store_service.StreamingFetchFeatureValuesRequest],
270+
feature_online_store_service.StreamingFetchFeatureValuesResponse,
271+
]:
272+
r"""Return a callable for the streaming fetch feature values method over gRPC.
273+
274+
Bidirectional streaming RPC to fetch feature values
275+
under a FeatureView. Requests may not have a one-to-one
276+
mapping to responses and responses may be returned
277+
out-of-order to reduce latency.
278+
279+
Returns:
280+
Callable[[~.StreamingFetchFeatureValuesRequest],
281+
~.StreamingFetchFeatureValuesResponse]:
282+
A function that, when called, will call the underlying RPC
283+
on the server.
284+
"""
285+
# Generate a "stub function" on-the-fly which will actually make
286+
# the request.
287+
# gRPC handles serialization and deserialization, so we just need
288+
# to pass in the functions for each.
289+
if "streaming_fetch_feature_values" not in self._stubs:
290+
self._stubs[
291+
"streaming_fetch_feature_values"
292+
] = self.grpc_channel.stream_stream(
293+
"/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/StreamingFetchFeatureValues",
294+
request_serializer=feature_online_store_service.StreamingFetchFeatureValuesRequest.serialize,
295+
response_deserializer=feature_online_store_service.StreamingFetchFeatureValuesResponse.deserialize,
296+
)
297+
return self._stubs["streaming_fetch_feature_values"]
298+
265299
@property
266300
def search_nearest_entities(
267301
self,

0 commit comments

Comments
 (0)