GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: return embedding metadata if available · silverdev/python-aiplatform@d9c6eb1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • google/cloud/aiplatform/matching_engine
    • matching_engine_index_endpoint.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py‎

Copy file name to clipboardExpand all lines: google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717

1818
from dataclasses import dataclass, field
19-
from typing import Dict, List, Optional, Sequence, Tuple, Union
19+
from typing import Dict, List, Optional, Sequence, Tuple, Union, Any, Mapping
2020

2121
from google.auth import credentials as auth_credentials
2222
from google.cloud.aiplatform import base
@@ -208,6 +208,8 @@ class MatchNeighbor:
208208
For example, values [1,2,3] with dimensions [4,5,6] means value 1 is
209209
of the 4th dimension, value 2 is of the 4th dimension, and value 3 is
210210
of the 6th dimension.
211+
embedding_metadata (Mapping[str, Any]):
212+
Optional. The corresponding embedding metadata of the matching datapoint.
211213
212214
"""
213215

@@ -220,6 +222,7 @@ class MatchNeighbor:
220222
numeric_restricts: Optional[List[NumericNamespace]] = None
221223
sparse_embedding_values: Optional[List[float]] = None
222224
sparse_embedding_dimensions: Optional[List[int]] = None
225+
embedding_metadata: Optional[Mapping[str, Any]] = None
223226

224227
def from_index_datapoint(
225228
self, index_datapoint: gca_index_v1beta1.IndexDatapoint
@@ -276,6 +279,9 @@ def from_index_datapoint(
276279
self.sparse_embedding_dimensions = (
277280
index_datapoint.sparse_embedding.dimensions
278281
)
282+
# retrieve embedding metadata
283+
if index_datapoint.embedding_metadata is not None:
284+
self.embedding_metadata = index_datapoint.embedding_metadata
279285
return self
280286

281287
def from_embedding(self, embedding: match_service_pb2.Embedding) -> "MatchNeighbor":

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.