Skip to content

Commit 4e923f9

Browse files
Google APIscopybara-github
authored andcommitted
feat: add preview support for precision reranking via Ranking API. Includes free usage up to a specific quota for vector-search-2 users during the preview period
PiperOrigin-RevId: 910700163
1 parent 0236288 commit 4e923f9

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

google/cloud/vectorsearch/v1beta/data_object_search_service.proto

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import "google/cloud/vectorsearch/v1beta/common.proto";
2424
import "google/cloud/vectorsearch/v1beta/data_object.proto";
2525
import "google/cloud/vectorsearch/v1beta/embedding_config.proto";
2626
import "google/protobuf/struct.proto";
27+
import "google/rpc/status.proto";
2728

2829
option csharp_namespace = "Google.Cloud.VectorSearch.V1Beta";
2930
option go_package = "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb;vectorsearchpb";
@@ -325,6 +326,10 @@ message SearchResponseMetadata {
325326
// K-Nearest Neighbor (KNN) index engine.
326327
bool used_knn = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
327328
}
329+
330+
// Output only. Warnings or non-fatal errors that occurred during execution.
331+
repeated google.rpc.Status warnings = 3
332+
[(google.api.field_behavior) = OUTPUT_ONLY];
328333
}
329334

330335
// Response for a search request.
@@ -453,6 +458,13 @@ message Ranker {
453458
// Reciprocal Rank Fusion ranking.
454459
ReciprocalRankFusion rrf = 1;
455460
}
461+
462+
// The reranker to use for final ranking of the results combined by the
463+
// ranker.
464+
oneof reranker {
465+
// Optional. Vertex AI ranking.
466+
VertexRanker vertex_ranker = 2 [(google.api.field_behavior) = OPTIONAL];
467+
}
456468
}
457469

458470
// Defines the Reciprocal Rank Fusion (RRF) algorithm for result ranking.
@@ -461,6 +473,39 @@ message ReciprocalRankFusion {
461473
repeated double weights = 1 [(google.api.field_behavior) = REQUIRED];
462474
}
463475

476+
// Defines a ranker using the Vertex AI ranking service.
477+
// See https://cloud.google.com/generative-ai-app-builder/docs/ranking for
478+
// details.
479+
message VertexRanker {
480+
// The record spec for text search.
481+
message TextRecordSpec {
482+
// Required. The query against which the records are ranked and scored.
483+
string query = 1 [(google.api.field_behavior) = REQUIRED];
484+
485+
// Optional. The template used to generate the record's title.
486+
string title_template = 2 [(google.api.field_behavior) = OPTIONAL];
487+
488+
// Optional. The template used to generate the record's content.
489+
string content_template = 3 [(google.api.field_behavior) = OPTIONAL];
490+
}
491+
492+
// The record specification for ranking. At least one record spec must be
493+
// set.
494+
oneof record_spec {
495+
// The record spec for text search.
496+
TextRecordSpec text_record_spec = 6;
497+
}
498+
499+
// Required. The model used for ranking documents. The list of available
500+
// models is described in
501+
// https://docs.cloud.google.com/generative-ai-app-builder/docs/ranking#models.
502+
// Currently, only `semantic-ranker-fast@latest` is supported.
503+
string model = 4 [(google.api.field_behavior) = REQUIRED];
504+
505+
// Required. The number of documents to be processed for ranking.
506+
int32 top_n = 5 [(google.api.field_behavior) = REQUIRED];
507+
}
508+
464509
// A response from a batch search operation.
465510
message BatchSearchDataObjectsResponse {
466511
// Output only. A list of search responses, one for each request in the batch.

0 commit comments

Comments
 (0)