Skip to content

Commit bae0315

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: add Feature Store: Streaming Ingestion (write_feature_values()) and introduce Preview namespace to Vertex SDK
PiperOrigin-RevId: 489080135
1 parent 43e2805 commit bae0315

File tree

6 files changed

+2098
-1523
lines changed

6 files changed

+2098
-1523
lines changed

google/cloud/aiplatform/base.py

+31
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
Sequence,
3636
Tuple,
3737
Type,
38+
TypeVar,
3839
Union,
3940
)
4041

@@ -1391,3 +1392,33 @@ def done(self) -> bool:
13911392
return super().done()
13921393

13931394
return False
1395+
1396+
1397+
# PreviewClass type variable
1398+
PreviewClass = TypeVar("PreviewClass", bound=VertexAiResourceNoun)
1399+
1400+
1401+
class PreviewMixin(abc.ABC):
1402+
"""An abstract class for adding preview functionality to certain classes.
1403+
A child class that inherits from both this Mixin and another parent
1404+
class allows the child class to introduce preview features.
1405+
"""
1406+
1407+
@classmethod
1408+
@property
1409+
@abc.abstractmethod
1410+
def _preview_class(cls: Type[PreviewClass]) -> Type[PreviewClass]:
1411+
"""Class that is currently in preview or has a preview feature.
1412+
Class must have `resource_name` and `credentials` attributes.
1413+
"""
1414+
pass
1415+
1416+
@property
1417+
def preview(self) -> PreviewClass:
1418+
"""Exposes features available in preview for this class."""
1419+
if not hasattr(self, "_preview_instance"):
1420+
self._preview_instance = self._preview_class(
1421+
self.resource_name, credentials=self.credentials
1422+
)
1423+
1424+
return self._preview_instance

0 commit comments

Comments
 (0)