Skip to content

Commit

Permalink
feat: Fix typo in Vertex Feature Store SDK.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 627854409
  • Loading branch information
vertex-sdk-bot authored and Copybara-Service committed Apr 24, 2024
1 parent c56dd50 commit b5404e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/unit/vertexai/test_feature_online_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,9 @@ def test_create_embedding_fv(
FeatureView.BigQuerySource(uri="hi", entity_id_columns=["entity_id"]),
index_config=IndexConfig(
embedding_column="embedding",
filter_column=["currency_code", "gender", "shipping_country_codes"],
dimensions=1536,
filter_columns=["currency_code", "gender", "shipping_country_codes"],
crowding_column="crowding",
dimentions=1536,
distance_measure_type=DistanceMeasureType.SQUARED_L2_DISTANCE,
algorithm_config=TreeAhConfig(),
),
Expand Down
20 changes: 12 additions & 8 deletions vertexai/resources/preview/feature_store/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ class IndexConfig:
"""Configuration options for the Vertex FeatureView for embedding."""

embedding_column: str
filter_column: List[str]
crowding_column: str
dimentions: Optional[int]
distance_measure_type: DistanceMeasureType
dimensions: int
algorithm_config: AlgorithmConfig
filter_columns: Optional[List[str]] = None
crowding_column: Optional[str] = None
distance_measure_type: Optional[DistanceMeasureType] = None

def as_dict(self) -> Dict[str, Any]:
"""Returns the configuration as a dictionary.
Expand All @@ -144,11 +144,15 @@ def as_dict(self) -> Dict[str, Any]:
"""
config = {
"embedding_column": self.embedding_column,
"filter_columns": self.filter_column,
"crowding_column": self.crowding_column,
"embedding_dimension": self.dimentions,
"distance_measure_type": self.distance_measure_type.value,
"embedding_dimension": self.dimensions,
}
if self.distance_measure_type is not None:
config["distance_measure_type"] = self.distance_measure_type.value
if self.filter_columns is not None:
config["filter_columns"] = self.filter_columns
if self.crowding_column is not None:
config["crowding_column"] = self.crowding_column

if isinstance(self.algorithm_config, TreeAhConfig):
config["tree_ah_config"] = self.algorithm_config.as_dict()
else:
Expand Down

0 comments on commit b5404e7

Please sign in to comment.