diff --git a/output/schema/schema.json b/output/schema/schema.json index 369ec4807b..33a331e39e 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -40106,7 +40106,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L53-L53" + "specLocation": "_types/aggregations/pipeline.ts#L57-L57" }, { "inherits": { @@ -40365,7 +40365,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L98-L104" + "specLocation": "_types/aggregations/pipeline.ts#L102-L108" }, { "kind": "interface", @@ -40387,7 +40387,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L106-L111" + "specLocation": "_types/aggregations/pipeline.ts#L110-L115" }, { "kind": "interface", @@ -40409,7 +40409,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L113-L116" + "specLocation": "_types/aggregations/pipeline.ts#L117-L120" }, { "kind": "interface", @@ -40461,7 +40461,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L118-L136" + "specLocation": "_types/aggregations/pipeline.ts#L122-L140" }, { "description": "A sibling pipeline aggregation which executes a two sample Kolmogorov–Smirnov test (referred\nto as a \"K-S test\" from now on) against a provided distribution, and the distribution implied\nby the documents counts in the configured sibling aggregation. Specifically, for some metric,\nassuming that the percentile intervals of the metric are known beforehand or have been computed\nby an aggregation, then one would use range aggregation for the sibling to compute the p-value\nof the distribution difference between the metric and the restriction of that metric to a subset\nof the documents. A natural use case is if the sibling aggregation range aggregation nested in a\nterms aggregation, in which case one compares the overall distribution of metric to its restriction\nto each term.", @@ -40520,7 +40520,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L63-L96" + "specLocation": "_types/aggregations/pipeline.ts#L67-L100" }, { "inherits": { @@ -40581,7 +40581,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L27-L33" + "specLocation": "_types/aggregations/pipeline.ts#L31-L37" }, { "inherits": { @@ -40608,7 +40608,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L55-L57" + "specLocation": "_types/aggregations/pipeline.ts#L59-L61" }, { "inherits": { @@ -40635,7 +40635,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L59-L61" + "specLocation": "_types/aggregations/pipeline.ts#L63-L65" }, { "inherits": { @@ -40695,7 +40695,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L138-L143" + "specLocation": "_types/aggregations/pipeline.ts#L142-L147" }, { "codegenNames": [ @@ -40761,7 +40761,7 @@ "name": "BucketsPath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L40-L46", + "specLocation": "_types/aggregations/pipeline.ts#L44-L50", "type": { "items": [ { @@ -41180,79 +41180,6 @@ ], "specLocation": "_types/aggregations/bucket.ts#L73-L75" }, - { - "kind": "interface", - "name": { - "name": "ClassificationInferenceOptions", - "namespace": "_types.aggregations" - }, - "properties": [ - { - "description": "Specifies the number of top class predictions to return. Defaults to 0.", - "name": "num_top_classes", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "description": "Specifies the maximum number of feature importance values per document.", - "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", - "name": "num_top_feature_importance_values", - "required": false, - "serverDefault": 0, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "description": "Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false.", - "name": "prediction_field_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", - "name": "results_field", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "Specifies the field to which the top classes are written. Defaults to top_classes.", - "name": "top_classes_results_field", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - } - ], - "specLocation": "_types/aggregations/pipeline.ts#L178-L193" - }, { "inherits": { "generics": [ @@ -41534,7 +41461,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L145-L145" + "specLocation": "_types/aggregations/pipeline.ts#L149-L149" }, { "inherits": { @@ -41549,7 +41476,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L147-L147" + "specLocation": "_types/aggregations/pipeline.ts#L151-L151" }, { "kind": "interface", @@ -42069,7 +41996,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L149-L149" + "specLocation": "_types/aggregations/pipeline.ts#L153-L153" }, { "inherits": { @@ -42228,7 +42155,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L238-L240" + "specLocation": "_types/aggregations/pipeline.ts#L215-L217" }, { "inherits": { @@ -42263,7 +42190,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L223-L226" + "specLocation": "_types/aggregations/pipeline.ts#L200-L203" }, { "generics": [ @@ -42580,7 +42507,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L151-L153" + "specLocation": "_types/aggregations/pipeline.ts#L155-L157" }, { "codegenNames": [ @@ -42813,7 +42740,7 @@ "name": "GapPolicy", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L48-L51" + "specLocation": "_types/aggregations/pipeline.ts#L52-L55" }, { "inherits": { @@ -43905,7 +43832,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L242-L245" + "specLocation": "_types/aggregations/pipeline.ts#L219-L222" }, { "inherits": { @@ -43940,7 +43867,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L228-L231" + "specLocation": "_types/aggregations/pipeline.ts#L205-L208" }, { "kind": "interface", @@ -44016,7 +43943,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L246-L253" + "specLocation": "_types/aggregations/pipeline.ts#L223-L230" }, { "inherits": { @@ -44051,7 +43978,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L233-L236" + "specLocation": "_types/aggregations/pipeline.ts#L210-L213" }, { "kind": "enum", @@ -44069,7 +43996,7 @@ "name": "HoltWintersType", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L254-L259" + "specLocation": "_types/aggregations/pipeline.ts#L231-L236" }, { "attachedBehaviors": [ @@ -44197,7 +44124,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L155-L158" + "specLocation": "_types/aggregations/pipeline.ts#L159-L162" }, { "kind": "interface", @@ -44246,7 +44173,7 @@ "kind": "instance_of", "type": { "name": "RegressionInferenceOptions", - "namespace": "_types.aggregations" + "namespace": "ml._types" } } }, @@ -44258,12 +44185,15 @@ "kind": "instance_of", "type": { "name": "ClassificationInferenceOptions", - "namespace": "_types.aggregations" + "namespace": "ml._types" } } } ], - "specLocation": "_types/aggregations/pipeline.ts#L160-L165" + "specLocation": "_types/aggregations/pipeline.ts#L164-L170", + "variants": { + "kind": "container" + } }, { "kind": "interface", @@ -44606,7 +44536,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L213-L216" + "specLocation": "_types/aggregations/pipeline.ts#L190-L193" }, { "description": "Result of the `rare_terms` aggregation when the field is some kind of whole number like a integer, long, or a date.", @@ -45024,7 +44954,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L195-L195" + "specLocation": "_types/aggregations/pipeline.ts#L172-L172" }, { "inherits": { @@ -45156,7 +45086,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L197-L197" + "specLocation": "_types/aggregations/pipeline.ts#L174-L174" }, { "kind": "enum", @@ -45309,7 +45239,7 @@ "name": "MovingAverageAggregation", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L199-L205", + "specLocation": "_types/aggregations/pipeline.ts#L176-L182", "type": { "items": [ { @@ -45402,7 +45332,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L207-L211" + "specLocation": "_types/aggregations/pipeline.ts#L184-L188" }, { "inherits": { @@ -45451,7 +45381,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L261-L265" + "specLocation": "_types/aggregations/pipeline.ts#L238-L242" }, { "inherits": { @@ -45500,7 +45430,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L267-L271" + "specLocation": "_types/aggregations/pipeline.ts#L244-L248" }, { "generics": [ @@ -45846,7 +45776,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L273-L275" + "specLocation": "_types/aggregations/pipeline.ts#L250-L252" }, { "kind": "enum", @@ -45875,7 +45805,7 @@ "name": "NormalizeMethod", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L277-L285" + "specLocation": "_types/aggregations/pipeline.ts#L254-L262" }, { "attachedBehaviors": [ @@ -46175,7 +46105,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L287-L289" + "specLocation": "_types/aggregations/pipeline.ts#L264-L266" }, { "inherits": { @@ -46213,7 +46143,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L35-L38" + "specLocation": "_types/aggregations/pipeline.ts#L39-L42" }, { "inherits": { @@ -46586,43 +46516,6 @@ }, "specLocation": "_types/aggregations/metric.ts#L123-L126" }, - { - "kind": "interface", - "name": { - "name": "RegressionInferenceOptions", - "namespace": "_types.aggregations" - }, - "properties": [ - { - "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", - "name": "results_field", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - } - }, - { - "description": "Specifies the maximum number of feature importance values per document.", - "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", - "name": "num_top_feature_importance_values", - "required": false, - "serverDefault": 0, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - } - ], - "specLocation": "_types/aggregations/pipeline.ts#L167-L176" - }, { "attachedBehaviors": [ "AdditionalProperties" @@ -46882,7 +46775,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L291-L293" + "specLocation": "_types/aggregations/pipeline.ts#L268-L270" }, { "inherits": { @@ -47478,7 +47371,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L218-L221" + "specLocation": "_types/aggregations/pipeline.ts#L195-L198" }, { "inherits": { @@ -48023,7 +47916,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L295-L295" + "specLocation": "_types/aggregations/pipeline.ts#L272-L272" }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", @@ -48396,7 +48289,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L297-L297" + "specLocation": "_types/aggregations/pipeline.ts#L274-L274" }, { "kind": "interface", @@ -118904,6 +118797,79 @@ }, "specLocation": "ml/_types/Datafeed.ts#L158-L162" }, + { + "kind": "interface", + "name": { + "name": "ClassificationInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Specifies the number of top class predictions to return. Defaults to 0.", + "name": "num_top_classes", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Specifies the maximum number of feature importance values per document.", + "docId": "ml-feature-importance", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", + "name": "num_top_feature_importance_values", + "required": false, + "serverDefault": 0, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false.", + "name": "prediction_field_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Specifies the field to which the top classes are written. Defaults to top_classes.", + "name": "top_classes_results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L75-L90" + }, { "kind": "enum", "members": [ @@ -122499,6 +122465,99 @@ }, "specLocation": "ml/_types/Detector.ts#L82-L87" }, + { + "description": "Fill mask inference options", + "kind": "interface", + "name": { + "name": "FillMaskInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Specifies the number of top class predictions to return. Defaults to 0.", + "name": "num_top_classes", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L230-L238" + }, + { + "kind": "interface", + "name": { + "name": "FillMaskInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Specifies the number of top class predictions to return. Defaults to 0.", + "name": "num_top_classes", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L323-L330" + }, { "kind": "interface", "name": { @@ -122861,6 +122920,122 @@ }, "specLocation": "ml/_types/Include.ts#L20-L42" }, + { + "description": "Inference configuration provided when storing the model config", + "kind": "interface", + "name": { + "name": "InferenceConfigCreateContainer", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Regression configuration for inference.", + "name": "regression", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RegressionInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Classification configuration for inference.", + "name": "classification", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ClassificationInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Text classification configuration for inference.", + "name": "text_classification", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "TextClassificationInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Zeroshot classification configuration for inference.", + "name": "zero_shot_classification", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "ZeroShotClassificationInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Fill mask configuration for inference.", + "name": "fill_mask", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "FillMaskInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Named entity recognition configuration for inference.", + "name": "ner", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "NerInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Pass through configuration for inference.", + "name": "pass_through", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "PassThroughInferenceOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Text embedding configuration for inference.", + "name": "text_embedding", + "required": false, + "since": "8.0.0", + "type": { + "kind": "instance_of", + "type": { + "name": "TextEmbeddingInferenceOptions", + "namespace": "ml._types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L23-L62", + "variants": { + "kind": "container" + } + }, { "kind": "interface", "name": { @@ -124380,6 +124555,361 @@ ], "specLocation": "ml/_types/Model.ts#L24-L45" }, + { + "description": "Named entity recognition options", + "kind": "interface", + "name": { + "name": "NerInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The token classification labels. Must be IOB formatted tags", + "name": "classification_labels", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L220-L228" + }, + { + "kind": "interface", + "name": { + "name": "NerInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L316-L321" + }, + { + "description": "BERT and MPNet tokenization configuration options", + "kind": "interface", + "name": { + "name": "NlpBertTokenizationConfig", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Should the tokenizer lower case the text", + "name": "do_lower_case", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Is tokenization completed with special tokens", + "name": "with_special_tokens", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Maximum input sequence length for the model", + "name": "max_sequence_length", + "required": false, + "serverDefault": 512, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Should tokenization input be automatically truncated before sending to the model for inference", + "name": "truncate", + "required": false, + "serverDefault": "first", + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationTruncate", + "namespace": "ml._types" + } + } + }, + { + "description": "Tokenization spanning options. Special value of -1 indicates no spanning takes place", + "name": "span", + "required": false, + "serverDefault": -1, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L111-L138" + }, + { + "kind": "interface", + "name": { + "name": "NlpInferenceConfigUpdateContainer", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Text classification configuration for inference.", + "name": "text_classification", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TextClassificationInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Zeroshot classification configuration for inference.", + "name": "zero_shot_classification", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ZeroShotClassificationInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Fill mask configuration for inference.", + "name": "fill_mask", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FillMaskInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Named entity recognition configuration for inference.", + "name": "ner", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NerInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Pass through configuration for inference.", + "name": "pass_through", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "PassThroughInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Text embedding configuration for inference.", + "name": "text_embedding", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TextEmbeddingInferenceUpdateOptions", + "namespace": "ml._types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L242-L256", + "variants": { + "kind": "container" + } + }, + { + "description": "RoBERTa tokenization configuration options", + "kind": "interface", + "name": { + "name": "NlpRobertaTokenizationConfig", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Should the tokenizer prefix input with a space character", + "name": "add_prefix_space", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Is tokenization completed with special tokens", + "name": "with_special_tokens", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Maximum input sequence length for the model", + "name": "max_sequence_length", + "required": false, + "serverDefault": 512, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Should tokenization input be automatically truncated before sending to the model for inference", + "name": "truncate", + "required": false, + "serverDefault": "first", + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationTruncate", + "namespace": "ml._types" + } + } + }, + { + "description": "Tokenization spanning options. Special value of -1 indicates no spanning takes place", + "name": "span", + "required": false, + "serverDefault": -1, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L140-L167" + }, + { + "kind": "interface", + "name": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Truncate options to apply", + "name": "truncate", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationTruncate", + "namespace": "ml._types" + } + } + }, + { + "description": "Span options to apply", + "name": "span", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L274-L279" + }, { "kind": "interface", "name": { @@ -124609,6 +125139,75 @@ ], "specLocation": "ml/_types/Page.ts#L22-L33" }, + { + "description": "Pass through configuration options", + "kind": "interface", + "name": { + "name": "PassThroughInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L204-L210" + }, + { + "kind": "interface", + "name": { + "name": "PassThroughInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L303-L308" + }, { "kind": "interface", "name": { @@ -124670,6 +125269,43 @@ "kind": "union_of" } }, + { + "kind": "interface", + "name": { + "name": "RegressionInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } + }, + { + "description": "Specifies the maximum number of feature importance values per document.", + "docId": "ml-feature-importance", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", + "name": "num_top_feature_importance_values", + "required": false, + "serverDefault": 0, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L64-L73" + }, { "kind": "enum", "members": [ @@ -124796,6 +125432,197 @@ ], "specLocation": "ml/_types/Datafeed.ts#L153-L156" }, + { + "description": "Text classification configuration options", + "kind": "interface", + "name": { + "name": "TextClassificationInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Specifies the number of top class predictions to return. Defaults to 0.", + "name": "num_top_classes", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The tokenization options", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels", + "name": "classification_labels", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L169-L179" + }, + { + "kind": "interface", + "name": { + "name": "TextClassificationInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Specifies the number of top class predictions to return. Defaults to 0.", + "name": "num_top_classes", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels", + "name": "classification_labels", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L281-L290" + }, + { + "description": "Text embedding inference options", + "kind": "interface", + "name": { + "name": "TextEmbeddingInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L212-L218" + }, + { + "kind": "interface", + "name": { + "name": "TextEmbeddingInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L310-L314" + }, { "kind": "interface", "name": { @@ -124830,6 +125657,77 @@ ], "specLocation": "ml/_types/DataframeAnalytics.ts#L416-L421" }, + { + "description": "Tokenization options stored in inference configuration", + "kind": "interface", + "name": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Indicates BERT tokenization and its options", + "name": "bert", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpBertTokenizationConfig", + "namespace": "ml._types" + } + } + }, + { + "description": "Indicates MPNET tokenization and its options", + "name": "mpnet", + "required": false, + "since": "8.1.0", + "type": { + "kind": "instance_of", + "type": { + "name": "NlpBertTokenizationConfig", + "namespace": "ml._types" + } + } + }, + { + "description": "Indicates RoBERTa tokenization and its options", + "name": "roberta", + "required": false, + "since": "8.2.0", + "type": { + "kind": "instance_of", + "type": { + "name": "NlpRobertaTokenizationConfig", + "namespace": "ml._types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L92-L109", + "variants": { + "kind": "container" + } + }, + { + "kind": "enum", + "members": [ + { + "name": "first" + }, + { + "name": "second" + }, + { + "name": "none" + } + ], + "name": { + "name": "TokenizationTruncate", + "namespace": "ml._types" + }, + "specLocation": "ml/_types/inference.ts#L268-L272" + }, { "kind": "interface", "name": { @@ -125297,14 +126195,14 @@ } }, { - "description": "The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model's target_type.", + "description": "The default configuration for inference. This can be either a regression, classification, or one of the many NLP focused configurations. It must match the underlying definition.trained_model's target_type.", "name": "inference_config", "required": true, "type": { "kind": "instance_of", "type": { - "name": "InferenceConfigContainer", - "namespace": "_types.aggregations" + "name": "InferenceConfigCreateContainer", + "namespace": "ml._types" } } }, @@ -126200,6 +127098,158 @@ ], "specLocation": "ml/_types/DataframeAnalytics.ts#L423-L428" }, + { + "description": "Zero shot classification configuration options", + "kind": "interface", + "name": { + "name": "ZeroShotClassificationInferenceOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenizationConfigContainer", + "namespace": "ml._types" + } + } + }, + { + "description": "Hypothesis template used when tokenizing labels for prediction", + "name": "hypothesis_template", + "required": false, + "serverDefault": "\"This example is {}.\"", + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The zero shot classification labels indicating entailment, neutral, and contradiction\nMust contain exactly and only entailment, neutral, and contradiction", + "name": "classification_labels", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Indicates if more than one true label exists.", + "name": "multi_label", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The labels to predict.", + "name": "labels", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L181-L202" + }, + { + "kind": "interface", + "name": { + "name": "ZeroShotClassificationInferenceUpdateOptions", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The tokenization options to update when inferring", + "name": "tokenization", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpTokenizationUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.", + "name": "results_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value.", + "name": "multi_label", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The labels to predict.", + "name": "labels", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L292-L301" + }, { "attachedBehaviors": [ "CommonQueryParameters" @@ -131882,6 +132932,18 @@ } } } + }, + { + "description": "The inference configuration updates to apply on the API call", + "name": "inference_config", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NlpInferenceConfigUpdateContainer", + "namespace": "ml._types" + } + } } ] }, @@ -131926,7 +132988,7 @@ } } ], - "specLocation": "ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts#L25-L52" + "specLocation": "ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts#L26-L57" }, { "body": { @@ -134931,8 +135993,8 @@ "type": { "kind": "instance_of", "type": { - "name": "InferenceConfigContainer", - "namespace": "_types.aggregations" + "name": "InferenceConfigCreateContainer", + "namespace": "ml._types" } } }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 6e6d6341c0..ce959d2b2c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2780,14 +2780,6 @@ export interface AggregationsChildrenAggregation extends AggregationsBucketAggre type?: RelationName } -export interface AggregationsClassificationInferenceOptions { - num_top_classes?: integer - num_top_feature_importance_values?: integer - prediction_field_type?: string - results_field?: string - top_classes_results_field?: string -} - export interface AggregationsCompositeAggregate extends AggregationsMultiBucketAggregateBase { after_key?: Record } @@ -3161,8 +3153,8 @@ export interface AggregationsInferenceClassImportance { } export interface AggregationsInferenceConfigContainer { - regression?: AggregationsRegressionInferenceOptions - classification?: AggregationsClassificationInferenceOptions + regression?: MlRegressionInferenceOptions + classification?: MlClassificationInferenceOptions } export interface AggregationsInferenceFeatureImportance { @@ -3453,11 +3445,6 @@ export interface AggregationsRateAggregation extends AggregationsFormatMetricAgg export type AggregationsRateMode = 'sum' | 'value_count' -export interface AggregationsRegressionInferenceOptions { - results_field?: Field - num_top_feature_importance_values?: integer -} - export interface AggregationsReverseNestedAggregateKeys extends AggregationsSingleBucketAggregateBase { } export type AggregationsReverseNestedAggregate = AggregationsReverseNestedAggregateKeys @@ -11561,6 +11548,14 @@ export interface MlChunkingConfig { export type MlChunkingMode = 'auto' | 'manual' | 'off' +export interface MlClassificationInferenceOptions { + num_top_classes?: integer + num_top_feature_importance_values?: integer + prediction_field_type?: string + results_field?: string + top_classes_results_field?: string +} + export type MlConditionOperator = 'gt' | 'gte' | 'lt' | 'lte' export type MlCustomSettings = any @@ -11951,6 +11946,18 @@ export interface MlDiscoveryNode { export type MlExcludeFrequent = 'all' | 'none' | 'by' | 'over' +export interface MlFillMaskInferenceOptions { + num_top_classes?: integer + tokenization?: MlTokenizationConfigContainer + results_field?: string +} + +export interface MlFillMaskInferenceUpdateOptions { + num_top_classes?: integer + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string +} + export interface MlFilter { description?: string filter_id: Id @@ -11991,6 +11998,17 @@ export interface MlHyperparameters { export type MlInclude = 'definition' | 'feature_importance_baseline' | 'hyperparameters' | 'total_feature_importance' +export interface MlInferenceConfigCreateContainer { + regression?: MlRegressionInferenceOptions + classification?: MlClassificationInferenceOptions + text_classification?: MlTextClassificationInferenceOptions + zero_shot_classification?: MlZeroShotClassificationInferenceOptions + fill_mask?: MlFillMaskInferenceOptions + ner?: MlNerInferenceOptions + pass_through?: MlPassThroughInferenceOptions + text_embedding?: MlTextEmbeddingInferenceOptions +} + export interface MlInfluence { influencer_field_name: string influencer_field_values: string[] @@ -12150,6 +12168,47 @@ export interface MlModelSnapshot { timestamp: long } +export interface MlNerInferenceOptions { + tokenization?: MlTokenizationConfigContainer + results_field?: string + classification_labels?: string[] +} + +export interface MlNerInferenceUpdateOptions { + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string +} + +export interface MlNlpBertTokenizationConfig { + do_lower_case?: boolean + with_special_tokens?: boolean + max_sequence_length?: integer + truncate?: MlTokenizationTruncate + span?: integer +} + +export interface MlNlpInferenceConfigUpdateContainer { + text_classification?: MlTextClassificationInferenceUpdateOptions + zero_shot_classification?: MlZeroShotClassificationInferenceUpdateOptions + fill_mask?: MlFillMaskInferenceUpdateOptions + ner?: MlNerInferenceUpdateOptions + pass_through?: MlPassThroughInferenceUpdateOptions + text_embedding?: MlTextEmbeddingInferenceUpdateOptions +} + +export interface MlNlpRobertaTokenizationConfig { + add_prefix_space?: boolean + with_special_tokens?: boolean + max_sequence_length?: integer + truncate?: MlTokenizationTruncate + span?: integer +} + +export interface MlNlpTokenizationUpdateOptions { + truncate?: MlTokenizationTruncate + span?: integer +} + export interface MlOutlierDetectionParameters { compute_feature_influence?: boolean feature_influence_threshold?: double @@ -12178,6 +12237,16 @@ export interface MlPage { size?: integer } +export interface MlPassThroughInferenceOptions { + tokenization?: MlTokenizationConfigContainer + results_field?: string +} + +export interface MlPassThroughInferenceUpdateOptions { + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string +} + export interface MlPerPartitionCategorization { enabled?: boolean stop_on_warn?: boolean @@ -12185,6 +12254,11 @@ export interface MlPerPartitionCategorization { export type MlPredictedValue = string | double +export interface MlRegressionInferenceOptions { + results_field?: Field + num_top_feature_importance_values?: integer +} + export type MlRoutingState = 'failed' | 'started' | 'starting' | 'stopped' | 'stopping' export type MlRuleAction = 'skip_result' | 'skip_model_update' @@ -12200,11 +12274,43 @@ export interface MlRunningStateSearchInterval { start_ms: long } +export interface MlTextClassificationInferenceOptions { + num_top_classes?: integer + tokenization?: MlTokenizationConfigContainer + results_field?: string + classification_labels?: string[] +} + +export interface MlTextClassificationInferenceUpdateOptions { + num_top_classes?: integer + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string + classification_labels?: string[] +} + +export interface MlTextEmbeddingInferenceOptions { + tokenization?: MlTokenizationConfigContainer + results_field?: string +} + +export interface MlTextEmbeddingInferenceUpdateOptions { + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string +} + export interface MlTimingStats { elapsed_time: integer iteration_time?: integer } +export interface MlTokenizationConfigContainer { + bert?: MlNlpBertTokenizationConfig + mpnet?: MlNlpBertTokenizationConfig + roberta?: MlNlpRobertaTokenizationConfig +} + +export type MlTokenizationTruncate = 'first' | 'second' | 'none' + export interface MlTopClassEntry { class_name: string class_probability: double @@ -12257,7 +12363,7 @@ export interface MlTrainedModelConfig { description?: string estimated_heap_memory_usage_bytes?: integer estimated_operations?: integer - inference_config: AggregationsInferenceConfigContainer + inference_config: MlInferenceConfigCreateContainer input: MlTrainedModelConfigInput license_level?: string metadata?: MlTrainedModelConfigMetadata @@ -12358,6 +12464,22 @@ export interface MlValidationLoss { loss_type: string } +export interface MlZeroShotClassificationInferenceOptions { + tokenization?: MlTokenizationConfigContainer + hypothesis_template?: string + classification_labels: string[] + results_field?: string + multi_label?: boolean + labels?: string[] +} + +export interface MlZeroShotClassificationInferenceUpdateOptions { + tokenization?: MlNlpTokenizationUpdateOptions + results_field?: string + multi_label?: boolean + labels: string[] +} + export interface MlCloseJobRequest extends RequestBase { job_id: Id allow_no_match?: boolean @@ -12971,6 +13093,7 @@ export interface MlInferTrainedModelDeploymentRequest extends RequestBase { timeout?: Time body?: { docs: Record[] + inference_config?: MlNlpInferenceConfigUpdateContainer } } @@ -13304,7 +13427,7 @@ export interface MlPutTrainedModelRequest extends RequestBase { compressed_definition?: string definition?: MlPutTrainedModelDefinition description?: string - inference_config: AggregationsInferenceConfigContainer + inference_config: MlInferenceConfigCreateContainer input: MlPutTrainedModelInput metadata?: any model_type?: MlTrainedModelType diff --git a/specification/_types/aggregations/pipeline.ts b/specification/_types/aggregations/pipeline.ts index c219f64b73..1c8fa7bfdb 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -23,6 +23,10 @@ import { Name, Field, EmptyObject } from '@_types/common' import { integer, double, float } from '@_types/Numeric' import { Script } from '@_types/Scripting' import { Aggregation } from './Aggregation' +import { + RegressionInferenceOptions, + ClassificationInferenceOptions +} from '@ml/_types/inference' export class BucketPathAggregation extends Aggregation { /** @@ -157,41 +161,14 @@ export class InferenceAggregation extends PipelineAggregationBase { inference_config?: InferenceConfigContainer } -export class InferenceConfigContainer { +/** @variants container */ +class InferenceConfigContainer { /** Regression configuration for inference. */ regression?: RegressionInferenceOptions /** Classification configuration for inference. */ classification?: ClassificationInferenceOptions } -export class RegressionInferenceOptions { - /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ - results_field?: Field - /** - * Specifies the maximum number of feature importance values per document. - * @doc_id ml-feature-importance - * @server_default 0 - */ - num_top_feature_importance_values?: integer -} - -export class ClassificationInferenceOptions { - /** Specifies the number of top class predictions to return. Defaults to 0. */ - num_top_classes?: integer - /** - * Specifies the maximum number of feature importance values per document. - * @server_default 0 - * @doc_id ml-feature-importance - */ - num_top_feature_importance_values?: integer - /** Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false. */ - prediction_field_type?: string - /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ - results_field?: string - /** Specifies the field to which the top classes are written. Defaults to top_classes. */ - top_classes_results_field?: string -} - export class MaxBucketAggregation extends PipelineAggregationBase {} export class MinBucketAggregation extends PipelineAggregationBase {} diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index 7b0c636251..4e4bfddcf0 100644 --- a/specification/ml/_types/TrainedModel.ts +++ b/specification/ml/_types/TrainedModel.ts @@ -19,7 +19,6 @@ import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' -import { InferenceConfigContainer } from '@_types/aggregations/pipeline' import { ByteSize, Field, @@ -32,6 +31,7 @@ import { double, integer, long } from '@_types/Numeric' import { Time } from '@_types/Time' import { DateString } from '@_types/Time' import { DiscoveryNode } from './DiscoveryNode' +import { InferenceConfigCreateContainer } from './inference' export class TrainedModelStats { /** A collection of deployment stats, which is present when the models are deployed. */ @@ -176,8 +176,8 @@ export class TrainedModelConfig { estimated_heap_memory_usage_bytes?: integer /** The estimated number of operations to use the trained model. */ estimated_operations?: integer - /** The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model's target_type. */ - inference_config: InferenceConfigContainer + /** The default configuration for inference. This can be either a regression, classification, or one of the many NLP focused configurations. It must match the underlying definition.trained_model's target_type. */ + inference_config: InferenceConfigCreateContainer /** The input field names for the model definition. */ input: TrainedModelConfigInput /** The license level of the trained model. */ diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts new file mode 100644 index 0000000000..3f91ce531c --- /dev/null +++ b/specification/ml/_types/inference.ts @@ -0,0 +1,330 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you 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. + */ + +import { Field } from '@_types/common' +import { integer } from '@_types/Numeric' + +/** + * Inference configuration provided when storing the model config + * @variants container + */ +export class InferenceConfigCreateContainer { + /** Regression configuration for inference. */ + regression?: RegressionInferenceOptions + /** Classification configuration for inference. */ + classification?: ClassificationInferenceOptions + /** + * Text classification configuration for inference. + * @since 8.0.0 + * */ + text_classification?: TextClassificationInferenceOptions + /** + * Zeroshot classification configuration for inference. + * @since 8.0.0 + */ + zero_shot_classification?: ZeroShotClassificationInferenceOptions + /** + * Fill mask configuration for inference. + * @since 8.0.0 + */ + fill_mask?: FillMaskInferenceOptions + /** + * Named entity recognition configuration for inference. + * @since 8.0.0 + * */ + ner?: NerInferenceOptions + /** + * Pass through configuration for inference. + * @since 8.0.0 + */ + pass_through?: PassThroughInferenceOptions + /** + * Text embedding configuration for inference. + * @since 8.0.0 + * */ + text_embedding?: TextEmbeddingInferenceOptions +} + +export class RegressionInferenceOptions { + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: Field + /** + * Specifies the maximum number of feature importance values per document. + * @doc_id ml-feature-importance + * @server_default 0 + */ + num_top_feature_importance_values?: integer +} + +export class ClassificationInferenceOptions { + /** Specifies the number of top class predictions to return. Defaults to 0. */ + num_top_classes?: integer + /** + * Specifies the maximum number of feature importance values per document. + * @server_default 0 + * @doc_id ml-feature-importance + */ + num_top_feature_importance_values?: integer + /** Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false. */ + prediction_field_type?: string + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** Specifies the field to which the top classes are written. Defaults to top_classes. */ + top_classes_results_field?: string +} + +/** + * Tokenization options stored in inference configuration + * @variants container + **/ +export class TokenizationConfigContainer { + /** Indicates BERT tokenization and its options */ + bert?: NlpBertTokenizationConfig + /** + * Indicates MPNET tokenization and its options + * @since 8.1.0 + * */ + mpnet?: NlpBertTokenizationConfig + /** + * Indicates RoBERTa tokenization and its options + * @since 8.2.0 + * */ + roberta?: NlpRobertaTokenizationConfig +} + +/** BERT and MPNet tokenization configuration options */ +export class NlpBertTokenizationConfig { + /** + * Should the tokenizer lower case the text + * @server_default false + */ + do_lower_case?: boolean + /** + * Is tokenization completed with special tokens + * @server_default true + */ + with_special_tokens?: boolean + /** + * Maximum input sequence length for the model + * @server_default 512 + */ + max_sequence_length?: integer + /** + * Should tokenization input be automatically truncated before sending to the model for inference + * @server_default first + */ + truncate?: TokenizationTruncate + /** + * Tokenization spanning options. Special value of -1 indicates no spanning takes place + * @server_default -1 + */ + span?: integer +} + +/** RoBERTa tokenization configuration options */ +export class NlpRobertaTokenizationConfig { + /** + * Should the tokenizer prefix input with a space character + * @server_default false + */ + add_prefix_space?: boolean + /** + * Is tokenization completed with special tokens + * @server_default true + */ + with_special_tokens?: boolean + /** + * Maximum input sequence length for the model + * @server_default 512 + */ + max_sequence_length?: integer + /** + * Should tokenization input be automatically truncated before sending to the model for inference + * @server_default first + */ + truncate?: TokenizationTruncate + /** + * Tokenization spanning options. Special value of -1 indicates no spanning takes place + * @server_default -1 + */ + span?: integer +} + +/** Text classification configuration options */ +export class TextClassificationInferenceOptions { + /** Specifies the number of top class predictions to return. Defaults to 0. */ + num_top_classes?: integer + /** The tokenization options */ + tokenization?: TokenizationConfigContainer + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels */ + classification_labels?: string[] +} + +/** Zero shot classification configuration options */ +export class ZeroShotClassificationInferenceOptions { + /** The tokenization options to update when inferring */ + tokenization?: TokenizationConfigContainer + /** Hypothesis template used when tokenizing labels for prediction + * @server_default "This example is {}." + */ + hypothesis_template?: string + /** + * The zero shot classification labels indicating entailment, neutral, and contradiction + * Must contain exactly and only entailment, neutral, and contradiction + */ + classification_labels: string[] + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** Indicates if more than one true label exists. + * @server_default false + **/ + multi_label?: boolean + /** The labels to predict. */ + labels?: string[] +} + +/** Pass through configuration options */ +export class PassThroughInferenceOptions { + /** The tokenization options */ + tokenization?: TokenizationConfigContainer + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +/** Text embedding inference options */ +export class TextEmbeddingInferenceOptions { + /** The tokenization options */ + tokenization?: TokenizationConfigContainer + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +/** Named entity recognition options */ +export class NerInferenceOptions { + /** The tokenization options */ + tokenization?: TokenizationConfigContainer + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** The token classification labels. Must be IOB formatted tags */ + classification_labels?: string[] +} + +/** Fill mask inference options */ +export class FillMaskInferenceOptions { + /** Specifies the number of top class predictions to return. Defaults to 0. */ + num_top_classes?: integer + /** The tokenization options to update when inferring */ + tokenization?: TokenizationConfigContainer + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +// Update containers that may only allow a subset of the options + +/** @variants container */ +export class NlpInferenceConfigUpdateContainer { + /** Text classification configuration for inference. */ + text_classification?: TextClassificationInferenceUpdateOptions + /** Zeroshot classification configuration for inference. */ + zero_shot_classification?: ZeroShotClassificationInferenceUpdateOptions + /** Fill mask configuration for inference. */ + fill_mask?: FillMaskInferenceUpdateOptions + /** Named entity recognition configuration for inference. */ + ner?: NerInferenceUpdateOptions + /** Pass through configuration for inference. */ + pass_through?: PassThroughInferenceUpdateOptions + /** Text embedding configuration for inference. */ + text_embedding?: TextEmbeddingInferenceUpdateOptions +} + +/** @variants container */ +export class NlpTokenizationUpdateContainer { + /** Update the configured BERT tokenizer options */ + bert?: NlpTokenizationUpdateOptions + /** Update the configured MPNet tokenizer options */ + mpnet?: NlpTokenizationUpdateOptions + /** Update the configured RoBERTa tokenizer options */ + roberta?: NlpTokenizationUpdateOptions +} + +export enum TokenizationTruncate { + first, + second, + none +} + +export class NlpTokenizationUpdateOptions { + /** Truncate options to apply */ + truncate?: TokenizationTruncate + /** Span options to apply */ + span?: integer +} + +export class TextClassificationInferenceUpdateOptions { + /** Specifies the number of top class predictions to return. Defaults to 0. */ + num_top_classes?: integer + /** The tokenization options to update when inferring */ + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels */ + classification_labels?: string[] +} + +export class ZeroShotClassificationInferenceUpdateOptions { + /** The tokenization options to update when inferring */ + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string + /** Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value. */ + multi_label?: boolean + /** The labels to predict. */ + labels: string[] +} + +export class PassThroughInferenceUpdateOptions { + /** The tokenization options to update when inferring */ + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +export class TextEmbeddingInferenceUpdateOptions { + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +export class NerInferenceUpdateOptions { + /** The tokenization options to update when inferring */ + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} + +export class FillMaskInferenceUpdateOptions { + /** Specifies the number of top class predictions to return. Defaults to 0. */ + num_top_classes?: integer + /** The tokenization options to update when inferring */ + tokenization?: NlpTokenizationUpdateOptions + /** The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. */ + results_field?: string +} diff --git a/specification/ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts b/specification/ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts index 60a7b9a47e..fffd084637 100644 --- a/specification/ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts +++ b/specification/ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts @@ -21,6 +21,7 @@ import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' import { Time } from '@_types/Time' import { Dictionary } from '@spec_utils/Dictionary' +import { NlpInferenceConfigUpdateContainer } from '@ml/_types/inference' /** * Evaluates a trained model. @@ -48,5 +49,9 @@ export interface Request extends RequestBase { * configured trained model input. Typically, the field name is `text_field`. Currently, only a single value is allowed. */ docs: Dictionary[] + /** + * The inference configuration updates to apply on the API call + */ + inference_config?: NlpInferenceConfigUpdateContainer } } diff --git a/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts b/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts index bc1dc1784c..74c12e990f 100644 --- a/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts +++ b/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts @@ -18,12 +18,12 @@ */ import { UserDefinedValue } from '@spec_utils/UserDefinedValue' -import { InferenceConfigContainer } from '@_types/aggregations/pipeline' import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' import { long } from '@_types/Numeric' import { Definition, Input } from './types' import { TrainedModelType } from '../_types/TrainedModel' +import { InferenceConfigCreateContainer } from '@ml/_types/inference' /** * Enables you to supply a trained model that is not created by data frame analytics. @@ -66,7 +66,7 @@ export interface Request extends RequestBase { * or classification configuration. It must match the underlying * definition.trained_model's target_type. */ - inference_config: InferenceConfigContainer + inference_config: InferenceConfigCreateContainer /** * The input field names for the model definition. */