Skip to content

Commit

Permalink
feat: expose confidence score filter
Browse files Browse the repository at this point in the history
fix: Changed proto3 optional flag of an existing field `search_strategy_type` in message `.google.cloud.visionai.v1.DataSchemaDetails`
fix: Changed proto3 optional flag of an existing field `type` in message `.google.cloud.visionai.v1.DataSchemaDetails`
fix: Changed proto3 optional flag of an existing field `granularity` in message `.google.cloud.visionai.v1.DataSchemaDetails`
docs: A comment for field `filter` in message `.google.cloud.visionai.v1.ListAnnotationsRequest` is changed
docs: A comment for field `hypernym` in message `.google.cloud.visionai.v1.SearchHypernym` is changed
docs: A comment for field `hyponyms` in message `.google.cloud.visionai.v1.SearchHypernym` is changed

PiperOrigin-RevId: 631562962
  • Loading branch information
Google APIs authored and Copybara-Service committed May 7, 2024
1 parent 3d50414 commit f059e8f
Showing 1 changed file with 85 additions and 7 deletions.
92 changes: 85 additions & 7 deletions google/cloud/visionai/v1/warehouse.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,73 @@ message DataSchemaDetails {

// The search strategy for annotations value of the `key`.
message SearchStrategy {
// Filter on the confidence score. Only adds to index if the confidence
// score is higher than the threshold.
// Example data schema:
// key: "name-confidence-pair"
// type: CUSTOMIZED_STRUCT
// granularity: GRANULARITY_PARTITION_LEVEL
// customized_struct_config {
// field_schemas {
// key: "name"
// type: STRING
// granularity: GRANULARITY_PARTITION_LEVEL
// search_strategy {
// search_strategy_type: SMART_SEARCH
// confidence_score_index_config {
// field_path: "name-confidence-pair.score"
// threshold: 0.6
// }
// }
// }
// field_schemas {
// key: "score"
// type: FLOAT
// granularity: GRANULARITY_PARTITION_LEVEL
// }
// }
// This means only "name" with score > 0.6 will be indexed.
message ConfidenceScoreIndexConfig {
// Required. The path to the confidence score field. It is a string that
// concatenates all the data schema keys along the path. See the example
// above. If the data schema contains LIST, use '_ENTRIES' to concatenate.
// Example data schema contains a list:
// "key": "list-name-score",
// "schemaDetails": {
// "type": "LIST",
// "granularity": "GRANULARITY_PARTITION_LEVEL",
// "listConfig": {
// "valueSchema": {
// "type": "CUSTOMIZED_STRUCT",
// "granularity": "GRANULARITY_PARTITION_LEVEL",
// "customizedStructConfig": {
// "fieldSchemas": {
// "name": {
// "type": "STRING",
// "granularity": "GRANULARITY_PARTITION_LEVEL",
// "searchStrategy": {
// "searchStrategyType": "SMART_SEARCH"
// "confidence_score_index_config": {
// "field_path": "list-name-score._ENTRIES.score",
// "threshold": "0.9",
// }
// }
// },
// "score": {
// "type": "FLOAT",
// "granularity": "GRANULARITY_PARTITION_LEVEL",
// }
// }
// }
// }
// }
// }
string field_path = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The threshold.
float threshold = 2 [(google.api.field_behavior) = REQUIRED];
}

// The types of search strategies to be applied on the annotation key.
enum SearchStrategyType {
// Annotatation values of the `key` above will not be searchable.
Expand All @@ -1805,7 +1872,14 @@ message DataSchemaDetails {
// which is documented in the DataSchemaDetails.DataType. Specifying
// unsupported `search_strategy_type` for data types will result in
// INVALID_ARGUMENT error.
SearchStrategyType search_strategy_type = 1;
optional SearchStrategyType search_strategy_type = 1;

// Optional. Configs the path to the confidence score, and the threshold.
// Only if the score is greater than the threshold, current field will be
// built into the index. Only applies to leaf nodes using EXACT_SEARCH or
// SMART_SEARCH.
ConfidenceScoreIndexConfig confidence_score_index_config = 2
[(google.api.field_behavior) = OPTIONAL];
}

// Data type of the annotation.
Expand Down Expand Up @@ -1916,7 +1990,7 @@ message DataSchemaDetails {
}

// Type of the annotation.
DataType type = 1;
optional DataType type = 1;

// Config for protobuf any type.
ProtoAnyConfig proto_any_config = 6;
Expand All @@ -1928,7 +2002,7 @@ message DataSchemaDetails {
CustomizedStructConfig customized_struct_config = 9;

// The granularity associated with this DataSchema.
Granularity granularity = 5;
optional Granularity granularity = 5;

// The search strategy to be applied on the `key` above.
SearchStrategy search_strategy = 7;
Expand Down Expand Up @@ -2140,8 +2214,12 @@ message ListAnnotationsRequest {

// The filter applied to the returned list.
// We only support filtering for the following fields:
// For corpus of STREAM_VIDEO type:
// `partition.temporal_partition.start_time`,
// `partition.temporal_partition.end_time`, and `key`.
// For corpus of VIDEO_ON_DEMAND type,
// `partition.relative_temporal_partition.start_offset`,
// `partition.relative_temporal_partition.end_offset`, and `key`.
// For corpus of IMAGE type, only `key` is supported.
// Timestamps are specified in the RFC-3339 format, and only one restriction
// may be applied per field, joined by conjunctions.
Expand Down Expand Up @@ -2726,11 +2804,11 @@ message SearchHypernym {
// `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}`
string name = 1;

// The hypernym.
string hypernym = 2;
// Optional. The hypernym.
string hypernym = 2 [(google.api.field_behavior) = OPTIONAL];

// Hyponyms that the hypernym is mapped to.
repeated string hyponyms = 3;
// Optional. Hyponyms that the hypernym is mapped to.
repeated string hyponyms = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for creating SearchHypernym.
Expand Down

0 comments on commit f059e8f

Please sign in to comment.