| // |
| // Copyright (C) 2018 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| // |
| |
| file_identifier "TC3A"; |
| |
| // Options to specify triggering behaviour per action class. |
| namespace libtextclassifier3; |
| table ActionTypeOptions { |
| // The name of the predicted action. |
| name:string; |
| |
| // Triggering behaviour. |
| // Whether the action class is considered in the model output or not. |
| enabled:bool = true; |
| |
| // Minimal output score threshold. |
| min_triggering_score:float = 0; |
| } |
| |
| // TensorFlow Lite model for suggesting actions. |
| namespace libtextclassifier3; |
| table TensorflowLiteModelSpec { |
| // TensorFlow Lite model for suggesting actions. |
| tflite_model:[ubyte] (force_align: 16); |
| |
| // Input specification. |
| input_user_id:int = 0; |
| |
| input_context:int = 1; |
| input_context_length:int = 2; |
| input_time_diffs:int = 3; |
| input_num_suggestions:int = 4; |
| |
| // Output specification. |
| output_replies:int = 0; |
| |
| output_replies_scores:int = 1; |
| output_sensitive_topic_score:int = 3; |
| output_triggering_score:int = 4; |
| output_actions_scores:int = 5; |
| } |
| |
| namespace libtextclassifier3.AnnotationActionsSpec_; |
| table AnnotationMapping { |
| // The annotation collection. |
| annotation_collection:string; |
| |
| // The action name to use. |
| action_name:string; |
| |
| // Default score in case we do not use the annotation score. |
| default_score:float; |
| |
| // Whether to use the score of the annotation as the action score. |
| use_annotation_score:bool = true; |
| |
| // Minimum threshold for the annotation score for filtering. |
| min_annotation_score:float; |
| } |
| |
| // Configuration for actions based on annotatations. |
| namespace libtextclassifier3; |
| table AnnotationActionsSpec { |
| annotation_mapping:[libtextclassifier3.AnnotationActionsSpec_.AnnotationMapping]; |
| } |
| |
| namespace libtextclassifier3; |
| table ActionsModel { |
| // Comma-separated list of locales supported by the model as BCP 47 tags. |
| locales:string; |
| |
| // Version of the actions model. |
| version:int; |
| |
| // A name for the model that can be used e.g. for logging. |
| name:string; |
| |
| tflite_model_spec:libtextclassifier3.TensorflowLiteModelSpec; |
| |
| // Output classes. |
| smart_reply_action_type:string; |
| |
| action_type:[libtextclassifier3.ActionTypeOptions]; |
| |
| // Lower bound thresholds for model prediction output. |
| min_actions_confidence:float; |
| |
| min_triggering_confidence:float; |
| |
| // Maximum sensitive score for which actions and smart replies are shown. |
| max_sensitive_topic_score:float = 1; |
| |
| // Default number of smart reply predictions. |
| num_smart_replies:int = 3; |
| |
| // Length of message history to consider, -1 if unbounded. |
| max_conversation_history_length:int = 1; |
| |
| // Filtering behaviour. |
| // Whether to supress all model output when a conversation is classified as |
| // sensitive. |
| suppress_on_sensitive_topic:bool = true; |
| |
| // Thresholds on the model prediction input. |
| // The minimal length of input to consider for prediction. |
| min_input_length:int = 0; |
| |
| // The maximal length of input to consider for prediciton, -1 if unbounded. |
| max_input_length:int = -1; |
| |
| // Configuration for mapping annotations to action suggestions. |
| annotation_actions_spec:libtextclassifier3.AnnotationActionsSpec; |
| } |
| |
| root_type libtextclassifier3.ActionsModel; |