11syntax = "proto3" ;
22
3- package google.cloud.aiplatform.container.v1beta1 ;
3+ package google.cloud.aiplatform.container.v1 ;
44
55import "google/rpc/status.proto" ;
66
@@ -14,6 +14,10 @@ service MatchService {
1414 // Returns the nearest neighbors for batch queries. If it is a sharded
1515 // deployment, calls the other shards and aggregates the responses.
1616 rpc BatchMatch (BatchMatchRequest ) returns (BatchMatchResponse ) {}
17+
18+ // Looks up the embeddings.
19+ rpc BatchGetEmbeddings (BatchGetEmbeddingsRequest )
20+ returns (BatchGetEmbeddingsResponse ) {}
1721}
1822
1923// Parameters for a match query.
@@ -56,6 +60,28 @@ message MatchRequest {
5660 // not set or set to 0.0, query uses the default value specified in
5761 // NearestNeighborSearchConfig.TreeAHConfig.leaf_nodes_to_search_percent.
5862 int32 leaf_nodes_to_search_percent_override = 7 ;
63+
64+ // If set to true, besides the doc id, query result will also include the
65+ // embedding. Set this value may impact the query performance (e.g, increase
66+ // query latency, etc).
67+ bool embedding_enabled = 8 ;
68+ }
69+
70+ // Embedding on query result.
71+ message Embedding {
72+ // The id of the matched neighbor.
73+ string id = 1 ;
74+
75+ // The embedding values.
76+ repeated float float_val = 2 ;
77+
78+ // The list of restricts.
79+ repeated Namespace restricts = 3 ;
80+
81+ // The attribute value used for crowding. The maximum number of neighbors
82+ // to return per crowding attribute value
83+ // (per_crowding_attribute_num_neighbors) is configured per-query.
84+ int64 crowding_attribute = 4 ;
5985}
6086
6187// Response of a match query.
@@ -66,9 +92,32 @@ message MatchResponse {
6692
6793 // The distances of the matches.
6894 double distance = 2 ;
95+
96+ // If crowding is enabled, the crowding attribute of this neighbor will
97+ // be stored here.
98+ int64 crowding_attribute = 3 ;
6999 }
70100 // All its neighbors.
71101 repeated Neighbor neighbor = 1 ;
102+
103+ // Embedding values for all returned neighbors.
104+ // This is only set when query.embedding_enabled is set to true.
105+ repeated Embedding embeddings = 2 ;
106+ }
107+
108+ // Request of a Batch Get Embeddings query.
109+ message BatchGetEmbeddingsRequest {
110+ // The ID of the DeploydIndex that will serve the request.
111+ string deployed_index_id = 1 ;
112+
113+ // The ids to be looked up.
114+ repeated string id = 2 ;
115+ }
116+
117+ // Response of a Batch Get Embeddings query.
118+ message BatchGetEmbeddingsResponse {
119+ // Embedding values for all ids in the query request.
120+ repeated Embedding embeddings = 1 ;
72121}
73122
74123// Parameters for a batch match query.
0 commit comments