From 5dca9865861e27afca1fa6375f6a369c369253e6 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:01:33 -0400 Subject: [PATCH 1/7] [ML] fixing inference specifications --- specification/_types/aggregations/pipeline.ts | 38 +---- specification/ml/_types/inference.ts | 132 ++++++++++++++++++ .../MlInferTrainedModelDeploymentRequest.ts | 5 + 3 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 specification/ml/_types/inference.ts diff --git a/specification/_types/aggregations/pipeline.ts b/specification/_types/aggregations/pipeline.ts index c219f64b73..a905666420 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -23,6 +23,7 @@ import { Name, Field, EmptyObject } from '@_types/common' import { integer, double, float } from '@_types/Numeric' import { Script } from '@_types/Scripting' import { Aggregation } from './Aggregation' +import { PipelineAggInferenceConfigUpdateContainer } from '@ml/_types/inference' export class BucketPathAggregation extends Aggregation { /** @@ -154,42 +155,7 @@ export class ExtendedStatsBucketAggregation extends PipelineAggregationBase { export class InferenceAggregation extends PipelineAggregationBase { model_id: Name - inference_config?: InferenceConfigContainer -} - -export 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 + inference_config?: PipelineAggInferenceConfigUpdateContainer } export class MaxBucketAggregation extends PipelineAggregationBase {} diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts new file mode 100644 index 0000000000..37640e44b0 --- /dev/null +++ b/specification/ml/_types/inference.ts @@ -0,0 +1,132 @@ +import { Field } from '@_types/common' +import { integer } from '@_types/Numeric' + +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 +} + +export class PipelineAggInferenceConfigUpdateContainer { + /** Regression configuration for inference. */ + regression?: RegressionInferenceUpdateOptions + /** Classification configuration for inference. */ + classification?: ClassificationInferenceUpdateOptions +} + +export class RegressionInferenceUpdateOptions { + /** 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 ClassificationInferenceUpdateOptions { + /** 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 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 NlpRobertaTokenizationUpdateOptions { + /** 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 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 } } From 4ef2857ded5fffaa097d57f6c85f92f7a5a674cb Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:03:06 -0400 Subject: [PATCH 2/7] [ML] fixing inference specifications --- specification/ml/_types/TrainedModel.ts | 4 +- specification/ml/_types/inference.ts | 217 ++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 2 deletions(-) diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index 7b0c636251..2a8524126f 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 { InferenceConfigContainer } from './inference' export class TrainedModelStats { /** A collection of deployment stats, which is present when the models are deployed. */ @@ -176,7 +176,7 @@ 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. */ + /** 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: InferenceConfigContainer /** The input field names for the model definition. */ input: TrainedModelConfigInput diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts index 37640e44b0..c09eed59a0 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -1,6 +1,223 @@ import { Field } from '@_types/common' import { integer } from '@_types/Numeric' +/** Inference configuration provided when storing the model config*/ +export class InferenceConfigContainer { + /** 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 */ +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 + * @server_default: ["O", "B_MISC", "I_MISC", "B_PER", "I_PER", "B_ORG", "I_ORG", "B_LOC", "I_LOC"] + */ + 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 + export class NlpInferenceConfigUpdateContainer { /** Text classification configuration for inference. */ text_classification?: TextClassificationInferenceUpdateOptions From 61b433bbdd044304e1f40f168a2ba1e6a9f56a63 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:17:26 -0400 Subject: [PATCH 3/7] generating and contributing spec --- output/schema/schema.json | 1538 +++++++++++++++-- output/typescript/types.ts | 178 +- specification/ml/_types/inference.ts | 29 +- .../MlPutTrainedModelRequest.ts | 2 +- 4 files changed, 1529 insertions(+), 218 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index af4a08c0df..29e10de9b7 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -39794,7 +39794,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L53-L53" + "specLocation": "_types/aggregations/pipeline.ts#L54-L54" }, { "inherits": { @@ -40053,7 +40053,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L98-L104" + "specLocation": "_types/aggregations/pipeline.ts#L99-L105" }, { "kind": "interface", @@ -40075,7 +40075,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L106-L111" + "specLocation": "_types/aggregations/pipeline.ts#L107-L112" }, { "kind": "interface", @@ -40097,7 +40097,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L113-L116" + "specLocation": "_types/aggregations/pipeline.ts#L114-L117" }, { "kind": "interface", @@ -40149,7 +40149,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L118-L136" + "specLocation": "_types/aggregations/pipeline.ts#L119-L137" }, { "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.", @@ -40208,7 +40208,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L63-L96" + "specLocation": "_types/aggregations/pipeline.ts#L64-L97" }, { "inherits": { @@ -40269,7 +40269,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L27-L33" + "specLocation": "_types/aggregations/pipeline.ts#L28-L34" }, { "inherits": { @@ -40296,7 +40296,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L55-L57" + "specLocation": "_types/aggregations/pipeline.ts#L56-L58" }, { "inherits": { @@ -40323,7 +40323,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L59-L61" + "specLocation": "_types/aggregations/pipeline.ts#L60-L62" }, { "inherits": { @@ -40383,7 +40383,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L138-L143" + "specLocation": "_types/aggregations/pipeline.ts#L139-L144" }, { "codegenNames": [ @@ -40449,7 +40449,7 @@ "name": "BucketsPath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L40-L46", + "specLocation": "_types/aggregations/pipeline.ts#L41-L47", "type": { "items": [ { @@ -40868,79 +40868,6 @@ ], "specLocation": "_types/aggregations/bucket.ts#L72-L74" }, - { - "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/master/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": [ @@ -41222,7 +41149,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L145-L145" + "specLocation": "_types/aggregations/pipeline.ts#L146-L146" }, { "inherits": { @@ -41237,7 +41164,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L147-L147" + "specLocation": "_types/aggregations/pipeline.ts#L148-L148" }, { "kind": "interface", @@ -41757,7 +41684,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L149-L149" + "specLocation": "_types/aggregations/pipeline.ts#L150-L150" }, { "inherits": { @@ -41916,7 +41843,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L238-L240" + "specLocation": "_types/aggregations/pipeline.ts#L204-L206" }, { "inherits": { @@ -41951,7 +41878,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L223-L226" + "specLocation": "_types/aggregations/pipeline.ts#L189-L192" }, { "generics": [ @@ -42268,7 +42195,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L151-L153" + "specLocation": "_types/aggregations/pipeline.ts#L152-L154" }, { "codegenNames": [ @@ -42501,7 +42428,7 @@ "name": "GapPolicy", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L48-L51" + "specLocation": "_types/aggregations/pipeline.ts#L49-L52" }, { "inherits": { @@ -43515,7 +43442,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L242-L245" + "specLocation": "_types/aggregations/pipeline.ts#L208-L211" }, { "inherits": { @@ -43550,7 +43477,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L228-L231" + "specLocation": "_types/aggregations/pipeline.ts#L194-L197" }, { "kind": "interface", @@ -43626,7 +43553,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L246-L253" + "specLocation": "_types/aggregations/pipeline.ts#L212-L219" }, { "inherits": { @@ -43661,7 +43588,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L233-L236" + "specLocation": "_types/aggregations/pipeline.ts#L199-L202" }, { "kind": "enum", @@ -43679,7 +43606,7 @@ "name": "HoltWintersType", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L254-L259" + "specLocation": "_types/aggregations/pipeline.ts#L220-L225" }, { "attachedBehaviors": [ @@ -43801,13 +43728,13 @@ "type": { "kind": "instance_of", "type": { - "name": "InferenceConfigContainer", - "namespace": "_types.aggregations" + "name": "PipelineAggInferenceConfigUpdateContainer", + "namespace": "ml._types" } } } ], - "specLocation": "_types/aggregations/pipeline.ts#L155-L158" + "specLocation": "_types/aggregations/pipeline.ts#L156-L159" }, { "kind": "interface", @@ -43841,40 +43768,6 @@ ], "specLocation": "_types/aggregations/Aggregate.ts#L634-L637" }, - { - "kind": "interface", - "name": { - "name": "InferenceConfigContainer", - "namespace": "_types.aggregations" - }, - "properties": [ - { - "description": "Regression configuration for inference.", - "name": "regression", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "RegressionInferenceOptions", - "namespace": "_types.aggregations" - } - } - }, - { - "description": "Classification configuration for inference.", - "name": "classification", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ClassificationInferenceOptions", - "namespace": "_types.aggregations" - } - } - } - ], - "specLocation": "_types/aggregations/pipeline.ts#L160-L165" - }, { "kind": "interface", "name": { @@ -44216,7 +44109,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L213-L216" + "specLocation": "_types/aggregations/pipeline.ts#L179-L182" }, { "description": "Result of the `rare_terms` aggregation when the field is some kind of whole number like a integer, long, or a date.", @@ -44634,7 +44527,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L195-L195" + "specLocation": "_types/aggregations/pipeline.ts#L161-L161" }, { "inherits": { @@ -44766,7 +44659,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L197-L197" + "specLocation": "_types/aggregations/pipeline.ts#L163-L163" }, { "kind": "enum", @@ -44919,7 +44812,7 @@ "name": "MovingAverageAggregation", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L199-L205", + "specLocation": "_types/aggregations/pipeline.ts#L165-L171", "type": { "items": [ { @@ -45012,7 +44905,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L207-L211" + "specLocation": "_types/aggregations/pipeline.ts#L173-L177" }, { "inherits": { @@ -45061,7 +44954,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L261-L265" + "specLocation": "_types/aggregations/pipeline.ts#L227-L231" }, { "inherits": { @@ -45110,7 +45003,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L267-L271" + "specLocation": "_types/aggregations/pipeline.ts#L233-L237" }, { "generics": [ @@ -45456,7 +45349,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L273-L275" + "specLocation": "_types/aggregations/pipeline.ts#L239-L241" }, { "kind": "enum", @@ -45485,7 +45378,7 @@ "name": "NormalizeMethod", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L277-L285" + "specLocation": "_types/aggregations/pipeline.ts#L243-L251" }, { "attachedBehaviors": [ @@ -45785,7 +45678,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L287-L289" + "specLocation": "_types/aggregations/pipeline.ts#L253-L255" }, { "inherits": { @@ -45823,7 +45716,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L35-L38" + "specLocation": "_types/aggregations/pipeline.ts#L36-L39" }, { "inherits": { @@ -46196,43 +46089,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/master/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" @@ -46492,7 +46348,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L291-L293" + "specLocation": "_types/aggregations/pipeline.ts#L257-L259" }, { "inherits": { @@ -47081,7 +46937,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L218-L221" + "specLocation": "_types/aggregations/pipeline.ts#L184-L187" }, { "inherits": { @@ -47626,7 +47482,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L295-L295" + "specLocation": "_types/aggregations/pipeline.ts#L261-L261" }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", @@ -47999,7 +47855,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L297-L297" + "specLocation": "_types/aggregations/pipeline.ts#L263-L263" }, { "kind": "interface", @@ -118279,6 +118135,152 @@ }, "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/master/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#L72-L87" + }, + { + "kind": "interface", + "name": { + "name": "ClassificationInferenceUpdateOptions", + "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/master/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#L269-L284" + }, { "kind": "enum", "members": [ @@ -121874,6 +121876,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#L224-L232" + }, + { + "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#L357-L364" + }, { "kind": "interface", "name": { @@ -122236,6 +122331,119 @@ }, "specLocation": "ml/_types/Include.ts#L20-L42" }, + { + "description": "Inference configuration provided when storing the model config", + "kind": "interface", + "name": { + "name": "InferenceConfigContainer", + "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-L59" + }, { "kind": "interface", "name": { @@ -123755,6 +123963,358 @@ ], "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#L214-L222" + }, + { + "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#L350-L355" + }, + { + "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#L105-L132" + }, + { + "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#L236-L249" + }, + { + "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#L134-L161" + }, + { + "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#L301-L306" + }, { "kind": "interface", "name": { @@ -123984,6 +124544,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#L198-L204" + }, + { + "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#L337-L342" + }, { "kind": "interface", "name": { @@ -124018,6 +124647,40 @@ ], "specLocation": "ml/_types/Analysis.ts#L93-L102" }, + { + "kind": "interface", + "name": { + "name": "PipelineAggInferenceConfigUpdateContainer", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "Regression configuration for inference.", + "name": "regression", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RegressionInferenceUpdateOptions", + "namespace": "ml._types" + } + } + }, + { + "description": "Classification configuration for inference.", + "name": "classification", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ClassificationInferenceUpdateOptions", + "namespace": "ml._types" + } + } + } + ], + "specLocation": "ml/_types/inference.ts#L251-L256" + }, { "kind": "type_alias", "name": { @@ -124045,6 +124708,80 @@ "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/master/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#L61-L70" + }, + { + "kind": "interface", + "name": { + "name": "RegressionInferenceUpdateOptions", + "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/master/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#L258-L267" + }, { "kind": "enum", "members": [ @@ -124171,6 +124908,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#L163-L173" + }, + { + "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#L315-L324" + }, + { + "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#L206-L212" + }, + { + "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#L344-L348" + }, { "kind": "interface", "name": { @@ -124205,6 +125133,74 @@ ], "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#L89-L103" + }, + { + "kind": "enum", + "members": [ + { + "name": "first" + }, + { + "name": "second" + }, + { + "name": "none" + } + ], + "name": { + "name": "TokenizationTruncate", + "namespace": "ml._types" + }, + "specLocation": "ml/_types/inference.ts#L295-L299" + }, { "kind": "interface", "name": { @@ -124672,14 +125668,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" + "namespace": "ml._types" } } }, @@ -125575,6 +126571,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#L175-L196" + }, + { + "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#L326-L335" + }, { "attachedBehaviors": [ "CommonQueryParameters" @@ -130737,6 +131885,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" + } + } } ] }, @@ -130781,7 +131941,7 @@ } } ], - "specLocation": "ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts#L25-L52" + "specLocation": "ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts#L26-L57" }, { "body": { @@ -133787,7 +134947,7 @@ "kind": "instance_of", "type": { "name": "InferenceConfigContainer", - "namespace": "_types.aggregations" + "namespace": "ml._types" } } }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d45eced1cd..7ab8336ac9 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2776,14 +2776,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 } @@ -3140,7 +3132,7 @@ export type AggregationsInferenceAggregate = AggregationsInferenceAggregateKeys export interface AggregationsInferenceAggregation extends AggregationsPipelineAggregationBase { model_id: Name - inference_config?: AggregationsInferenceConfigContainer + inference_config?: MlPipelineAggInferenceConfigUpdateContainer } export interface AggregationsInferenceClassImportance { @@ -3148,11 +3140,6 @@ export interface AggregationsInferenceClassImportance { importance: double } -export interface AggregationsInferenceConfigContainer { - regression?: AggregationsRegressionInferenceOptions - classification?: AggregationsClassificationInferenceOptions -} - export interface AggregationsInferenceFeatureImportance { feature_name: string importance?: double @@ -3441,11 +3428,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 @@ -11531,6 +11513,22 @@ 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 interface MlClassificationInferenceUpdateOptions { + 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 @@ -11921,6 +11919,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 @@ -11961,6 +11971,17 @@ export interface MlHyperparameters { export type MlInclude = 'definition' | 'feature_importance_baseline' | 'hyperparameters' | 'total_feature_importance' +export interface MlInferenceConfigContainer { + 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[] @@ -12120,6 +12141,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 @@ -12148,13 +12210,38 @@ 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 } +export interface MlPipelineAggInferenceConfigUpdateContainer { + regression?: MlRegressionInferenceUpdateOptions + classification?: MlClassificationInferenceUpdateOptions +} + export type MlPredictedValue = string | double +export interface MlRegressionInferenceOptions { + results_field?: Field + num_top_feature_importance_values?: integer +} + +export interface MlRegressionInferenceUpdateOptions { + 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' @@ -12170,11 +12257,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 @@ -12227,7 +12346,7 @@ export interface MlTrainedModelConfig { description?: string estimated_heap_memory_usage_bytes?: integer estimated_operations?: integer - inference_config: AggregationsInferenceConfigContainer + inference_config: MlInferenceConfigContainer input: MlTrainedModelConfigInput license_level?: string metadata?: MlTrainedModelConfigMetadata @@ -12328,6 +12447,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 @@ -12888,6 +13023,7 @@ export interface MlInferTrainedModelDeploymentRequest extends RequestBase { timeout?: Time body?: { docs: Record[] + inference_config?: MlNlpInferenceConfigUpdateContainer } } @@ -13221,7 +13357,7 @@ export interface MlPutTrainedModelRequest extends RequestBase { compressed_definition?: string definition?: MlPutTrainedModelDefinition description?: string - inference_config: AggregationsInferenceConfigContainer + inference_config: MlInferenceConfigContainer input: MlPutTrainedModelInput metadata?: any model_type?: MlTrainedModelType diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts index c09eed59a0..01f664b5a4 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -1,3 +1,22 @@ +/* + * 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' @@ -10,8 +29,7 @@ export class InferenceConfigContainer { /** * Text classification configuration for inference. * @since 8.0.0 - * */ - + * */ text_classification?: TextClassificationInferenceOptions /** * Zeroshot classification configuration for inference. @@ -170,7 +188,7 @@ export class ZeroShotClassificationInferenceOptions { /** 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. + * @server_default false **/ multi_label?: boolean /** The labels to predict. */ @@ -199,10 +217,7 @@ export class NerInferenceOptions { 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 - * @server_default: ["O", "B_MISC", "I_MISC", "B_PER", "I_PER", "B_ORG", "I_ORG", "B_LOC", "I_LOC"] - */ + /** The token classification labels. Must be IOB formatted tags */ classification_labels?: string[] } diff --git a/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts b/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts index bc1dc1784c..76f29d5ee4 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 { InferenceConfigContainer } from '@ml/_types/inference' /** * Enables you to supply a trained model that is not created by data frame analytics. From e018cac6e366874bb2255a833f4e359d25a58b7b Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:20:55 -0400 Subject: [PATCH 4/7] generate --- output/schema/schema.json | 124 ++------------------------------------ 1 file changed, 4 insertions(+), 120 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 4380d2d393..b890bfa798 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -41125,82 +41125,6 @@ "specLocation": "_types/aggregations/bucket.ts#L73-L75" }, { -<<<<<<< HEAD -======= - "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" - }, - { ->>>>>>> upstream/main "inherits": { "generics": [ { @@ -46500,46 +46424,6 @@ "specLocation": "_types/aggregations/metric.ts#L123-L126" }, { -<<<<<<< HEAD -======= - "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" - }, - { ->>>>>>> upstream/main "attachedBehaviors": [ "AdditionalProperties" ], @@ -118822,7 +118706,7 @@ { "description": "Specifies the maximum number of feature importance values per document.", "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/master/ml-feature-importance.html", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", "name": "num_top_feature_importance_values", "required": false, "serverDefault": 0, @@ -118895,7 +118779,7 @@ { "description": "Specifies the maximum number of feature importance values per document.", "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/master/ml-feature-importance.html", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", "name": "num_top_feature_importance_values", "required": false, "serverDefault": 0, @@ -125395,7 +125279,7 @@ { "description": "Specifies the maximum number of feature importance values per document.", "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/master/ml-feature-importance.html", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", "name": "num_top_feature_importance_values", "required": false, "serverDefault": 0, @@ -125432,7 +125316,7 @@ { "description": "Specifies the maximum number of feature importance values per document.", "docId": "ml-feature-importance", - "docUrl": "https://www.elastic.co/guide/en/machine-learning/master/ml-feature-importance.html", + "docUrl": "https://www.elastic.co/guide/en/machine-learning/{branch}/ml-feature-importance.html", "name": "num_top_feature_importance_values", "required": false, "serverDefault": 0, From 9565487a365887697188b2ee5724e3a1833ec437 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Mon, 18 Apr 2022 15:50:58 -0400 Subject: [PATCH 5/7] addressing PR comments --- output/schema/schema.json | 170 ++++++--------------------- output/typescript/types.ts | 17 +-- specification/ml/_types/inference.ts | 45 ++----- 3 files changed, 51 insertions(+), 181 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index b890bfa798..835eb6b9b8 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -118755,80 +118755,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L72-L87" - }, - { - "kind": "interface", - "name": { - "name": "ClassificationInferenceUpdateOptions", - "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#L269-L284" + "specLocation": "ml/_types/inference.ts#L75-L90" }, { "kind": "enum", @@ -122470,7 +122397,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L224-L232" + "specLocation": "ml/_types/inference.ts#L230-L238" }, { "kind": "interface", @@ -122516,7 +122443,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L357-L364" + "specLocation": "ml/_types/inference.ts#L338-L345" }, { "kind": "interface", @@ -122991,7 +122918,10 @@ } } ], - "specLocation": "ml/_types/inference.ts#L23-L59" + "specLocation": "ml/_types/inference.ts#L23-L62", + "variants": { + "kind": "container" + } }, { "kind": "interface", @@ -124560,7 +124490,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L214-L222" + "specLocation": "ml/_types/inference.ts#L220-L228" }, { "kind": "interface", @@ -124594,7 +124524,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L350-L355" + "specLocation": "ml/_types/inference.ts#L331-L336" }, { "description": "BERT and MPNet tokenization configuration options", @@ -124670,7 +124600,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L105-L132" + "specLocation": "ml/_types/inference.ts#L111-L138" }, { "kind": "interface", @@ -124752,7 +124682,10 @@ } } ], - "specLocation": "ml/_types/inference.ts#L236-L249" + "specLocation": "ml/_types/inference.ts#L242-L256", + "variants": { + "kind": "container" + } }, { "description": "RoBERTa tokenization configuration options", @@ -124828,7 +124761,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L134-L161" + "specLocation": "ml/_types/inference.ts#L140-L167" }, { "kind": "interface", @@ -124862,7 +124795,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L301-L306" + "specLocation": "ml/_types/inference.ts#L282-L287" }, { "kind": "interface", @@ -125126,7 +125059,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L198-L204" + "specLocation": "ml/_types/inference.ts#L204-L210" }, { "kind": "interface", @@ -125160,7 +125093,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L337-L342" + "specLocation": "ml/_types/inference.ts#L318-L323" }, { "kind": "interface", @@ -125210,7 +125143,7 @@ "type": { "kind": "instance_of", "type": { - "name": "RegressionInferenceUpdateOptions", + "name": "RegressionInferenceOptions", "namespace": "ml._types" } } @@ -125222,13 +125155,16 @@ "type": { "kind": "instance_of", "type": { - "name": "ClassificationInferenceUpdateOptions", + "name": "ClassificationInferenceOptions", "namespace": "ml._types" } } } ], - "specLocation": "ml/_types/inference.ts#L251-L256" + "specLocation": "ml/_types/inference.ts#L258-L264", + "variants": { + "kind": "container" + } }, { "kind": "type_alias", @@ -125292,44 +125228,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L61-L70" - }, - { - "kind": "interface", - "name": { - "name": "RegressionInferenceUpdateOptions", - "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#L258-L267" + "specLocation": "ml/_types/inference.ts#L64-L73" }, { "kind": "enum", @@ -125517,7 +125416,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L163-L173" + "specLocation": "ml/_types/inference.ts#L169-L179" }, { "kind": "interface", @@ -125578,7 +125477,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L315-L324" + "specLocation": "ml/_types/inference.ts#L296-L305" }, { "description": "Text embedding inference options", @@ -125613,7 +125512,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L206-L212" + "specLocation": "ml/_types/inference.ts#L212-L218" }, { "kind": "interface", @@ -125646,7 +125545,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L344-L348" + "specLocation": "ml/_types/inference.ts#L325-L329" }, { "kind": "interface", @@ -125729,7 +125628,10 @@ } } ], - "specLocation": "ml/_types/inference.ts#L89-L103" + "specLocation": "ml/_types/inference.ts#L92-L109", + "variants": { + "kind": "container" + } }, { "kind": "enum", @@ -125748,7 +125650,7 @@ "name": "TokenizationTruncate", "namespace": "ml._types" }, - "specLocation": "ml/_types/inference.ts#L295-L299" + "specLocation": "ml/_types/inference.ts#L276-L280" }, { "kind": "interface", @@ -127209,7 +127111,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L175-L196" + "specLocation": "ml/_types/inference.ts#L181-L202" }, { "kind": "interface", @@ -127270,7 +127172,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L326-L335" + "specLocation": "ml/_types/inference.ts#L307-L316" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 10e75f4b4c..83d79a2bed 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11553,14 +11553,6 @@ export interface MlClassificationInferenceOptions { top_classes_results_field?: string } -export interface MlClassificationInferenceUpdateOptions { - 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 @@ -12258,8 +12250,8 @@ export interface MlPerPartitionCategorization { } export interface MlPipelineAggInferenceConfigUpdateContainer { - regression?: MlRegressionInferenceUpdateOptions - classification?: MlClassificationInferenceUpdateOptions + regression?: MlRegressionInferenceOptions + classification?: MlClassificationInferenceOptions } export type MlPredictedValue = string | double @@ -12269,11 +12261,6 @@ export interface MlRegressionInferenceOptions { num_top_feature_importance_values?: integer } -export interface MlRegressionInferenceUpdateOptions { - 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' diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts index 01f664b5a4..64941cf148 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -20,7 +20,10 @@ import { Field } from '@_types/common' import { integer } from '@_types/Numeric' -/** Inference configuration provided when storing the model config*/ +/** + * Inference configuration provided when storing the model config + * @variants container + */ export class InferenceConfigContainer { /** Regression configuration for inference. */ regression?: RegressionInferenceOptions @@ -86,7 +89,10 @@ export class ClassificationInferenceOptions { top_classes_results_field?: string } -/** Tokenization options stored in inference configuration */ +/** + * Tokenization options stored in inference configuration + * @variants container + **/ export class TokenizationConfigContainer { /** Indicates BERT tokenization and its options */ bert?: NlpBertTokenizationConfig @@ -233,6 +239,7 @@ export class FillMaskInferenceOptions { // Update containers that may only allow a subset of the options +/** @variants container */ export class NlpInferenceConfigUpdateContainer { /** Text classification configuration for inference. */ text_classification?: TextClassificationInferenceUpdateOptions @@ -248,41 +255,15 @@ export class NlpInferenceConfigUpdateContainer { text_embedding?: TextEmbeddingInferenceUpdateOptions } +/** @variants container */ export class PipelineAggInferenceConfigUpdateContainer { /** Regression configuration for inference. */ - regression?: RegressionInferenceUpdateOptions + regression?: RegressionInferenceOptions /** Classification configuration for inference. */ - classification?: ClassificationInferenceUpdateOptions -} - -export class RegressionInferenceUpdateOptions { - /** 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 ClassificationInferenceUpdateOptions { - /** 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 + classification?: ClassificationInferenceOptions } +/** @variants container */ export class NlpTokenizationUpdateContainer { /** Update the configured BERT tokenizer options */ bert?: NlpTokenizationUpdateOptions From 48a28f73f4035e904c35be9c99419c1a0497d733 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Mon, 18 Apr 2022 16:29:09 -0400 Subject: [PATCH 6/7] addressing pr comments --- output/schema/schema.json | 142 +++++++++--------- output/typescript/types.ts | 18 +-- specification/_types/aggregations/pipeline.ts | 15 +- specification/ml/_types/TrainedModel.ts | 4 +- specification/ml/_types/inference.ts | 10 +- .../MlPutTrainedModelRequest.ts | 4 +- 6 files changed, 98 insertions(+), 95 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 835eb6b9b8..0a867e185c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -42099,7 +42099,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L204-L206" + "specLocation": "_types/aggregations/pipeline.ts#L212-L214" }, { "inherits": { @@ -42134,7 +42134,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L189-L192" + "specLocation": "_types/aggregations/pipeline.ts#L197-L200" }, { "generics": [ @@ -43776,7 +43776,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L208-L211" + "specLocation": "_types/aggregations/pipeline.ts#L216-L219" }, { "inherits": { @@ -43811,7 +43811,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L194-L197" + "specLocation": "_types/aggregations/pipeline.ts#L202-L205" }, { "kind": "interface", @@ -43887,7 +43887,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L212-L219" + "specLocation": "_types/aggregations/pipeline.ts#L220-L227" }, { "inherits": { @@ -43922,7 +43922,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L199-L202" + "specLocation": "_types/aggregations/pipeline.ts#L207-L210" }, { "kind": "enum", @@ -43940,7 +43940,7 @@ "name": "HoltWintersType", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L220-L225" + "specLocation": "_types/aggregations/pipeline.ts#L228-L233" }, { "attachedBehaviors": [ @@ -44062,8 +44062,8 @@ "type": { "kind": "instance_of", "type": { - "name": "PipelineAggInferenceConfigUpdateContainer", - "namespace": "ml._types" + "name": "InferenceConfigContainer", + "namespace": "_types.aggregations" } } } @@ -44102,6 +44102,43 @@ ], "specLocation": "_types/aggregations/Aggregate.ts#L634-L637" }, + { + "kind": "interface", + "name": { + "name": "InferenceConfigContainer", + "namespace": "_types.aggregations" + }, + "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" + } + } + } + ], + "specLocation": "_types/aggregations/pipeline.ts#L161-L167", + "variants": { + "kind": "container" + } + }, { "kind": "interface", "name": { @@ -44443,7 +44480,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L179-L182" + "specLocation": "_types/aggregations/pipeline.ts#L187-L190" }, { "description": "Result of the `rare_terms` aggregation when the field is some kind of whole number like a integer, long, or a date.", @@ -44861,7 +44898,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L161-L161" + "specLocation": "_types/aggregations/pipeline.ts#L169-L169" }, { "inherits": { @@ -44993,7 +45030,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L163-L163" + "specLocation": "_types/aggregations/pipeline.ts#L171-L171" }, { "kind": "enum", @@ -45146,7 +45183,7 @@ "name": "MovingAverageAggregation", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L165-L171", + "specLocation": "_types/aggregations/pipeline.ts#L173-L179", "type": { "items": [ { @@ -45239,7 +45276,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L173-L177" + "specLocation": "_types/aggregations/pipeline.ts#L181-L185" }, { "inherits": { @@ -45288,7 +45325,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L227-L231" + "specLocation": "_types/aggregations/pipeline.ts#L235-L239" }, { "inherits": { @@ -45337,7 +45374,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L233-L237" + "specLocation": "_types/aggregations/pipeline.ts#L241-L245" }, { "generics": [ @@ -45683,7 +45720,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L239-L241" + "specLocation": "_types/aggregations/pipeline.ts#L247-L249" }, { "kind": "enum", @@ -45712,7 +45749,7 @@ "name": "NormalizeMethod", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L243-L251" + "specLocation": "_types/aggregations/pipeline.ts#L251-L259" }, { "attachedBehaviors": [ @@ -46012,7 +46049,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L253-L255" + "specLocation": "_types/aggregations/pipeline.ts#L261-L263" }, { "inherits": { @@ -46682,7 +46719,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L257-L259" + "specLocation": "_types/aggregations/pipeline.ts#L265-L267" }, { "inherits": { @@ -47278,7 +47315,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L184-L187" + "specLocation": "_types/aggregations/pipeline.ts#L192-L195" }, { "inherits": { @@ -47823,7 +47860,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L261-L261" + "specLocation": "_types/aggregations/pipeline.ts#L269-L269" }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", @@ -48196,7 +48233,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L263-L263" + "specLocation": "_types/aggregations/pipeline.ts#L271-L271" }, { "kind": "interface", @@ -122443,7 +122480,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L338-L345" + "specLocation": "ml/_types/inference.ts#L330-L337" }, { "kind": "interface", @@ -122811,7 +122848,7 @@ "description": "Inference configuration provided when storing the model config", "kind": "interface", "name": { - "name": "InferenceConfigContainer", + "name": "InferenceConfigCreateContainer", "namespace": "ml._types" }, "properties": [ @@ -124524,7 +124561,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L331-L336" + "specLocation": "ml/_types/inference.ts#L323-L328" }, { "description": "BERT and MPNet tokenization configuration options", @@ -124795,7 +124832,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L282-L287" + "specLocation": "ml/_types/inference.ts#L274-L279" }, { "kind": "interface", @@ -125093,7 +125130,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L318-L323" + "specLocation": "ml/_types/inference.ts#L310-L315" }, { "kind": "interface", @@ -125129,43 +125166,6 @@ ], "specLocation": "ml/_types/Analysis.ts#L93-L102" }, - { - "kind": "interface", - "name": { - "name": "PipelineAggInferenceConfigUpdateContainer", - "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" - } - } - } - ], - "specLocation": "ml/_types/inference.ts#L258-L264", - "variants": { - "kind": "container" - } - }, { "kind": "type_alias", "name": { @@ -125477,7 +125477,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L296-L305" + "specLocation": "ml/_types/inference.ts#L288-L297" }, { "description": "Text embedding inference options", @@ -125545,7 +125545,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L325-L329" + "specLocation": "ml/_types/inference.ts#L317-L321" }, { "kind": "interface", @@ -125650,7 +125650,7 @@ "name": "TokenizationTruncate", "namespace": "ml._types" }, - "specLocation": "ml/_types/inference.ts#L276-L280" + "specLocation": "ml/_types/inference.ts#L268-L272" }, { "kind": "interface", @@ -126125,7 +126125,7 @@ "type": { "kind": "instance_of", "type": { - "name": "InferenceConfigContainer", + "name": "InferenceConfigCreateContainer", "namespace": "ml._types" } } @@ -127172,7 +127172,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L307-L316" + "specLocation": "ml/_types/inference.ts#L299-L308" }, { "attachedBehaviors": [ @@ -135917,7 +135917,7 @@ "type": { "kind": "instance_of", "type": { - "name": "InferenceConfigContainer", + "name": "InferenceConfigCreateContainer", "namespace": "ml._types" } } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 83d79a2bed..4a5e46ab6e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -3143,7 +3143,7 @@ export type AggregationsInferenceAggregate = AggregationsInferenceAggregateKeys export interface AggregationsInferenceAggregation extends AggregationsPipelineAggregationBase { model_id: Name - inference_config?: MlPipelineAggInferenceConfigUpdateContainer + inference_config?: AggregationsInferenceConfigContainer } export interface AggregationsInferenceClassImportance { @@ -3151,6 +3151,11 @@ export interface AggregationsInferenceClassImportance { importance: double } +export interface AggregationsInferenceConfigContainer { + regression?: MlRegressionInferenceOptions + classification?: MlClassificationInferenceOptions +} + export interface AggregationsInferenceFeatureImportance { feature_name: string importance?: double @@ -11995,7 +12000,7 @@ export interface MlHyperparameters { export type MlInclude = 'definition' | 'feature_importance_baseline' | 'hyperparameters' | 'total_feature_importance' -export interface MlInferenceConfigContainer { +export interface MlInferenceConfigCreateContainer { regression?: MlRegressionInferenceOptions classification?: MlClassificationInferenceOptions text_classification?: MlTextClassificationInferenceOptions @@ -12249,11 +12254,6 @@ export interface MlPerPartitionCategorization { stop_on_warn?: boolean } -export interface MlPipelineAggInferenceConfigUpdateContainer { - regression?: MlRegressionInferenceOptions - classification?: MlClassificationInferenceOptions -} - export type MlPredictedValue = string | double export interface MlRegressionInferenceOptions { @@ -12365,7 +12365,7 @@ export interface MlTrainedModelConfig { description?: string estimated_heap_memory_usage_bytes?: integer estimated_operations?: integer - inference_config: MlInferenceConfigContainer + inference_config: MlInferenceConfigCreateContainer input: MlTrainedModelConfigInput license_level?: string metadata?: MlTrainedModelConfigMetadata @@ -13429,7 +13429,7 @@ export interface MlPutTrainedModelRequest extends RequestBase { compressed_definition?: string definition?: MlPutTrainedModelDefinition description?: string - inference_config: MlInferenceConfigContainer + 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 a905666420..1c8fa7bfdb 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -23,7 +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 { PipelineAggInferenceConfigUpdateContainer } from '@ml/_types/inference' +import { + RegressionInferenceOptions, + ClassificationInferenceOptions +} from '@ml/_types/inference' export class BucketPathAggregation extends Aggregation { /** @@ -155,7 +158,15 @@ export class ExtendedStatsBucketAggregation extends PipelineAggregationBase { export class InferenceAggregation extends PipelineAggregationBase { model_id: Name - inference_config?: PipelineAggInferenceConfigUpdateContainer + inference_config?: InferenceConfigContainer +} + +/** @variants container */ +class InferenceConfigContainer { + /** Regression configuration for inference. */ + regression?: RegressionInferenceOptions + /** Classification configuration for inference. */ + classification?: ClassificationInferenceOptions } export class MaxBucketAggregation extends PipelineAggregationBase {} diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index 2a8524126f..4e4bfddcf0 100644 --- a/specification/ml/_types/TrainedModel.ts +++ b/specification/ml/_types/TrainedModel.ts @@ -31,7 +31,7 @@ import { double, integer, long } from '@_types/Numeric' import { Time } from '@_types/Time' import { DateString } from '@_types/Time' import { DiscoveryNode } from './DiscoveryNode' -import { InferenceConfigContainer } from './inference' +import { InferenceConfigCreateContainer } from './inference' export class TrainedModelStats { /** A collection of deployment stats, which is present when the models are deployed. */ @@ -177,7 +177,7 @@ export class TrainedModelConfig { /** The estimated number of operations to use the trained model. */ estimated_operations?: integer /** 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: InferenceConfigContainer + 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 index 64941cf148..3c02f02c3d 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -24,7 +24,7 @@ import { integer } from '@_types/Numeric' * Inference configuration provided when storing the model config * @variants container */ -export class InferenceConfigContainer { +export class InferenceConfigCreateContainer { /** Regression configuration for inference. */ regression?: RegressionInferenceOptions /** Classification configuration for inference. */ @@ -255,14 +255,6 @@ export class NlpInferenceConfigUpdateContainer { text_embedding?: TextEmbeddingInferenceUpdateOptions } -/** @variants container */ -export class PipelineAggInferenceConfigUpdateContainer { - /** Regression configuration for inference. */ - regression?: RegressionInferenceOptions - /** Classification configuration for inference. */ - classification?: ClassificationInferenceOptions -} - /** @variants container */ export class NlpTokenizationUpdateContainer { /** Update the configured BERT tokenizer options */ diff --git a/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts b/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts index 76f29d5ee4..74c12e990f 100644 --- a/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts +++ b/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts @@ -23,7 +23,7 @@ import { Id } from '@_types/common' import { long } from '@_types/Numeric' import { Definition, Input } from './types' import { TrainedModelType } from '../_types/TrainedModel' -import { InferenceConfigContainer } from '@ml/_types/inference' +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. */ From a1b20cd624a13712ddb653bb48ff7c6f3419f2b8 Mon Sep 17 00:00:00 2001 From: Benjamin Trent <4357155+benwtrent@users.noreply.github.com> Date: Mon, 18 Apr 2022 17:03:47 -0400 Subject: [PATCH 7/7] fixing types for tokenization updates --- output/schema/schema.json | 92 ++++++++++++++-------------- specification/ml/_types/inference.ts | 7 --- 2 files changed, 46 insertions(+), 53 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 0a867e185c..6c34ab6c4f 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -40050,7 +40050,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L54-L54" + "specLocation": "_types/aggregations/pipeline.ts#L57-L57" }, { "inherits": { @@ -40309,7 +40309,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L99-L105" + "specLocation": "_types/aggregations/pipeline.ts#L102-L108" }, { "kind": "interface", @@ -40331,7 +40331,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L107-L112" + "specLocation": "_types/aggregations/pipeline.ts#L110-L115" }, { "kind": "interface", @@ -40353,7 +40353,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L114-L117" + "specLocation": "_types/aggregations/pipeline.ts#L117-L120" }, { "kind": "interface", @@ -40405,7 +40405,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L119-L137" + "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.", @@ -40464,7 +40464,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L64-L97" + "specLocation": "_types/aggregations/pipeline.ts#L67-L100" }, { "inherits": { @@ -40525,7 +40525,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L28-L34" + "specLocation": "_types/aggregations/pipeline.ts#L31-L37" }, { "inherits": { @@ -40552,7 +40552,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L56-L58" + "specLocation": "_types/aggregations/pipeline.ts#L59-L61" }, { "inherits": { @@ -40579,7 +40579,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L60-L62" + "specLocation": "_types/aggregations/pipeline.ts#L63-L65" }, { "inherits": { @@ -40639,7 +40639,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L139-L144" + "specLocation": "_types/aggregations/pipeline.ts#L142-L147" }, { "codegenNames": [ @@ -40705,7 +40705,7 @@ "name": "BucketsPath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L41-L47", + "specLocation": "_types/aggregations/pipeline.ts#L44-L50", "type": { "items": [ { @@ -41405,7 +41405,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L146-L146" + "specLocation": "_types/aggregations/pipeline.ts#L149-L149" }, { "inherits": { @@ -41420,7 +41420,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L148-L148" + "specLocation": "_types/aggregations/pipeline.ts#L151-L151" }, { "kind": "interface", @@ -41940,7 +41940,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L150-L150" + "specLocation": "_types/aggregations/pipeline.ts#L153-L153" }, { "inherits": { @@ -42099,7 +42099,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L212-L214" + "specLocation": "_types/aggregations/pipeline.ts#L215-L217" }, { "inherits": { @@ -42134,7 +42134,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L197-L200" + "specLocation": "_types/aggregations/pipeline.ts#L200-L203" }, { "generics": [ @@ -42451,7 +42451,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L152-L154" + "specLocation": "_types/aggregations/pipeline.ts#L155-L157" }, { "codegenNames": [ @@ -42684,7 +42684,7 @@ "name": "GapPolicy", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L49-L52" + "specLocation": "_types/aggregations/pipeline.ts#L52-L55" }, { "inherits": { @@ -43776,7 +43776,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L216-L219" + "specLocation": "_types/aggregations/pipeline.ts#L219-L222" }, { "inherits": { @@ -43811,7 +43811,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L202-L205" + "specLocation": "_types/aggregations/pipeline.ts#L205-L208" }, { "kind": "interface", @@ -43887,7 +43887,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L220-L227" + "specLocation": "_types/aggregations/pipeline.ts#L223-L230" }, { "inherits": { @@ -43922,7 +43922,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L207-L210" + "specLocation": "_types/aggregations/pipeline.ts#L210-L213" }, { "kind": "enum", @@ -43940,7 +43940,7 @@ "name": "HoltWintersType", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L228-L233" + "specLocation": "_types/aggregations/pipeline.ts#L231-L236" }, { "attachedBehaviors": [ @@ -44068,7 +44068,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L156-L159" + "specLocation": "_types/aggregations/pipeline.ts#L159-L162" }, { "kind": "interface", @@ -44134,7 +44134,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L161-L167", + "specLocation": "_types/aggregations/pipeline.ts#L164-L170", "variants": { "kind": "container" } @@ -44480,7 +44480,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L187-L190" + "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.", @@ -44898,7 +44898,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L169-L169" + "specLocation": "_types/aggregations/pipeline.ts#L172-L172" }, { "inherits": { @@ -45030,7 +45030,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L171-L171" + "specLocation": "_types/aggregations/pipeline.ts#L174-L174" }, { "kind": "enum", @@ -45183,7 +45183,7 @@ "name": "MovingAverageAggregation", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L173-L179", + "specLocation": "_types/aggregations/pipeline.ts#L176-L182", "type": { "items": [ { @@ -45276,7 +45276,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L181-L185" + "specLocation": "_types/aggregations/pipeline.ts#L184-L188" }, { "inherits": { @@ -45325,7 +45325,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L235-L239" + "specLocation": "_types/aggregations/pipeline.ts#L238-L242" }, { "inherits": { @@ -45374,7 +45374,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L241-L245" + "specLocation": "_types/aggregations/pipeline.ts#L244-L248" }, { "generics": [ @@ -45720,7 +45720,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L247-L249" + "specLocation": "_types/aggregations/pipeline.ts#L250-L252" }, { "kind": "enum", @@ -45749,7 +45749,7 @@ "name": "NormalizeMethod", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L251-L259" + "specLocation": "_types/aggregations/pipeline.ts#L254-L262" }, { "attachedBehaviors": [ @@ -46049,7 +46049,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L261-L263" + "specLocation": "_types/aggregations/pipeline.ts#L264-L266" }, { "inherits": { @@ -46087,7 +46087,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L36-L39" + "specLocation": "_types/aggregations/pipeline.ts#L39-L42" }, { "inherits": { @@ -46719,7 +46719,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L265-L267" + "specLocation": "_types/aggregations/pipeline.ts#L268-L270" }, { "inherits": { @@ -47315,7 +47315,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L192-L195" + "specLocation": "_types/aggregations/pipeline.ts#L195-L198" }, { "inherits": { @@ -47860,7 +47860,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L269-L269" + "specLocation": "_types/aggregations/pipeline.ts#L272-L272" }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", @@ -48233,7 +48233,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L271-L271" + "specLocation": "_types/aggregations/pipeline.ts#L274-L274" }, { "kind": "interface", @@ -122480,7 +122480,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L330-L337" + "specLocation": "ml/_types/inference.ts#L323-L330" }, { "kind": "interface", @@ -124561,7 +124561,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L323-L328" + "specLocation": "ml/_types/inference.ts#L316-L321" }, { "description": "BERT and MPNet tokenization configuration options", @@ -125130,7 +125130,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L310-L315" + "specLocation": "ml/_types/inference.ts#L303-L308" }, { "kind": "interface", @@ -125477,7 +125477,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L288-L297" + "specLocation": "ml/_types/inference.ts#L281-L290" }, { "description": "Text embedding inference options", @@ -125545,7 +125545,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L317-L321" + "specLocation": "ml/_types/inference.ts#L310-L314" }, { "kind": "interface", @@ -127172,7 +127172,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L299-L308" + "specLocation": "ml/_types/inference.ts#L292-L301" }, { "attachedBehaviors": [ diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts index 3c02f02c3d..3f91ce531c 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -278,13 +278,6 @@ export class NlpTokenizationUpdateOptions { span?: integer } -export class NlpRobertaTokenizationUpdateOptions { - /** 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 TextClassificationInferenceUpdateOptions { /** Specifies the number of top class predictions to return. Defaults to 0. */ num_top_classes?: integer