@@ -1069,6 +1069,62 @@ message Document { |
1069 | 1069 | repeated Chunk chunks = 1; |
1070 | 1070 | } |
1071 | 1071 |
|
| 1072 | + // The output of the validation given the document and the validation rules. |
| 1073 | + message EntityValidationOutput { |
| 1074 | + // Validation result for a single validation rule. |
| 1075 | + message ValidationResult { |
| 1076 | + // The result of the validation rule. |
| 1077 | + enum ValidationResultType { |
| 1078 | + // The validation result type is unspecified. |
| 1079 | + VALIDATION_RESULT_TYPE_UNSPECIFIED = 0; |
| 1080 | + |
| 1081 | + // The validation is valid. |
| 1082 | + VALIDATION_RESULT_TYPE_VALID = 1; |
| 1083 | + |
| 1084 | + // The validation is invalid. |
| 1085 | + VALIDATION_RESULT_TYPE_INVALID = 2; |
| 1086 | + |
| 1087 | + // The validation is skipped. |
| 1088 | + VALIDATION_RESULT_TYPE_SKIPPED = 3; |
| 1089 | + |
| 1090 | + // The validation is not applicable. |
| 1091 | + VALIDATION_RESULT_TYPE_NOT_APPLICABLE = 4; |
| 1092 | + } |
| 1093 | + |
| 1094 | + // The name of the validation rule. |
| 1095 | + string rule_name = 1; |
| 1096 | + |
| 1097 | + // The description of the validation rule. |
| 1098 | + string rule_description = 2; |
| 1099 | + |
| 1100 | + // The result of the validation rule. |
| 1101 | + ValidationResultType validation_result_type = 3; |
| 1102 | + |
| 1103 | + // The detailed information of the running the validation process using |
| 1104 | + // the entity from the document based on the validation rule. |
| 1105 | + string validation_details = 4; |
| 1106 | + } |
| 1107 | + |
| 1108 | + // The result of each validation rule. |
| 1109 | + repeated ValidationResult validation_results = 1; |
| 1110 | + |
| 1111 | + // The overall result of the validation, true if all applicable rules are |
| 1112 | + // valid. |
| 1113 | + bool pass_all_rules = 2; |
| 1114 | + } |
| 1115 | + |
| 1116 | + // Entity revision. |
| 1117 | + message EntitiesRevision { |
| 1118 | + // The revision id. |
| 1119 | + string revision_id = 1; |
| 1120 | + |
| 1121 | + // The entities in this revision. |
| 1122 | + repeated Entity entities = 2; |
| 1123 | + |
| 1124 | + // The entity validation output for this revision. |
| 1125 | + EntityValidationOutput entity_validation_output = 3; |
| 1126 | + } |
| 1127 | + |
1072 | 1128 | // Original source document from the user. |
1073 | 1129 | oneof source { |
1074 | 1130 | // Optional. Currently supports Google Cloud Storage URI of the form |
@@ -1129,4 +1185,20 @@ message Document { |
1129 | 1185 |
|
1130 | 1186 | // Document chunked based on chunking config. |
1131 | 1187 | ChunkedDocument chunked_document = 18; |
| 1188 | + |
| 1189 | + // The entity validation output for the document. This is the validation |
| 1190 | + // output for `document.entities` field. |
| 1191 | + EntityValidationOutput entity_validation_output = 21; |
| 1192 | + |
| 1193 | + // A list of entity revisions. The entity revisions are appended to the |
| 1194 | + // document in the processing order. This field can be used for comparing the |
| 1195 | + // entity extraction results at different stages of the processing. |
| 1196 | + repeated EntitiesRevision entities_revisions = 22; |
| 1197 | + |
| 1198 | + // The entity revision id that `document.entities` field is based on. |
| 1199 | + // If this field is set and `entities_revisions` is not empty, the entities in |
| 1200 | + // `document.entities` field are the entities in the entity revision with this |
| 1201 | + // id and `document.entity_validation_output` field is the |
| 1202 | + // `entity_validation_output` field in this entity revision. |
| 1203 | + string entities_revision_id = 23; |
1132 | 1204 | } |