Skip to content

Conversation

@shubham-maindola
Copy link

Summary

The aiplatform.MatchingEngineIndexEndpoint.find_neighbors() method returns results as
List[List[aiplatform.matching_engine.matching_engine_index_endpoint.MatchNeighbor]].
However, the current MatchNeighbor dataclass does not expose the embedding_metadata field,
even when return_full_datapoint=True and the API response includes the embeddingMetadata attribute.

Issue

When return_full_datapoint=True is set, the API correctly returns the full datapoint with
embeddingMetadata, but this metadata is silently dropped because the
MatchNeighbor class does not have a corresponding attribute to capture it.

Fix

The aiplatform_v1beta1.index.IndexDatapoint class already supports embedding_metadata.
This PR adds an embedding_metadata field to the MatchNeighbor dataclass and populates it
within the MatchNeighbor.from_index_datapoint() method.

Testing

Verified the fix locally by querying an index with return_full_datapoint=True.
The embedding_metadata field now appears correctly in the returned MatchNeighbor objects
and matches the data returned directly from the API.

Impact

This change enables users to access embedding_metadata when using
find_neighbors() through the Python SDK, bringing it to parity with the REST API behavior.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant